> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.youratlas.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.youratlas.com/_mcp/server.

# Webhooks

Webhooks let Atlas push events to your systems the moment they happen — when a
call starts or ends, when a chat message is received or sent, or when a chat
session completes. Instead of polling the API, you register a URL once and Atlas
sends an HTTP `POST` to it every time the event fires.

This is the inverse of [Atlas Actions](/docs/atlas-actions/atlas-actions): Actions let your
agent call *out* to your API during a conversation, while webhooks let Atlas
notify your API *after* something happens.

## How it works

1. You register a webhook for a campaign and an event (a *trigger*).
2. When that event fires, Atlas sends a `POST` request to your URL with the
   event payload as JSON.
3. Your endpoint responds quickly with a `2xx` status code.

All requests use the standard API base URL and `api-key` authentication — see
[API Overview](/api-reference/overview/api-overview).

```
https://api.youratlas.com/v1/api
```

## Events

You can subscribe to five events. The `triggerName` value is what you pass when
subscribing.

| Event             | `triggerName`               | Fires when                                                                                                       |
| ----------------- | --------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| Call started      | `call_started`              | An outbound or inbound call begins                                                                               |
| Call completed    | `call_completed`            | A call ends (includes summary, transcript, recording)                                                            |
| Message received  | `message_received`          | A customer message arrives on a chat campaign                                                                    |
| Message sent      | `message_sent`              | The agent sends a chat message                                                                                   |
| Session completed | `message_session_completed` | A chat session ends after a period of inactivity (one event per session, with the full transcript and a summary) |

## Subscribe (create a webhook)

Register a webhook by `POST`ing to `/events-gateway/trigger/subscribe`.

```bash
curl --location 'https://api.youratlas.com/v1/api/events-gateway/trigger/subscribe' \
  --header 'api-key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "hookUrl": "https://example.com/atlas/webhook",
    "campaignId": "76effd5c-7286-4d3c-9f8e-e5d4c8287d12",
    "triggerName": "call_completed",
    "provider": "custom"
  }'
```

| Field                      | Required | Description                                                                                                                                                                                       |
| -------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `hookUrl`                  | Yes      | HTTPS URL Atlas will deliver the event to.                                                                                                                                                        |
| `campaignId`               | Yes      | The campaign to subscribe to. Use `"*"` to receive the event from every campaign.                                                                                                                 |
| `triggerName`              | Yes      | One of the [events](#events) above.                                                                                                                                                               |
| `provider`                 | Yes      | Identifies the webhook integration. For direct API usage send `"custom"`.                                                                                                                         |
| `inactivityTimeoutMinutes` | No       | **`message_session_completed` only.** How long a chat session must be idle before it's considered complete. Integer between `1` and `10080` (7 days). Defaults to `60`. Ignored for other events. |

A successful subscription returns `201`:

```json
{
  "id": "https://example.com/atlas/webhook",
  "campaignId": "76effd5c-7286-4d3c-9f8e-e5d4c8287d12",
  "triggerName": "call_completed"
}
```

> **Note**
>
> Each subscription is one event for one campaign. To receive both `call_started`
> and `call_completed`, subscribe twice.

## Event payloads

When an event fires, Atlas sends a `POST` to your `hookUrl` with
`Content-Type: application/json`. The body is a **JSON array** containing the
event object.

### `call_started`

```json
[
  {
    "campaignId": "string",
    "agentId": "string",
    "callId": "string",
    "customerNumber": "string",
    "customerName": "string",
    "campaignName": "string",
    "agentName": "string",
    "campaignType": "string"
  }
]
```

### `call_completed`

Includes everything from `call_started`, plus the call result:

```json
[
  {
    "campaignId": "string",
    "agentId": "string",
    "callId": "string",
    "customerNumber": "string",
    "customerName": "string",
    "campaignName": "string",
    "agentName": "string",
    "campaignType": "string",
    "callSummary": "string",
    "startedAt": "2026-06-02T13:04:30.000Z",
    "endedAt": "2026-06-02T13:08:11.000Z",
    "durationMs": 221000,
    "durationSeconds": 221,
    "durationMinutes": 3.68,
    "callTranscript": "string",
    "audioUrl": "https://...",
    "customerEmail": "string",
    "status": "Accepted",
    "endedReason": "customer-ended-call"
  }
]
```

`status` is the call's terminal disposition — one of `Accepted`, `Rejected`, or
`Missed`. `endedReason` is the raw end-of-call reason (for example
`customer-ended-call`), passed through verbatim.

### `message_received` / `message_sent`

```json
[
  {
    "campaignId": "string",
    "agentId": "string",
    "customerNumber": "string",
    "customerName": "string",
    "campaignName": "string",
    "agentName": "string",
    "campaignType": "string",
    "messageContent": "string",
    "receivedAt": "2026-06-02T13:04:30.000Z"
  }
]
```

`message_sent` uses `sentAt` instead of `receivedAt`.

### `message_session_completed`

Fires once when a chat session ends — that is, after the session has been idle
for `inactivityTimeoutMinutes` (60 by default). Includes the full transcript and
a summary of the conversation.

```json
[
  {
    "campaignId": "string",
    "agentId": "string",
    "customerNumber": "string",
    "customerName": "string",
    "campaignName": "string",
    "agentName": "string",
    "campaignType": "string",
    "sessionId": "string",
    "startedAt": "2026-06-02T13:04:30.000Z",
    "endedAt": "2026-06-02T13:14:30.000Z",
    "messageCount": 3,
    "messages": [
      {
        "role": "user",
        "content": "Hello, I would like to schedule an appointment.",
        "timestamp": "2026-06-02T13:04:30.000Z"
      },
      {
        "role": "assistant",
        "content": "Sure! I can help you with that. When would you like to come in?",
        "timestamp": "2026-06-02T13:04:30.000Z"
      },
      {
        "role": "user",
        "content": "Tomorrow at 2pm works for me.",
        "timestamp": "2026-06-02T13:14:30.000Z"
      }
    ],
    "conversationSummary": "The customer requested an appointment and agreed on tomorrow at 2pm."
  }
]
```

> **Tip**
>
> Before subscribing, you can fetch a sample payload built from a real campaign to
> develop against:
>
> ```bash
> curl --location 'https://api.youratlas.com/v1/api/events-gateway/trigger/perform/call_completed?campaignId=YOUR_CAMPAIGN_ID' \
>   --header 'api-key: YOUR_API_KEY'
> ```

## List webhooks

See every webhook registered for a campaign:

```bash
curl --location 'https://api.youratlas.com/v1/api/events-gateway/triggers/campaign/YOUR_CAMPAIGN_ID' \
  --header 'api-key: YOUR_API_KEY'
```

## Unsubscribe (delete a webhook)

Stop delivery by sending a `DELETE` to `/events-gateway/trigger/unsubscribe`
with the same values you subscribed with:

```bash
curl --location --request DELETE 'https://api.youratlas.com/v1/api/events-gateway/trigger/unsubscribe' \
  --header 'api-key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "hookUrl": "https://example.com/atlas/webhook",
    "campaignId": "76effd5c-7286-4d3c-9f8e-e5d4c8287d12",
    "triggerName": "call_completed",
    "provider": "custom"
  }'
```

## Building your receiver

* **Respond with `2xx` quickly.** Acknowledge the request and do any heavy
  processing asynchronously. Slow endpoints may time out.
* **Expect retries to be best-effort.** If your endpoint is unreachable, the
  event may not be redelivered — don't rely on a webhook as your only record of
  an event; the [Calls](/api-reference/atlas-api/calls/get-call-records) and chat endpoints remain the source of
  truth.
* **Handle duplicates.** Treat delivery as at-least-once and de-duplicate on
  `callId` (calls) or message identifiers where it matters.

> **Warning**
>
> Atlas does not currently sign webhook requests. Treat your `hookUrl` as a
> secret: use HTTPS and a hard-to-guess path (for example, include a random token
> in the URL) so only Atlas can post to it.