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

# Slack Bots

> Deploy your Bothive agent to Slack — for internal tools, team assistants, and customer-facing bots.

<div className="hero-container">
  <h1 className="hero-title">
    Deploy to Slack
  </h1>

  <p className="hero-subtitle">
    Your Bothive agent inside Slack — responding in DMs, channels, and threads.
  </p>
</div>

## When to use the Slack channel

<CardGroup cols={2}>
  <Card title="Internal team tools" icon="users" className="glass-effect">
    Engineering stand-up bots, HR policy assistants, incident commanders, ops automation — all living where your team already works.
  </Card>

  <Card title="Customer-facing support" icon="headset" className="glass-effect">
    If your customers use Slack Connect or a shared Slack workspace, your support agent can live right there.
  </Card>
</CardGroup>

## Setup

<Steps>
  <Step title="Create a Slack App">
    Go to [api.slack.com/apps](https://api.slack.com/apps) → **Create New App** → **From scratch**.

    Give it a name and pick your workspace.
  </Step>

  <Step title="Enable OAuth scopes">
    Under **OAuth & Permissions → Bot Token Scopes**, add:

    | Scope               | Required for            |
    | ------------------- | ----------------------- |
    | `chat:write`        | Sending messages        |
    | `channels:read`     | Reading channel list    |
    | `im:read`           | Reading DMs             |
    | `im:write`          | Sending DMs             |
    | `app_mentions:read` | Responding to @mentions |
    | `channels:history`  | Reading message history |
  </Step>

  <Step title="Install the app to your workspace">
    Under **OAuth & Permissions** → click **Install to Workspace** → authorize.

    Copy the **Bot User OAuth Token** (starts with `xoxb-`).
  </Step>

  <Step title="Connect to Bothive">
    In your bot dashboard → **Channels** → **Slack** → paste the Bot User OAuth Token → **Save**.

    Bothive sets up the event subscriptions automatically.
  </Step>

  <Step title="Invite the bot to channels">
    In Slack, type `/invite @YourBotName` in any channel where you want it to respond.
  </Step>
</Steps>

## HiveLang v5 Slack bot example

```hivelang theme={null}
bot SlackOpsBot {
  description: "Internal Slack operations assistant"

  capabilities {
    github.createIssue
    github.getPRStatus
    jira.createTicket
    slack.postMessage
  }

  instructions {
    You are an internal operations assistant for the engineering team.

    When a user reports an incident:
    1. Acknowledge it immediately
    2. Create a GitHub issue with priority label
    3. Post a status update to #incidents channel
    4. Ask if they want to escalate to Jira

    Format all responses using Slack mrkdwn:
    - *bold* for important details
    - `code` for IDs and commands
    - Use :white_check_mark: for success, :x: for errors

    Keep responses concise. Engineers are busy.
  }

  on "incident *" {
    issue = call github.createIssue with {
      title: "Incident: {$match[0]}",
      labels: ["incident", "high-priority"]
    }
    call slack.postMessage with {
      channel: "#incidents",
      text: ":rotating_light: *New Incident* — {$match[0]}\nTracking issue: {issue.url}"
    }
    say ":white_check_mark: Incident logged. Issue: `{issue.number}`. Posted to #incidents."
  }
}
```

## Slack vs Telegram — when to choose

| Factor                | Slack                          | Telegram                    |
| --------------------- | ------------------------------ | --------------------------- |
| Best for              | Internal teams, B2B            | Communities, consumers, B2C |
| Setup complexity      | Medium (OAuth flow)            | Simple (BotFather token)    |
| Rich interactions     | Blocks, modals, slash commands | Inline keyboards, commands  |
| User base             | Business/enterprise            | Consumer + developer        |
| DM support            |                                |                             |
| Group/channel support |                                |                             |
| Free bots             | Up to workspace limits         | Unlimited                   |

## Slash commands

Register slash commands in your Slack App settings → **Slash Commands** → **Create New Command**:

| Command     | Description            | Example                          |
| ----------- | ---------------------- | -------------------------------- |
| `/ask`      | Ask the agent anything | `/ask What's the deploy status?` |
| `/incident` | Log an incident        | `/incident API latency spike`    |
| `/status`   | Get system status      | `/status`                        |

Bothive handles slash command routing automatically — no extra code needed.

## Common issues

<AccordionGroup>
  <Accordion title="Bot doesn't respond to messages">
    Make sure you've invited the bot to the channel (`/invite @BotName`). The bot only sees messages in channels it's a member of.
  </Accordion>

  <Accordion title="Bot responds to every message in a channel">
    By default, the bot only responds when @mentioned in channels. To change this, update the `app_mentions:read` scope and your instructions.
  </Accordion>

  <Accordion title="Rate limit errors">
    Slack has a 1 message/second limit per channel. If your bot sends rapid-fire messages, add a small delay between calls or batch responses.
  </Accordion>
</AccordionGroup>

## Next reads

<CardGroup cols={3}>
  <Card title="Telegram Bots" icon="telegram" href="./telegram-bots" className="glass-effect" />

  <Card title="Deploy to Channels" icon="rocket" href="./deploy-to-channels" className="glass-effect" />

  <Card title="Integration Capabilities" icon="plug" href="./integration-capabilities" className="glass-effect" />
</CardGroup>
