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

# Get Credentials

> Step-by-step instructions for obtaining Slack API keys, OAuth credentials, and webhook secrets.

This guide walks you through obtaining all required credentials for the Slack plugin.

## Authentication Methods

The Slack plugin supports two authentication methods:

* **[`api_key`](/concepts/api-key)** (default) - Bot token authentication
* **[`oauth_2`](/concepts/oauth)** - OAuth 2.0 user authentication

## API Key Authentication (Bot Token)

### Step 1: Create a Slack App

1. Go to [api.slack.com/apps](https://api.slack.com/apps)
2. Click **Create New App**
3. Choose **From scratch**
4. Enter your app name and select your workspace
5. Click **Create App**

### Step 2: Configure Bot Token Scopes

1. In your app settings, go to **OAuth & Permissions** in the left sidebar
2. Scroll to **Scopes** → **Bot Token Scopes**
3. Add the required scopes:
   * `channels:read` - View basic information about public channels
   * `channels:write` - Manage public channels
   * `chat:write` - Send messages
   * `files:read` - View files shared in channels
   * `files:write` - Upload, edit, and delete files
   * `users:read` - View people in a workspace
   * `reactions:write` - Add and remove emoji reactions
   * Add any other scopes your application needs

### Step 3: Install App to Workspace

1. Scroll to the top of the **OAuth & Permissions** page
2. Click **Install to Workspace**
3. Review the permissions and click **Allow**

### Step 4: Copy Bot Token

1. After installation, you'll be redirected back to **OAuth & Permissions**
2. Under **OAuth Tokens for Your Workspace**, find **Bot User OAuth Token**
3. Click **Copy** to copy the token (starts with `xoxb-`)
4. Store this token securely

**Storing Credentials:**

Store the bot token with the Corsair CLI:

```bash theme={null}
pnpm corsair setup --plugin=slack bot_token=xoxb-your-bot-token
```

Verify it was saved:

```bash theme={null}
pnpm corsair auth --plugin=slack --credentials
```

## OAuth 2.0 Authentication

### Step 1: Create a Slack App

1. Go to [api.slack.com/apps](https://api.slack.com/apps)
2. Click **Create New App**
3. Choose **From scratch**
4. Enter your app name and select your workspace
5. Click **Create App**

### Step 2: Configure OAuth Settings

1. Go to **OAuth & Permissions** in the left sidebar
2. Under **Redirect URLs**, click **Add New Redirect URL**
3. Add your OAuth redirect URL (e.g., `https://yourapp.com/auth/slack/callback`)
4. Click **Save URLs**

### Step 3: Get Client Credentials

1. Scroll to **App Credentials** section
2. Copy the **Client ID** and **Client Secret**
3. Store these securely

**Storing Credentials:**

Store your OAuth app credentials, then start the flow:

```bash theme={null}
pnpm corsair setup --plugin=slack client_id=your-client-id client_secret=your-client-secret
pnpm corsair auth --plugin=slack
```

The CLI will print an authorization URL — open it in a browser. Once you approve, tokens are saved automatically.

## Webhook Signing Secret

### Step 1: Enable Event Subscriptions

1. In your Slack app settings, go to **Event Subscriptions** in the left sidebar
2. Toggle **Enable Events** to **On**
3. Enter your **Request URL** (e.g., `https://yourapp.com/api/webhook`)
4. Slack will send a verification request - ensure your endpoint handles it

### Step 2: Subscribe to Bot Events

1. Scroll to **Subscribe to bot events**
2. Click **Add Bot User Event**
3. Add events you want to receive:
   * `message.channels` - Messages posted to channels
   * `channel_created` - A channel was created
   * `reaction_added` - A reaction was added
   * `team_join` - A new member joined
   * `user_change` - A user's profile was updated
   * `file_created` - A file was created
   * `file_public` - A file was made public
   * `file_shared` - A file was shared

### Step 3: Get Signing Secret

1. Scroll to the top of the **Event Subscriptions** page
2. Under **Signing Secret**, click **Show** and copy the secret
3. Store this securely

**Storing Credentials:**

Store the signing secret with the CLI:

```bash theme={null}
pnpm corsair setup --plugin=slack webhook_signature=your-signing-secret
```

## Required Credentials Summary

| Credential             | Required For | Where to Find                              |
| ---------------------- | ------------ | ------------------------------------------ |
| Bot Token (`xoxb-...`) | API Key auth | OAuth & Permissions → Bot User OAuth Token |
| Client ID              | OAuth 2.0    | OAuth & Permissions → App Credentials      |
| Client Secret          | OAuth 2.0    | OAuth & Permissions → App Credentials      |
| Signing Secret         | Webhooks     | Event Subscriptions → Signing Secret       |

For general information about how Corsair handles authentication, see [Authentication](/concepts/auth).
