Slack
Connect Slack With Botgenuity Chatbot
Prerequisites
- A Slack App to connect your bot to Slack. Create one from scratch.
- A Botgenuity account and a Botgenuity Bot
Setting up the Slack integration in Botgenuity
- Go to the [Integration Hub](opens in a new tab) in Botgenuity (if you don't have the integration installed yet).
- Find and open the Slack integration then click on the "Install to Bot" button, now go back to your bot.
The Slack integration has the following settings:
- Enabled: Whether Botgenuity will communicate with Slack
- Webhook URL: The URL for receiving data in Botgenuity
- Bot Token: The token used to authenticate requests made to Slack
- Signing Secret: The secret used to verify the requests
Setting up Slack
Bot Token
- In the left sidebar, click on Features > OAuth & Permissions.
- Scroll down to the Scope > Bot Token Scopes section, click Add an OAuth
Scope. Select both
chat:write
andchat:write.customize
options from the list. - Scroll up and click the Install to Workspace button in the OAuth Tokens for Your Workspace section.
- In the next screen, your app will request access to your Slack workspace. Click Allow.
- In the OAuth & Permissions > OAuth Tokens for Your Workspace section, copy the Bot User OAuth Token.
- Copy the token and paste it in the Bot Token input in Botgenuity.
Signing Secret
The signing secret is used to verify webhook requests
- In the left sidebar of the app details page, click on Settings > Basic Information.
- Scroll down to App Credentials section. Next to Signing Secret, click Show to reveal the secret.
- Copy the secret to the Signing Secret input in Botgenuity.
Save Configuration
Channel configuration is complete, you can now click Save. It is important you save your configuration before configuring the webhooks, otherwise Slack will be unable to validate the webhook url
Webhook Configuration
Events Webhook
Slack sends regular events such as messages to the event webhook
- In the left sidebar, click on Features > Event Subscriptions
- Turn on events by click the On/Off button
- Copy paste the webhook url provided in the channel configuration UI to the Request URL field
- Under Subscribe to bot event, add
message.im
andmessage.channels
- Click the Save Changes button. Make sure your Slack channel configuration is saved before doing this step, otherwise webhook validation will fail
- A yellow banner will be displayed at the top of the screen. Click the reinstall your app link
- In the next screen, your app will request access to your Slack workspace. Click Allow.
Interactivity Webhook
Slack sends "interactive" events such as reactions to message to the interactivity webhook
- In the left sidebar, click on Features > Interactivity & Shortcuts
- Turn on interactivity by click the On/Off button
- Copy paste the webhook url provided in the channel configuration UI to the Request URL field
- Click the Save Changes button
Install App
Add App to Workspace
Your Slack app needs to be added to your workspace to allow Slack users to communicate with it
- In the left sidebar, click on Features > App Home
- Scroll down and in the Show Tabs > Messages Tab section, tick Allow users to send Slash commands and messages from the messages tab
- In Slack, under the Apps section of the sidebar, click the + Add apps button. In the search bar, type the name of your Slack app. Click on your Slack app in the search results.
That's it, you may now start chatting with your bot on Slack!