# Slack from your code (/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.
