Slack uses OAuth 2.0 for authentication. You will need to create a Slack app and configure a bearer token for the app.
Go to Slack API and create a new app. Click on "Create New App" and navigate to From scratch -> Give the app a name and select your workspace from the dropdown -> click on "Create App".
On the left panel navigate to OAuth & Permissions -> Add the following scopes in Scopes -> Bot Token Scopes -> Add an OAuth Scope -> Add the following scopes:
| Scope | Purpose |
|---|---|
channels:history | Access messages sent in channels the bot has been added to. |
channels:join | Allow the bot to join channels automatically. Required if Auto-Join Channels is enabled. |
channels:read | Enables listing channels in the workspace. |
groups:history | Access messages sent in private channels and groups the bot has been added to. |
im:history | Access messages sent in private DMs the bot has been added to. |
im:read | Access messages sent in private DMs the bot has been added to. |
mpim:history | Access messages sent in private group DMs the bot has been added to. |
mpim:read | Access messages sent in private group DMs the bot has been added to. |
users:read | List users in the workspace. |
users:read.email | Access user email addresses for users in the workspace. |
To ensure that you do not lose access to the app you created in step 1, consider using Settings -> Collaborators to add additional workspace members as collaborators to the app. Collaborators will have full permissions to manage the app in the event the account first used to create it is terminated for any reason (e.g. an employee leaves).
On the left panel navigate to Install App -> Click on Install App to Workspace -> Click on Allow.
A Bot User OAuth Access Token will be generated. This is your bearer token. Please copy and save it.
Secret: The OAuth Token created in step 4.
Auto-Join Channels: If you enable this setting, the bot will automatically join channels when the chat connector is used to access channel messages. The bot will only be able to auto-join public channels. If this setting is disabled, the bot must manually be added to public channels to access their message history. The bot must always be manually added to DMs, group DMs, and private channels.