
Slack Bot Template in Python
A simple Slack bot programmed in Python
slack-bot-template
Alhwyn/slack-bot-template
Just deployed
Slack Bot Template for Production Railway 🚃🤖
1) Create your app
Sign up or login and create your app.
https://api.slack.com/apps
2) Select OAuth and Permission -> Bot Token Scopes. Then add the following Bot Token scopes shown below.
-
app_mentions:read
-
channels:history
-
channels:read
-
chat:write
-
commands
-
im:history
-
mpim:history
Then Install the app to the Workspace.
3) Go to Railway and deploy my template
Add the following secret variables for deployment.
- SLACK_BOT_TOKEN (located in OAuth & Permission)
- SLACK_SIGNING_SECRET (located in Basic Information)
- SLACK_BOT_USER_ID (located in Basic Information)
Once your variable are added deply the template
4) Once your the slack template is deployed. Go to setting and generate your domain
Settings → Networking → Gen erate Domain
5) Once your domain is set up then go back to slack API and go to your Event Subscription
turn on Enable Events. Then in your request url paste your domain in this specific format.
https://{your-domain}/slack/events
Add the following scope in the Event Subscriptions below. Then Save changes.
6) Turn on Interactivity & Shortcuts and paste in your request url and save changes
7) Go to Slash Commands → Create new Command
Here are the requiremnets for your slack comand
- Command Name (has to be the states the same in the code)
- Request Url ( [http://{your-domain}/slack/events )
- Short Description
here are the Command Names in the template.
- /command_example
- /modal_example
- /button_example
Once your done invite your slack bot to a channel and try out the template Example
Template Content
slack-bot-template
Alhwyn/slack-bot-templateSLACK_BOT_TOKEN
OAuth & Permission after adding scopes and installing app
SLACK_BOT_USER_ID
found in Basic information
SLACK_SIGNING_SECRET
found in basic information