> For the complete documentation index, see [llms.txt](https://docs.n8n.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.n8n.io/integrations/builtin/credentials/slack.md).

# Slack credentials

You can use these credentials to authenticate the following nodes:

* [Slack](/integrations/builtin/app-nodes/n8n-nodes-base.slack.md)
* [Slack Trigger](/integrations/builtin/trigger-nodes/n8n-nodes-base.slacktrigger.md)

## Supported authentication methods <a href="#supported-authentication-methods" id="supported-authentication-methods"></a>

* API access token:
  * Required for the [Slack Trigger](/integrations/builtin/trigger-nodes/n8n-nodes-base.slacktrigger.md) node.
  * Works with the [Slack](/integrations/builtin/app-nodes/n8n-nodes-base.slack.md) node, but not recommended.
* OAuth2:
  * Recommended method for the [Slack](/integrations/builtin/app-nodes/n8n-nodes-base.slack.md) node.
  * Doesn't work with the [Slack Trigger](/integrations/builtin/trigger-nodes/n8n-nodes-base.slacktrigger.md) node.

## Related resources <a href="#related-resources" id="related-resources"></a>

Refer to [Slack's API documentation](https://api.slack.com/apis) for more information about the service.

## Using API access token <a href="#using-api-access-token" id="using-api-access-token"></a>

To configure this credential, you'll need a [Slack](https://slack.com/) account and:

* An **Access Token**

To generate an access token, create a Slack app:

1. Open your [Slack API Apps](https://api.slack.com/apps) page.
2. Select **Create New App > From scratch**.
3. Enter an **App Name**.
4. Select the **Workspace** where you'll be developing your app.
5. Select **Create App**. The app details open.
6. In the left menu under **Features**, select **OAuth & Permissions**.
7. In the **Scopes** section, select appropriate scopes for your app. Refer to [Scopes](#scopes) for a list of recommended scopes.
8. After you've added scopes, go up to the **OAuth Tokens** section and select **Install to Workspace**. You must be a Slack workspace admin to complete this action.
9. Select **Allow**.
10. Copy the **Bot User OAuth Token** and enter it as the **Access Token** in your n8n credential.
11. If you're using this credential for the [Slack Trigger](/integrations/builtin/trigger-nodes/n8n-nodes-base.slacktrigger.md), follow the steps in [Slack Trigger configuration](#slack-trigger-configuration) to finish setting up your app.

Refer to the Slack API [Quickstart](https://api.slack.com/quickstart) for more information.

### Slack Trigger configuration <a href="#slack-trigger-configuration" id="slack-trigger-configuration"></a>

To use your Slack app with the [Slack Trigger](/integrations/builtin/trigger-nodes/n8n-nodes-base.slacktrigger.md) node:

1. Go to [Your Apps](https://api.slack.com/apps/) in Slack and select the app you want to use.
2. Go to **Features** > **Event Subscriptions**.
3. Turn on the **Enable Events** control.
4. In n8n, copy the **Webhook URL** and enter it as the **Request URL** in your Slack app.<br>

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p><strong>Request URL</strong></p><p>Slack only allows one request URL per app. If you want to test your workflow, you'll need to do one of the following:</p><ul><li>Test with your <strong>Test URL</strong> first, then change your Slack app to use the <strong>Production URL</strong> once you've verified everything's working</li><li>Use the <strong>Production URL</strong> with execution logging.</li></ul></div>
5. Once verified, select the bot events to subscribe to. Use the **Trigger on** field in n8n to filter these requests.
   * To use an event not in the list, add it as a bot event and select **Any Event** in the n8n node.

Refer to [Quickstart | Configuring the app for event listening](https://api.slack.com/quickstart#listening) for more information.

n8n recommends enabling request signature verification for your Slack Trigger for additional security:

1. Go to [Your Apps](https://api.slack.com/apps/) in Slack and select the app you want to use.
2. Go to **Settings** > **Basic Information**.
3. Copy the value of **Signing**.
4. In n8n, Paste this value into the **Signature Secret** field for the credential.

## Using OAuth2 <a href="#using-oauth2" id="using-oauth2"></a>

{% hint style="info" %}
**Note for n8n Cloud users**

Cloud users don't need to provide connection details. Select **Connect my account** to connect through your browser.
{% endhint %}

If you're [self-hosting n8n](/deploy/host-n8n.md) and need to configure OAuth2 from scratch, you'll need a [Slack](https://slack.com/) account and:

* A **Client ID**
* A **Client Secret**

To get both, create a Slack app:

1. Open your [Slack API Apps](https://api.slack.com/apps) page.
2. Select **Create New App > From scratch**.
3. Enter an **App Name**.
4. Select the **Workspace** where you'll be developing your app.
5. Select **Create App**. The app details open.
6. In **Settings > Basic Information**, open the **App Credentials** section.
7. Copy the **Client ID** and **Client Secret**. Paste these into the corresponding fields in n8n.
8. In the left menu under **Features**, select **OAuth & Permissions**.
9. In the **Redirect URLs** section, select **Add New Redirect URL**.
10. Copy the **OAuth Callback URL** from n8n and enter it as the new Redirect URL in Slack.
11. Select **Add**.
12. Select **Save URLs**.
13. In the **Scopes** section, select appropriate scopes for your app. Refer to [Scopes](#scopes) for a list of scopes.
14. After you've added scopes, go up to the **OAuth Tokens** section and select **Install to Workspace**. You must be a Slack workspace admin to complete this action.
15. Select **Allow**.
16. At this point, you should be able to select the OAuth button in your n8n credential to connect.

Refer to the Slack API [Quickstart](https://api.slack.com/quickstart) for more information. Refer to the Slack [Installing with OAuth](https://api.slack.com/authentication/oauth-v2) documentation for more details on the OAuth flow itself.

## Scopes <a href="#scopes" id="scopes"></a>

Scopes determine what permissions an app has.

* If you want your app to act on behalf of users who authorize the app, add the required scopes under the **User Token Scopes** section.
* If you're building a bot, add the required scopes under the **Bot Token Scopes** section.

Here's the list of scopes the OAuth credential requires, which are a good starting point:

| **Scope name**        | **Notes**                          |
| --------------------- | ---------------------------------- |
| `channels:read`       |                                    |
| `channels:write`      | Not available as a bot token scope |
| `channels:history`    |                                    |
| `chat:write`          |                                    |
| `files:read`          |                                    |
| `files:write`         |                                    |
| `groups:read`         |                                    |
| `groups:history`      |                                    |
| `im:read`             |                                    |
| `im:history`          |                                    |
| `mpim:read`           |                                    |
| `mpim:history`        |                                    |
| `reactions:read`      |                                    |
| `reactions:write`     |                                    |
| `stars:read`          | Not available as a bot token scope |
| `stars:write`         | Not available as a bot token scope |
| `usergroups:read`     |                                    |
| `usergroups:write`    |                                    |
| `users.profile:read`  |                                    |
| `users.profile:write` | Not available as a bot token scope |
| `users:read`          |                                    |
| `search:read`         |                                    |

## Common issues <a href="#common-issues" id="common-issues"></a>

### Token expired <a href="#token-expired" id="token-expired"></a>

Slack offers **token rotation** that you can turn on for bot and user tokens. This makes every tokens expire after 12 hours. While this may be useful for testing, n8n credentials using tokens with this enabled will fail after expiry. If you want to use your Slack credentials in production, this feature must be **off**.

To check if your Slack app has token rotation turned on, refer to the [Slack API Documentation | Token Rotation](https://api.slack.com/authentication/rotation).

{% hint style="info" %}
**If your app uses token rotation**

Please note, if your Slack app uses token rotation, you can't turn it off again. You need to create a new Slack app with token rotation disabled instead.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.n8n.io/integrations/builtin/credentials/slack.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
