Slackbot Quickstart Guide
Introduction #
Using the Slack SDKs to automate work, notifications, or integrations can be a total productivity hack. This template makes use of the Slack Bolt framework for developing Slack Applications. Slack Bolt abstracts away most of the headaches associated with developing directly in the Slack SDK.
Using our template, you can have an interactive slack app up and running in 5 minutes with 18 lines of code.
Getting started #
To get started building with Slack, fork this template by clicking "Use template".
Create new app #
Go to your apps dashboard here. Select "Create New App."
Use the manifest file #
On the "Create an app" screen, select the "From an app manifest" option. Then select the Slack Workspace you want to add your bot to. Then we will paste in the manifest. Here is your manifest:
This code can be found within your template at assets/manifest.json. The manifest file defines the Then create your app.
The manifest defines the attributes of the bot. Examples include:
- display_information - The name, description, and background color of the bot
- features - home tab, messages tab, display_name, and more for the bot
- oauth_config - Defined permissions for the application. In this case, the bot can read messages that mention the app (app_mentions:read), view messages in public channels (channels:history), read info on public channels (channels:read), and send messages (chat:write)
- settings - miscellaneous attributes like event_subscriptions, interactivity, and more
For more options, it's worth checking out the Slack documentation.
Install to workspace #
On your app page, scroll down until you see the ability to "Install App to Workspace." Follow that process.
Add secrets #
Scroll down to the "App credentials" section, and copy and paste the following credentials into the Secrets pane in Replit:
- SLACK_SIGNING_SECRET - The "signing secret" for your app, found on the "Basic Information Page"
- SLACK_APP_TOKEN - The app-level token, found under "App Credentials" on the "Basic Information" page
- SLACK_BOT_TOKEN - The bot token for your app, found on the "OAuth & Permissions" page
Running your bot #
Once you have your application configured and tokens set, you can hit Run (⌘ + Enter) in Replit to execute app.py. Only 18 lines long, the app uses the Bolt framework to authenticate and configure your app in Socket mode. The only event listener in the app is:
Which looks for a mention of your app's name. Head over to a channel where your app is a member (if it's not, you can add it with a mention) & give it a mention to see what happens!
Deploy your bot #
With Replit, you can stop / start the Repl in development mode using ⌘ + Enter. Any changes saved in your files will be immediately and directly saved to your application. Check the Console pane (⌘ + K, "console") to see logs as they occur. Note that you'll need to stop & restart your application for changes to be reflected. This can be accomplished easily with the shortcut mentioned above.
When you're done developing, you can promote your app to a deployed version in one click— just head over to deployments (⌘ + K and type "deploy") to get started.
Note: For a Slack bot, we recommend using a Reserved VM, and then deploying it as a "background worker."
What's next #
For next steps, you can use our guides to learn more about using Large Language Models (LLMs), and then you could integrate it into your Slackbot.