# Authentication for Slack

> Depending on the authentication type you select, you need one of
the following credentials:

## Prerequisites

Depending on the authentication type you select, you need one of
the following credentials:

* OAuth 2.0 Authorization code: User scopes,
  Bot scopes, and your Slack credentials.
* Bring your own OAuth 2.0 app:
  Client ID, Client secret, User scopes, Bot scopes.
* API Key: Access Token (for example Bot Token, User Token, etc.). For more details, see the Slack
[documentation](https://docs.slack.dev/authentication/tokens/).

For creating a private OAuth2 app, follow the steps described in the Slack
[documentation](https://api.slack.com/start/quickstart).

:::note
When registering your OAuth application in Slack, make sure to set the [callback URL](connections#callback-url) to the value displayed on the connection creation page, for example `https://cloud.uipath.com/provisioning_/callback` for Automation Cloud.
:::

To create a connection, you must be
a member or a guest of a Slack workspace.

:::note
If you
create a connection using Bring your own OAuth 2.0 app, there are some
additional steps you must take when using the [Button Clicked](https://docs.uipath.com/activities/other/latest/integration-service/uipath-salesforce-slack-button-clicked) event. Refer to [Using Button Clicked with Bring your own
OAuth 2.0 app authentication](https://docs.uipath.com/activities/other/latest/integration-service/uipath-salesforce-slack-button-clicked#using-button-clicked-with-bring-your-own-oauth-20-app-authentication) for more details.
:::

## Add the connection for Slack

To create a connection to your Slack instance, take the following
steps:

1. Select Integration Service from
   the left rail.
2. From the **Connectors** list,
   select **Slack**. You can also use the search bar to narrow down the
   connector.
3. Select the **Connect to
   Slack** button.
4. Enter the required credentials for your preferred authentication method.
   You can choose between three authentication
   types: OAuth 2.0 Authorization code, Bring your own OAuth 2.0 app, or API
   Key.
   1. If you select the Bring
      your own OAuth 2.0 app method, enter the required credentials and select
      **Connect**.

      For any secret-type field, you can select the menu next to the field and choose **Use credential asset** to reference an Orchestrator credential asset linked to an external vault instead of entering the value directly. For more information, see [Use credential assets for connections](credential-store-connections.md).
   2. If you select the API key
      method, enter the API key and select **Connect**.

      For any secret-type field, you can select the menu next to the field and choose **Use credential asset** to reference an Orchestrator credential asset linked to an external vault instead of entering the value directly. For more information, see [Use credential assets for connections](credential-store-connections.md).
   3. If you select the default
      OAuth 2.0 Authorization code method, continue to step 4.
5. Review or change the **Bot scopes** and/or the **User scopes** as per your requirements or use case. The **`chat:write`** bot scope is mandatory and cannot be removed — removing it causes connection creation to fail. All other scopes are optional.
6. Select
   **Connect**.
7. Select the correct workspace from
   the top-right corner of the screen. The connection performs actions only for
   this selected workspace and its respective channels.

    ![docs image](https://dev-assets.cms.uipath.com/assets/images/integration-service/integration-service-docs-image-443334-ab6f7eae.webp)
8. Select **Allow**. With access
   to your Slack account, UiPath can do the following:
   * View content and info
     about you.
   * View content and info
     about channels and conversations.
   * View content and info
     about your workspace.
   * Perform actions as
     you.
   * Perform actions in
     channels and conversations.
   * Perform actions in your
     workspace.
9. Your connection has been added.

## Scopes and permissions

You can use the connection to enable the [Slack activities](https://docs.uipath.com/activities/other/latest/integration-service/uipath-salesforce-slack-activities) in UiPath Studio to build automations
for user and channel management, scheduled messaging, and other ways of working
together.

### Mandatory bot scopes

The following bot scope is mandatory for all Slack connections, regardless of the authentication method. Removing it prevents connection creation from completing.

| Scope | Purpose |
| --- | --- |
| `chat:write` | Required to post the connection confirmation message to your Slack workspace after creation |

:::note
Removing `chat:write` from the bot scopes causes connection creation to fail.
:::

### All scopes

Use the following table to check the various permission-based use
cases you can achieve using Slack activities:

Table 1. Slack permissions required
for each activity

| Scope / Permission | Use case | Activity |
| --- | --- | --- |
| chat:write (Both User and Bot Token) | Send a message in a channel as a Bot or User.  Send a reply to a message in channel as a Bot or User.  When a button is clicked in a channel, send an ephemeral message or a me message to the user. | Send Message to Channel  Send Reply |
| chat:write:customize (Bot token only) | Send a message in a channel or to a user using a customized Bot name and icon. | Send Message to Channel  Send Message to User |
| chat:write:public (Bot token only) | Send notifications/announcements to public channels as a Bot even if the Bot is not a channel member. | Send Message to Channel |
| links:write (Both User and Bot Token) | Send messages with preview of links such as Jira ticket or GitHub issue etc. as a Bot or User. | Send Message to Channel  Send Message to User |
| channels:write (User token only) | Create public channels for different teams and users based on need / topic / goal as a user.  Dynamically archive or unarchive or close the temp channel/conversation as a user when the support ticket is closed or reopened. | Archive Channel  Set Channel Topic |
| channels:manage (Bot token only) | Create public channels for different teams and users based on need / topic / goal as a bot.  Dynamically archive or unarchive or close the temp channel/conversation as a user when the support ticket is closed or reopened. | Create Channel  Archive Channel  Set Channel Topic |
| channels:join (Bot token only) | Upload a media file as a Slack message in a channel as a Bot by first joining the channel. | Join Channel |
| groups:write (Both User and Bot Token) | Create private channels for different teams and users based on need / topic / goal as a Bot or User. | Create Channel |
| im:write (Both User and Bot Token) | Send individual message (IM) as a Bot or User. | Send Message to User |
| mpim:write (Both User and Bot Token) | Send a message in a MPIM group as a Bot or User.  Send a reply to a message in the MPIM group as a Bot or User.  Open a MPIM conversation by adding multiple users for sending message as a Bot or User. | Send Message to Channel  Send Reply |
| channels:read (Both User and Bot Token) | Retrieve the list of public channels of the connected workspace in order to send messages or manage users as a Bot or User.  Read the public channel information as a Bot or User for sending messages or managing users. | Send Message to Channel  Send Message to User  Send File to Channel  Send Reply  Invite Users to Channel  Remove User from Channel  List all Channels  Get Channel Info  List all Channel Members |
| groups:read (Both User and Bot Token) | Retrieve the list of private channels of the connected workspace in order to send messages or manage users as a Bot or User.  Read the private channel information as a Bot or User for sending messages or managing users. | Send Message to Channel  Send Message to User  Send File to Channel  Send Reply  Invite Users to Channel  Remove User from Channel  List all Channels  Get Channel Info  List all Channel Members |
| im:read (Both User and Bot Token) | Retrieve the list of IM conversations of the connected workspace in order to send messages as a Bot or User.  Retrieve the list of IM conversations that the user is part of. | List all Channels  Get Channel Info |
| mpim:read (Both User and Bot Token) | Retrieve the list of MPIM groups of the connected workspace in order to send messages as a Bot or User.  Retrieve the list of MPIM conversations that the user is part of. | List all Channels  Get Channel Info |
| files:read (Bot token only) | Retrieve the file info such as public URL and downloading important files such as quarterly results, from a URL via Slack message as a Bot or User. | Get File Info |
| files:write (Both User and Bot Token) | Notify all the users of a user group regarding an important update. For instance, notifying as a Bot or User, the Quarterly Sales Results to the entire Sales / Marketing team group.  Upload a media file as a Slack message in a channel as a Bot or User. | Send File to Channel |
| usergroups:read (User token only) | Retrieve the list of users in a user group so as to update or add users as a Bot or User. | List All User Groups |
| usergroups:write (User token only) | Create a user group for multiple channels as a Bot or User.  Add users to an existing user group as a Bot or User whenever a new user is added to a channel.  Dynamically enable or disable the user group for temp channel whenever the temp channel is archived/unarchived. | Create User Group  Add Users to User Group |
| users:read (Both User and Bot Token) | Retrieve the list of users of the connected workspace as a Bot or User in order to send messages. | List All Users  Invite Users to Channel  Remove User from Channel  Send Message to User |
| users:read.email (Both User and Bot Token) | Read the user information such as name, email etc. as a Bot or User for sending notifications. | Get User by Email |
| reactions:read (Bot token only) | Listen for reaction events on messages in channels the app has access to. Required when using the Reaction Added trigger with Bring your own OAuth 2.0 app authentication. | Reaction Added |
