-
Notifications
You must be signed in to change notification settings - Fork 1
Slack Bot Setup
Manan Garg edited this page Jan 14, 2024
·
3 revisions
- Go to https://api.slack.com/apps and click on "Create New App" on the top right corner and choose "From scratch"
- Fill in the information and click "Create App"
- Go to "Socket Mode" under Settings pane on the left and enable Socket Mode. Allow only the "connections:write" scope and click on "Generate".
- Copy the generated token. This will be the environment variable "SLACK_APP_TOKEN"
- Go to "App Manifest" under Features pane on the left and paste this manifest (change the name accordingly)
-
Manifest (YAML)
display_information: name: GoTest features: bot_user: display_name: GoTest always_online: false shortcuts: - name: Delete type: message callback_id: delete_message description: Delete this message slash_commands: - command: /removeprofane description: remove a false profane word usage_hint: falseProfaneWord should_escape: false - command: /addprofane description: add a word to list of profanities usage_hint: falseNegativeWord should_escape: false - command: /users description: view all chat users should_escape: false - command: /ban description: ban user from chat usage_hint: Username should_escape: false - command: /unban description: allow a user back in the chat usage_hint: username should_escape: false oauth_config: scopes: bot: - channels:history - chat:write - chat:write.customize - commands - incoming-webhook - users:read settings: event_subscriptions: bot_events: - message.channels interactivity: is_enabled: true org_deploy_enabled: false socket_mode_enabled: true token_rotation_enabled: false
-
Go to "OAuth & Permissions" under the Features pane on the left and click on "Install to Workspace" under "OAuth Tokens for Your Workspace". (On the next screen, click on "Allow")
-
Copy the “Bot User OAuth Token” generated. This will be the environment variable "SLACK_AUTH_TOKEN"
-
Put the respective channel IDs in the
.env
file. For how to find the Channel IDs, you can see here. -
All set! You can now start integrating the chat frontend with your web app and get people talking!