Skip to content

Slack Bot Setup

Manan Garg edited this page Jan 14, 2024 · 3 revisions
  1. Go to https://api.slack.com/apps and click on "Create New App" on the top right corner and choose "From scratch"

Screenshot from 2023-12-31 14-22-21

Screenshot from 2023-12-31 14-22-33

  1. Fill in the information and click "Create App"

Screenshot from 2023-12-31 14-23-14

  1. Go to "Socket Mode" under Settings pane on the left and enable Socket Mode. Allow only the "connections:write" scope and click on "Generate".

Screenshot from 2023-12-31 14-25-19

  1. Copy the generated token. This will be the environment variable "SLACK_APP_TOKEN"
  2. 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
  1. 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") Screenshot from 2023-12-31 19-14-30

  2. Copy the “Bot User OAuth Token” generated. This will be the environment variable "SLACK_AUTH_TOKEN"

  3. Put the respective channel IDs in the .env file. For how to find the Channel IDs, you can see here.

  4. All set! You can now start integrating the chat frontend with your web app and get people talking!

Clone this wiki locally