> ## Documentation Index
> Fetch the complete documentation index at: https://docs.refold.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Setup

> Connect your Slack app for OAuth.

### Pre-requisites

1. Slack Developer Account.
2. Required Settings for the App. You can find it in [Overview](https://docs.gocobalt.io/resources/integration-providers/slack_overview#required-settings).

### Creating an app in Slack

To create a Slack app and acquire the app credentials, please follow the steps mentioned below:

1. Log in to your [Slack App Dashboard](https://api.slack.com/apps).
2. Click on the `Create New App` button in the upper right side and select `From scratch` option.

<img height="200" src="https://mintcdn.com/cobalt-55/z_Cm6DgpvP5zfZT8/images/Slack/Slack_navigation.png?fit=max&auto=format&n=z_Cm6DgpvP5zfZT8&q=85&s=fb26e3d5e17e3841a128b2574ff0a19b" alt="Navigation for App setup" data-path="images/Slack/Slack_navigation.png" />

3. Enter the **App name** and **select a workspace** from the dropdown to develop your app in and click on the `Create App` button.
4. Copy the Callback URL as provided in your Slack settings page in Refold. Go to your [`Apps catalog`](https://app.gocobalt.io/apps) > Search for `Slack` > `Settings` > `Use your credentials` > `Callback Url`.
5. Navigate to `Features` > `OAuth & Permissions` and **scroll down** to `Redirect URLs` section in the Settings of the App. Click on `Add New Redirect URL` > Paste the Callback URL > Click on `Add` > Click on the `Save URLs` button.
6. Scroll down in the same page to `Scopes` section, select the **mandatory scopes** as provided in your Refold Slack settings page by clicking on `Add an OAuth Scope` button and selecting the scope required.

<img height="200" src="https://mintcdn.com/cobalt-55/6ZvwOHqAhmVnIyqF/images/Slack/Slack_config.png?fit=max&auto=format&n=6ZvwOHqAhmVnIyqF&q=85&s=4e33dfae1c6cecbd1ab4c4678ee96852" alt="Setting up Slack Developer app" data-path="images/Slack/Slack_config.png" />

7. Click on the `Basic Information` under **Settings** in the left menu , scroll down to `App Credentials` section  and copy the **Client ID** and **Client Secret**.

<img height="200" src="https://mintcdn.com/cobalt-55/z_Cm6DgpvP5zfZT8/images/Slack/Slack_credentials.png?fit=max&auto=format&n=z_Cm6DgpvP5zfZT8&q=85&s=6c6edf109b98dd0c91b3e8830adea968" alt="Getting Credentials" data-path="images/Slack/Slack_credentials.png" />

#### Configuring credentials in Refold

App settings page lets you configure the authentication settings for an `OAuth2` based application. For your customers to provide you authorization to access their data,
they would first need to install your application. This page lets you set up your application credentials.

<img height="200" src="https://mintcdn.com/cobalt-55/6ZvwOHqAhmVnIyqF/images/Slack/Slack_cobalt.png?fit=max&auto=format&n=6ZvwOHqAhmVnIyqF&q=85&s=f13f8fc54761b2d3c67a95d773f2d230" alt="Setting up application client credentials" data-path="images/Slack/Slack_cobalt.png" />

Provide the acquired Client ID and Client Secret under Settings of the app and save it.

#### Configuring Scopes

Refold lets you configure what permissions to ask from your users while they install your application. The scopes can be added or removed from the App settings page, under `Permissions & Scopes`
section.

For some applications Refold sets mandatory scopes which cannot be removed. Additional scopes can be selected from the drop down. Refold also has the provision to add any
custom scopes supported by the respective platform.

<img height="200" src="https://mintcdn.com/cobalt-55/z_Cm6DgpvP5zfZT8/images/Slack/Slack_scopes.png?fit=max&auto=format&n=z_Cm6DgpvP5zfZT8&q=85&s=6293c6d686fdd48ccecfbe57b7e18b85" alt="OAuth Scopes" data-path="images/Slack/Slack_scopes.png" />

Once the scopes has been added to the application in Refold, go to your [Slack App Dashboard](https://api.slack.com/apps) and update the scopes as added on Refold.

Navigate to  `Your Apps` > Select the OAuth App created for Refold > Click on `OAuth & Permissions` under **Features** in the left menu  > Scroll down to the `Scopes` section > Add the scopes as added in Refold by clicking `Add an OAuth Scope` and select the scope.

<Warning>
  If you are facing scopes missing or invalid scope error. Make sure you are not passing any custom scope not supported by the platform. And, the scopes selected here are
  identical to the ones selected in the platform.
</Warning>

#### Slack single webhook URL

If you wish to create an orchestration where a workflow is being triggered when some operation occurs in Slack, you'd need to subscribe to Slack's Webhook. Refold provides
a single webhook URL to manage such event triggers for all your customers.

**To setup Slack webhook subscription:**

1. Select Slack from the application list in **Refold**, and select `Settings`.

2. Copy the `Single Webhook Url`

3. In your [Slack App Dashboard](https://api.slack.com/apps), select the OAuth App created for Refold > Select `Event Subscriptions` under **Features** > Turn the toggle `On` for **Enable Events**.

4. Paste the Webhook URL under `Request URL`. Refold will automatically respond to Slack's challenge request and begin listening to events on behalf of your app.

5. Click on `Save Changes` at the bottom of the Slack App dashboard.

<img height="200" src="https://mintcdn.com/cobalt-55/z_Cm6DgpvP5zfZT8/images/Slack/Slack_webhook.png?fit=max&auto=format&n=z_Cm6DgpvP5zfZT8&q=85&s=1fd86e663000eb2c749b82c01dc1cacd" alt="Setting up Slack Events URL" data-path="images/Slack/Slack_webhook.png" />
