# Slack

> Post every new lead to a Slack channel, with the message you choose.

Every section below does the same job: in the dashboard (Guide), from your code (API) or through an AI assistant (MCP).

## Guide — In the dashboard

Source: /docs/automations/slack

Each lead that matches the automation is posted to a Slack channel the moment it arrives: who they are, their company, the pages they saw and a link to the lead. You choose the channel and the message.

1. **Integrations → Notifications → Connect Slack.**
2. **Automations → New automation**, then **Send to Slack**.
3. **Pick the channel** and, if you like, edit the message.
4. **Save.** Send yourself a test message first to see how it looks.


---

## API — From your code

Source: /docs/automations/slack/api

Authenticated with `?privateKey=YOUR_KEY` (see [Authentication](/docs/authentication)).

<Endpoints ops={["POST /admin/automations", "GET /admin/automations", "PATCH /admin/automations/{id}", "GET /v3/slack/channels", "GET /v3/slack/message-template", "PUT /v3/slack/message-template", "POST /v3/slack/test-message"]} />

<ApiPlayground
  method="post"
  path="/admin/automations"
  tool="create_automation"
  args={`{
  "name": "Docs example: send-to-slack",
  "isActive": true,
  "website": "64b7f0a1c2d3e4f5a6b7c8d9",
  "when": "new-lead-is-identified",
  "then": "send-to-slack",
  "interval": "immediately",
  "actions": {
    "sentToSlack": {
      "sendMessagesTo": "#leads",
      "howManyToAdd": 5
    }
  }
}`}
/>

### Use case: Pick the channel first [#use-case-pick-the-channel-first]

`GET /v3/slack/channels` lists the channels of the connected workspace; use one as `sendMessagesTo`.

### Use case: Try the message [#use-case-try-the-message]

`POST /v3/slack/test-message` posts a sample lead with the saved template, or the `template` you pass.


---

## MCP — AI agents

Source: /docs/automations/slack/mcp

Connect the [MCP server](/docs/mcp#quickstart), then just ask.

<Tools names={["create_automation", "list_slack_channels", "get_slack_message_template", "set_slack_message_template", "send_slack_test_message"]} />

### Use case [#use-case]

> Post every new lead from the US to #sales in Slack.

<McpToolCall name="create_automation">

```json
{
  "websiteId": "64b7f0a1c2d3e4f5a6b7c8d9",
  "name": "New US leads to #sales",
  "trigger": {
    "then": "send-to-slack",
    "actions": {
      "sentToSlack": {
        "sendMessagesTo": "#sales"
      }
    }
  },
  "actions": []
}
```

</McpToolCall>

### Use case [#use-case-1]

> Send me a test Slack message so I can see how leads look.

<McpToolCall name="send_slack_test_message">

```json
{
  "websiteId": "64b7f0a1c2d3e4f5a6b7c8d9",
  "channelName": "#sales"
}
```

</McpToolCall>

