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

# Slack

> Send notifications and interactive messages to Slack channels and DMs from your Archie app.

The Slack integration lets your Archie app post messages, alerts, and interactive Block Kit cards into your team's Slack workspace. Once connected, you call Slack through namespaced GraphQL operations.

<Note>
  A typed TypeScript SDK for integrations is coming with the next archie-app release. This page documents the GraphQL operation surface available today.
</Note>

## Enable the integration

Open **Integrations** in the left sidebar and pick Slack.

You'll need a [Slack App](https://api.slack.com/apps) with the right scopes installed in your workspace. From the app's settings:

* **Bot Token** — `xoxb-...`. Found under **OAuth & Permissions**. Needs `chat:write` for posting; add `chat:write.public` if you want to post to channels the bot isn't a member of.
* **App Token** — `xapp-...`. Found under **Basic Information → App-Level Tokens**. Needed if you use Socket Mode or subscribe to events.
* **Signing Secret** — under **Basic Information → App Credentials**. Used to verify requests Slack sends to your app.
* **Environment** — pick which environment this configuration applies to (e.g. `Production`, `Staging`).

Tokens are encrypted at rest and only decrypted at request time.

## What you can do

* **Send messages** — to channels, threads, or DMs
* **Send rich messages** — Block Kit blocks, attachments, buttons
* **Schedule messages** — deliver later at a chosen time
* **Update and delete** — edit or remove a previously-sent message
* **Receive events** — slash commands, button clicks, and interactivity callbacks via webhooks

## Sending a message

### A simple notification

```graphql theme={null}
mutation {
  slack_sendMessage(input: {
    channel: "#general"
    text: "Build #482 deployed to production"
  }) {
    ts
    channel
  }
}
```

The returned `ts` is the message timestamp — keep it if you want to update or thread on it later.

### Block Kit

For richer messages with buttons or sections, pass a Block Kit `blocks` array:

```graphql theme={null}
mutation {
  slack_sendMessage(input: {
    channel: "C0123456789"
    text: "New signup"
    blocks: """
    [
      { "type": "section", "text": { "type": "mrkdwn", "text": "*New signup:* ada@example.com" }},
      { "type": "actions", "elements": [
        { "type": "button", "text": { "type": "plain_text", "text": "View" }, "url": "https://yourapp.com/admin/users/123" }
      ]}
    ]
    """
  }) {
    ts
  }
}
```

### Reply in a thread

Pass `threadTs` to thread under an existing message:

```graphql theme={null}
mutation {
  slack_sendMessage(input: {
    channel: "C0123456789"
    threadTs: "1714060800.000100"
    text: "Resolution: rolled back release v1.2.3"
  }) { ts }
}
```

### Direct messages

Pass a user ID (`U...`) as the channel to DM that user. The bot must have the `chat:write` scope and the user must be in a workspace where the app is installed.

### Scheduled messages

```graphql theme={null}
mutation {
  slack_scheduleMessage(input: {
    channel: "#announcements"
    text: "Office reopens in 1 hour"
    postAt: "2026-06-01T14:00:00Z"
  }) {
    scheduledMessageId
  }
}
```

## Webhooks

If you want to receive events from Slack — slash commands, button clicks, mention events — point your Slack App's **Event Subscriptions** request URL and **Interactivity** request URL at the Archie-generated Slack webhook URL for your project. Archie verifies the signing secret on every event.

See [Webhooks](/features/backend/integrations/webhooks) for handling them in custom functions.

## FAQ

<AccordionGroup>
  <Accordion title="Channel name vs. channel ID — which should I pass?">
    Both work for public channels. Channel IDs (`C0123456789`) are more reliable because they don't change if the channel is renamed. For private channels and DMs, the ID is required and the bot must be a member.
  </Accordion>

  <Accordion title="My bot can't post to a channel. What's wrong?">
    The bot has to be invited to the channel — `/invite @yourbot` from inside Slack. Public channels can be posted to without joining if you've granted the `chat:write.public` scope, but private channels always require membership.
  </Accordion>

  <Accordion title="How do I respond to a button click?">
    Slack POSTs an interactivity payload to the URL configured under **Interactivity & Shortcuts**. Point that at Archie's webhook URL and handle the action in a custom function. Reply within 3 seconds with a 200 OK to acknowledge, then post a follow-up message asynchronously if needed.
  </Accordion>

  <Accordion title="Can I send DMs to users who aren't in the workspace?">
    No. Slack only allows messaging users who are members of a workspace your app is installed in. For broader notifications, use email (SendGrid) or SMS (Twilio).
  </Accordion>

  <Accordion title="What's the rate limit?">
    Slack's Web API allows roughly 1 message per second per channel, with short bursts allowed. For high-volume notifications, batch into a single message with multiple Block Kit sections or use a thread to group related updates.
  </Accordion>
</AccordionGroup>
