Slack Bot Template in Python

Slack Bot Template in Python

A simple Slack bot programmed in Python

Deploy Slack Bot Template 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

    Screenshot 2024-08-08 at 1 17 37 PM

Then Install the app to the Workspace.

3) Go to Railway and deploy 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

Template Content

slack-bot-template

Alhwyn/slack-bot-template
Deploy Now

Details

Alhwyn's Projects

Created on Aug 8, 2024

11 total projects

7 active projects

Python, Procfile

Bots



More templates in this category

View Template
waha

waha

WhatsApp API that you can run in a click


andresfiloso

View Template
Telegram JavaScript Bot

Telegram JavaScript Bot

A template for Telegram bot in JavaScript using grammY


Agampreet Singh's Projects

View Template
DiscordJS bot

DiscordJS bot

A basic Discord bot written in JavaScript


opqr's Projects