> ## Documentation Index
> Fetch the complete documentation index at: https://developer.watson-orchestrate.ibm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Slack

Deploy your agent to Slack workspaces using your own Slack app.

### Prerequisites

* A Slack workspace with admin access

* A [Slack app](https://api.slack.com/apps) that is created in your workspace

* Slack API credentials:
  * Client ID
  * Client Secret
  * Signing Secret
  * Bot User OAuth Token for each team or workspace
  * Slack Team ID (starts with the letter 'T')

    * Locate your team ID in the URL of the `Workflow Steps` tab in your Slack app settings

    ![Slack Team ID](https://mintcdn.com/ibm-2e3153bf/DhB0a-ThtdAQzfOZ/assets/channels/slack_team_id.png?fit=max\&auto=format\&n=DhB0a-ThtdAQzfOZ\&q=85\&s=198f099e98e4bbceb9878dc7698ef099)

* Slack Bot Token Scopes:
  * app\_mentions:read
  * chat:write
  * im:history
  * im:write
  * users.profile:read

* Subscribed to following Bot Events:
  * message.im
  * app\_mention

### Create a Slack channel

**Using YAML:**

```yaml YAML theme={null}
name: "Slack Support Bot"
description: "Support agent in Slack"
channel: "byo_slack"
spec_version: "v1"
kind: "channel"
client_id: "1234567890.1234567890"
client_secret: "your_client_secret_here"
signing_secret: "your_signing_secret_here"
teams:
  - id: "T01234567"
    bot_access_token: "xoxb-your-bot-token-here"

# Optional: SSO configuration
sso_enabled: true
sso_url: "https://sso.example.com/saml"
sso_user_prompt_text: "Sign in with your company credentials"
sso_user_prompt_label: "Company SSO"
sso_cert: |-
  -----BEGIN CERTIFICATE-----
  your-certificate-content
  -----END CERTIFICATE-----

# Optional: Show thumbs up/down feedback buttons on every agent response (default: false)
enable_feedback: false

# Optional: Always reply in a thread when in a Slack channel, no effect in DMs (default: false)
respond_in_thread: false

# Optional: Use v2 chat completions for this channel (default: false)
use_v2_chat_completions: false
```

**Using Python:**

```python Python theme={null}
from ibm_watsonx_orchestrate.agent_builder.channels import SlackChannel, SlackTeam

slack = SlackChannel(
    name="Slack Support Bot",
    description="Support agent in Slack",
    client_id="1234567890.1234567890",
    client_secret="your_client_secret_here",
    signing_secret="your_signing_secret_here",
    teams=[
        SlackTeam(
            id="T01234567",
            bot_access_token="xoxb-your-bot-token-here"
        )
    ],
    sso_enabled=True,
    sso_url="https://sso.example.com/saml",
    sso_user_prompt_text="Sign in with your company credentials",
    sso_user_prompt_label="Company SSO",
    sso_cert="""-----BEGIN CERTIFICATE-----
your-certificate-content
-----END CERTIFICATE-----""",
    enable_feedback=False,          # Optional: show thumbs up/down on every agent response
    respond_in_thread=False,        # Optional: always reply in thread (Slack channels only, no effect in DMs)
    use_v2_chat_completions=False,  # Optional: use v2 chat completions
)
```

### Configuration requirements

| Field | Required | Format | Description |
| - | - | - | - |
| `client_id` | Yes | String | Slack API client ID |
| `client_secret` | Yes | String | Slack API client secret |
| `signing_secret` | Yes | String | Slack API signing secret |
| `teams` | Yes | Array of SlackTeam objects | Slack teams or workspaces |
| `teams[].id` | Yes | String | Slack team or workspace ID |
| `teams[].bot_access_token` | Yes | String | Bot user OAuth token |
| `sso_enabled` | No | Boolean | Enables SSO for the channel. |
| `sso_url` | No | String | SSO provider URL. |
| `sso_user_prompt_text` | No | String | Text shown to users in the SSO prompt. |
| `sso_user_prompt_label` | No | String | Label shown on the SSO link button. |
| `sso_cert` | No | String | SSO provider certificate in PEM format. |
| `enable_feedback` | No | Boolean | Show thumbs up/down feedback buttons on every agent response. Defaults to `false`. |
| `respond_in_thread` | No | Boolean | Always reply in a thread when in a Slack channel. Has no effect in direct messages. Defaults to `false`. |
| `use_v2_chat_completions` | No | Boolean | Use v2 chat completions for this channel. Defaults to `false`. |
