Slack
Requirements
HTTPS Enpoint
To connect to Slack, and HTTPS endpoint is required. Set the externalUrl
field in botpress.config.json. You can use the following methods to create this endpoint:
- Create an HTTPS tunnel to your machine using Ngrok. This tutorial works on pretty much any Operating System. Tutorial
- Using Nginx and Let's Encrypt. This tutorial is based on the Linux Ubuntu 16.04 Operating System. Tutorial
- Use Serveo to create an HTTPS tunnel to your machine. Tutorial
⭐ Note: To test on localhost, you can also use services like pagekite or tunnelme to expose your server.
Setup
Create the app on Slack
Go to your apps page
Click on
Create new app
then give it a name
Setup Callback on Slack
Open the page
Event Subscriptions
, then turn the switch toOn
Set the request URL to:
<EXTERNAL_URL>/api/v1/bots/<YOUR_BOT_ID>/mod/channel-slack/events-callback
- Replace EXTERNAL_URL by the value of
externalUrl
in your botpress.config.json - Replace YOUR_BOT_ID by your bot ID
Under
Subscribe to bot events
addmessages.im
andmessages.channels
(you can also add other types of messages if you want)Open the page
Interactive Components
, then turn the switch toOn
Set the request URL to:
EXTERNAL_URL/api/v1/bots/YOUR_BOT_ID/mod/channel-slack/bots/YOUR_BOT_ID/callback
- Replace EXTERNAL_URL by the value of
externalUrl
in your botpress.config.json - Replace YOUR_BOT_ID by your bot ID
Open the page
OAuth & Permissions
and addchat:write
underScopes
Install the app by clicking the
Install App to Workspace
button
Configuration
Configure your bot
- Edit
data/bots/YOUR_BOT_ID/config/channel-slack.json
(or create it) and set
- enabled: Set to
true
- signingSecret: Take the value
Signing Secret
on the pageBasic Information
- useRTM: false (true if you have a legacy app)
Restart Botpress
Return to
data/bots/YOUR_BOT_ID/config/channel-slack.json
and set
- botToken: Take the value Bot User OAuth Access Token on the page OAuth & Permissions
- Restart Botpress