Before you can run the Slack GPT Bot, you need to configure the appropriate permissions for your Slack bot. Follow these steps to set up the necessary permissions:
- Create Slack App
- Go to your Slack API Dashboard and click on the app you created for this bot.
- In the left sidebar, click on "OAuth & Permissions".
- In the "Scopes" section, you will find two types of scopes: "Bot Token Scopes" and "User Token Scopes". Add the following scopes under "Bot Token Scopes":
app_mentions:read: Allows the bot to read mention events.chat:write: Allows the bot to send messages.channels:history: Allows the bot to view messages and other content in public channels.groups:history: Allows the bot to view messages and other content in private channels.mpim:history: Allows the bot to view messages and other content in multiparty direct messages.im:history: Allows the bot to view messages and other content in direct messages.
- Scroll up to the "OAuth Tokens for Your Workspace" and click "Install App To Workspace" button. This will generate the
SLACK_BOT_TOKEN. - In the left sidebar, click on "Socket Mode" and enable it. You'll be prompted to "Generate an app-level token to enable Socket Mode". Generate a token named
SLACK_APP_TOKENand add theconnections:writescope. - In the "Features affected" section of "Socket Mode" page, click "Event Subscriptions" and toggle "Enable Events" to "On". Add
app_mentionevent with theapp_mentions:readscope in the "Subscribe to bot events" section below the toggle.