You can build a Slack bot using vals.
Vals can receive events from Slack’s Events API via the Express API. In this guide, you’ll build a bot that replies whenever it’s mentioned.
Visit https://api.slack.com/apps?new_app=1, create a new app From Scratch, and choose your App Name and your workspace.
When your handler val receives requests, you can verify that they were sent by Slack by looking for the verification token.
To find your app’s verification token, go to Settings → Basic Information in the side bar. Scroll down to App Credentials.
Save the Verification Token as a Val Town secret as slackVerificationToken
.
When you add a Request URL, Slack will immediately send a challenge to verify the endpoint is correct.
Fork this val that responds to the challenge, and replies to app_mention
events.
https://www.val.town/embed/neverstew.slackReplyToMessage
On your forked val, copy the Web endpoint via the menu at Endpoints > Copy web endpoint.
Back on Slack, navigate to the Event Subscription page. It’s under Features in the side bar.
Toggle on Enable Events, and paste your endpoint in the Request URL field.