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:join | Allow the bot to join public channels automatically so it can post messages to them. |
chat:write | Send messages as the bot to channels the bot has been added to. |
chat:write.public | Send messages to public channels without first joining them. |
groups:history | Access message history in private channels and groups the bot has been added to. |
groups:read | List private channels and groups the bot has been added to. |
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.