Skip to content

Slack bot template using Python for messaging, command, and interactive commands using buttons and modals. Easily for deploying in Railway.

Notifications You must be signed in to change notification settings

Alhwyn/slack-bot-template

Repository files navigation

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

    Screenshot 2024-08-08 at 1 17 37 PM

Then Install the app to the Workspace.

3) Go to Railway and deplay my template

Deploy on Railway

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.
Screenshot 2024-08-08 at 1 04 59 PM

https://{your-domain}/slack/events

Add the following scope in the Event Subscriptions below. Then Save changes. Screenshot 2024-08-08 at 1 02 48 PM

6) Turn on Interactivity & Shortcuts and paste in your request url and save changes

Screenshot 2024-08-08 at 1 04 21 PM

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
Screenshot 2024-08-08 at 1 06 55 PM

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

Screenshot 2024-08-08 at 1 10 07 PM

About

Slack bot template using Python for messaging, command, and interactive commands using buttons and modals. Easily for deploying in Railway.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published