# Slack

Slack uses the OAuth authentication standard. To authenticate using OAuth, you will need to create an app to obtain the OAuthClientId, OAuthClientSecret, and CallbackURL connection properties.

Create an app to obtain the OAuth client credentials, the OAuthClientId and OAuthClientSecret. To create your app, go to <https://api.slack.com/apps>. Specify an app name and the app's workspace. You can see the Client Id and Client Secret listed in the App Credentials section under Basic information.

#### Set a Callback URL <a href="#set-a-callback-url" id="set-a-callback-url"></a>

After creating your application, define your app's CallbackURL:

1. In your app settings, go to OAuth & Permissions
2. In the Redirect URLs section click Add a New Redirect URL.
3. Set the callback URL to <http://127.0.0.1:33333>, or another port of your choice. Ensure that you save the URL.

#### Configure Permission Scopes <a href="#configure-permission-scopes" id="configure-permission-scopes"></a>

Follow the instructions below to configure the API permissions your app requests. In order to use all possible features, the necessary scopes are: channels:read, groups:read, im:read, mpim:read, channels:write, groups:write, im:write, mpim:write, channels:history, groups:history, im:history, mpim:history, search:read, chat:write:user, chat:write:bot, files:read, files:write:user, pins:read, pins:write, usergroups:read, usergroups:write, reminders:read, reminders:write, users:read, users.profile:write.

1. In your app settings, go to the Scopes section, under OAuth & Permissions.
2. In the Select Permission Scopes subsection, click the menu to add permissions by scope or API method.

#### Distribute Your App <a href="#distribute-your-app" id="distribute-your-app"></a>

To allow users in other workspaces to install your app, follow the instructions below:

1. In your app settings, click Manage Distribution under the Settings section.
2. Complete the procedures to set a callback URL and configure permissions.
3. Click Activate Public Distribution.

Set the following connection properties to connect:

* InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the access token in the connection string.
* OAuthClientId: Set this to the Client Id in your app settings.
* OAuthClientSecret: Set this to the Client Secret in your app settings.
* CallbackURL: Set this to the Redirect URL in your app settings.

When you connect the provider opens the OAuth endpoint in your default browser. Log in and grant permissions to the application. The provider then completes the OAuth process:

1. Extracts the access token from the callback URL and authenticates requests.
2. Refreshes the access token when it expires.
3. Saves OAuth values in OAuthSettingsLocation to be persisted across connections.


---

# Agent Instructions: 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:

```
GET https://docs.appstrategy.com/apprules-r-documentation/platform/platform-features/system-settings/data-sources/connection-settings/collaboration/slack.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
