Slack Setup

Slack bot and obtain an API token

To generate a Slack bot and obtain an API token, follow these steps:

  1. Go to the Slack API website: https://api.slack.com/apps

  2. Click on the "Create New App" button to create a new Slack app.

  3. Provide a name for your app and select the Slack workspace where you want to install the app. Click on the "Create App" button.

  4. Once your app is created, you'll be redirected to the app's settings page. In the left sidebar, under "Features," click on "Bot".

  5. Click on the "Add a Bot User" button to create a bot for your app.

  6. Configure the bot user settings as per your requirements, including the display name and default username. You can also customize the other optional settings. Click on the "Add Bot User" button to save the settings.

  7. In the left sidebar, under "Settings," click on "OAuth & Permissions".

  8. Scroll down to the "Scopes" section and locate the "Bot Token Scopes" section. Here, you can specify the permissions and access levels your bot will have. Select the required scopes based on the functionality you need for your bot.

  9. Add the following permissions: i. chat:write ii. channels:read iii. groups:read iv. mpim:read v. im:read

  10. After selecting the necessary scopes, scroll back up to the top of the page and click on the "Install App" menu under the "Settings" menu in the left sidebar.

  11. Review the permissions requested by your app and click on the "Allow" button to install the app in your workspace.

  12. Once installed, you will be redirected back to the app's settings page. Scroll down to the "OAuth Tokens & Redirect URLs" section. You will find your bot's API token under the "Bot User OAuth Token" field. This token is used to authenticate requests made on behalf of your bot.

Make sure to keep your API token secure, as it grants access to your bot and associated permissions.

That's it! You now have a Slack bot and its corresponding API token. You can use this token to authenticate your bot's HTTP requests and interact with the Slack API.

Slack Channel Id

To obtain the Slack Channel ID, you can follow these steps:

  1. Open Slack and navigate to the workspace where the channel is located.

  2. Right-click on the channel name in the left sidebar.

  3. From the context menu that appears, select "Copy Link" or "Copy Link Address" (the exact option may vary depending on your operating system and browser).

  4. Paste the copied link into a text editor or any other suitable location.

  5. Look for a section in the link that resembles C12345678. The alphanumeric code starting with the "C" is the Channel ID.

Alternatively, you can also retrieve the Channel ID programmatically using the Slack API. Here's an example using cURL:

curl -X GET -H 'Authorization: Bearer YOUR_API_TOKEN' https://slack.com/api/conversations.list

Replace YOUR_API_TOKEN with your actual API token. This request will retrieve a list of channels and conversations in your workspace, along with their corresponding IDs. Look for the specific channel you're interested in and note down its ID.

Remember that your API token needs the necessary permissions (e.g., channels:read) to access this information.

By following either of these methods, you can obtain the Channel ID of a Slack channel.

Last updated