# Send data to your system (webhooks)

> Every event ClearTalk can send to your endpoint, what each payload contains, and how deliveries are signed.

Source: https://docs.cleartalk.ai/docs/integrations/webhooks

ClearTalk can POST JSON to any HTTPS endpoint you configure — after calls, chat sessions, and key texting moments. This page is the full reference: where to set it up, every event, the payload fields, and the delivery mechanics.

<Summary
  items={[
  "Seven events, covering calls, chats, and the texting moments that matter.",
  "One endpoint for everything, or many with their own event subscriptions.",
  "Every delivery is signed, and every attempt is logged with a manual resend.",
  "Build your field mapping from a real call — the test payload uses different names.",
]}
/>

## Configuration

Everything lives under **Integrations → Send data to your system** in your dashboard (owner or admin role required):

<Screenshot
  src="/img/webhook-destination.png"
  alt="The Integrations page on the Send data to your system tab, showing a Not configured badge and a single Destination URL field."
  caption="The simple setup: one HTTPS endpoint that receives everything."
  pins={[
  { x: 21, y: 60.1, from: "left", at: -2, label: "Where this lives. The other tabs are CRM, Calendar, Document links, and API access." },
  { x: 96.6, y: 47.8, from: "right", at: 102, label: "Whether anything is configured at all — check this before debugging a missing delivery." },
  { x: 96.6, y: 63.8, from: "right", at: 102, label: "Must be https, and your receiver has about ten seconds to answer." },
]}
  redactions={[
  { x: 1.2, y: 94.3, w: 11.8, h: 4.4, reason: "Internal account name and email" },
]}
/>

* **Destination URL** — the simple option: one HTTPS endpoint that receives everything.
* **Webhook destinations** — the flexible option: multiple endpoints, each with a label, its own event subscriptions, and optionally scoped to a single campaign (useful for routing each client's traffic to their own system). An empty event selection means *all events, including future ones*.

<Callout type="warn" title="Destinations override the single URL">
  The moment any destination rows exist, the single Destination URL is ignored entirely. Configure one approach or the other — and note that if destinations exist but none subscribes to an event, that event is delivered nowhere.
</Callout>

You can also choose which **call results** send data at all, under **Settings → Call Reports**, and browse every delivery — status, payload, response — under **Webhook Logs** in the sidebar, which includes a manual resend.

<Callout title="SMS agents can carry their own webhook">
  A texting agent with a **Webhook URL** set in its SMS Settings takes over the conversation events for its own threads: `sms.conversation.replied`, `sms.conversation.closed`, and `sms.conversation.opted_out` go to the agent's URL instead of the destinations above. The agent's **Notify me when** setting decides what it receives — *Every message* sends each reply plus the close, *The conversation ends* sends only the close. Sequence and appointment events always follow the org-wide routing, and agents without a URL do too.
</Callout>

## Events

| Event                        | Fires when                                                                                                                                  |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `call.completed`             | A phone call or web-agent session ends and is processed.                                                                                    |
| `chat.completed`             | A chatbot session settles (only if the visitor sent at least one message).                                                                  |
| `sms.conversation.replied`   | A lead's first reply in a texting conversation — the real-time "this lead engaged" signal.                                                  |
| `sms.conversation.closed`    | A texting conversation is closed.                                                                                                           |
| `sms.conversation.opted_out` | A conversation closed because the lead opted out — same payload as `closed`, different event name, so you can key suppression syncs off it. |
| `sms.cadence.completed`      | A scripted message sequence finished without a reply.                                                                                       |
| `sms.appointment.booked`     | A texting conversation booked an appointment.                                                                                               |

<Callout title="Identifying call payloads">
  Call payloads carry no top-level `event` field — identify them by the presence of `cleartalk.externalCallId`. All SMS and chat payloads carry an explicit `event` field.
</Callout>

## The `call.completed` payload

The call payload passes through what the voice layer reports, minus internal fields, plus three blocks ClearTalk adds. The fields your receiver will use most:

| Field                                                                                 | What it is                                                                                                                                                                                                                                                                    |
| ------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `call_id`                                                                             | The call's ID (also in `cleartalk.externalCallId`).                                                                                                                                                                                                                           |
| `inbound`                                                                             | `true` for inbound calls. On outbound calls `to` is the customer; on inbound calls `from` is.                                                                                                                                                                                 |
| `to`, `from`                                                                          | The two phone numbers, E.164 format.                                                                                                                                                                                                                                          |
| `status`, `completed`, `answered_by`                                                  | Call status; `answered_by` distinguishes `human` / `voicemail` / `no-answer`.                                                                                                                                                                                                 |
| `duration`                                                                            | Call length in seconds.                                                                                                                                                                                                                                                       |
| `recording_url`                                                                       | Link to the call audio.                                                                                                                                                                                                                                                       |
| `transcripts`                                                                         | Turn-by-turn transcript array; `concatenated_transcript` is the same as one string.                                                                                                                                                                                           |
| `summary`                                                                             | A short summary of the call.                                                                                                                                                                                                                                                  |
| `started_at`, `ended_at`                                                              | Timestamps.                                                                                                                                                                                                                                                                   |
| `transferred_to`, `transferred_at`, `pre_transfer_duration`, `post_transfer_duration` | Present when the agent transferred the call: the number it went to, when, and how long the call ran before and after. They are set on every transfer attempt, including one that never connected, so compare `transferred_at` with the call's end to spot a dropped transfer. |
| `cleartalk`                                                                           | ClearTalk's stable identifiers: `organizationId`, `agentId`, `agentName`, `campaignId`, `contactId`, `externalCallId`, `direction`. The anchor for matching records in your system.                                                                                           |
| `cost`                                                                                | Your cost for the call, at your account's rates.                                                                                                                                                                                                                              |
| `ai_analysis`                                                                         | Present when AI analysis ran: `call_outcome` (the call's result), `call_notes` (AI summary), `appointment_date_time` (when one was booked), and `analysis_schema` (answers to your configured post-call questions, keyed by the exact question text).                         |

## The SMS and chat payloads

All carry `event` plus a `cleartalk` identifier block (`organizationId`, `conversationId`, `agentId`, `campaignId`, `contactId`, `contactPhone`, and related IDs), then an event-specific block:

* **`sms.conversation.replied`** — `sms.repliedAt` and `sms.message` (the reply's body and time).
* **`sms.conversation.closed` / `opted_out`** — `sms.status`, timestamps, `messageCount`, `cost`, and `history`: the full message list (direction, body, status, time; up to 200 messages, oldest first).
* **`sms.cadence.completed`** — `cadence.disposition` (`completed` or `handed_off`), `touchesSent`, enrollment timestamps.
* **`sms.appointment.booked`** — `appointment`: `bookingId`, `calendarSource`, `startAt`, `endAt`, `attendeeName`, `attendeeEmail`.
* **`chat.completed`** — `chat`: `status`, `messageCount`, `cost`, timestamps, and the message `history`.

## How a delivery travels

<Sequence
  caption="What happens between a call ending and the data landing in your system."
  steps={[
  { title: "The conversation ends", note: "ClearTalk finishes processing it — transcript, summary, and result are ready." },
  { title: "The payload is assembled", note: "Internal fields are stripped out and ClearTalk's own identifiers are added, so you can match the record to a contact and campaign." },
  { title: "It's signed and sent", note: "A signature and timestamp go in the headers, then it's posted to your address." },
  { title: "Your endpoint replies", note: "Answer with any 2xx within 30 seconds and the delivery is done." },
  { title: "Either way, it's logged", note: "Every attempt appears under Webhook Logs with its status and payload — and can be resent by hand from there." },
]}
/>

<Callout type="warn" title="A rejected delivery is not retried">
  If your endpoint answers with an error status, ClearTalk records it and moves on — from its side the delivery happened. Only network failures and timeouts are retried automatically. Check Webhook Logs if something looks missing.
</Callout>

### Skipped deliveries

When ClearTalk deliberately doesn't send a call, Webhook Logs still shows a row for it, marked **Skipped**, with **Why it wasn't sent**:

* **"Not sent: your Call Reports settings turn this result off"** — the call's result is switched off under Settings → Call Reports.
* **"Not sent: none of your destinations subscribe to this event"** — you have webhook destinations, but none of them is subscribed to calls (or scoped to this call's campaign).

A skipped row was never sent, so it has no resend. Change the setting that skipped it, and calls that end afterwards are delivered.

## Delivery mechanics

* **Method:** `POST`, `content-type: application/json`, to your HTTPS endpoint. Respond with any 2xx within 30 seconds.
* **Signing:** every delivery carries `x-cleartalk-timestamp` (unix seconds) and `x-cleartalk-signature: sha256=&lt;hex&gt;`, where the hex is HMAC-SHA256 of `"{timestamp}.{raw body}"` using your signing secret (shown as `whsec_...` in the destinations card — one secret per organization, shared by all destinations). Verify by recomputing over the raw bytes you received. Test sends add `x-cleartalk-test: 1`; manual resends add `x-cleartalk-retry-of`.
* **Retries:** a response with a non-2xx status is logged but **not retried** — from ClearTalk's side the delivery happened. Network failures and timeouts on call and SMS events are retried a few times automatically; chat completions are not. Anything can be resent manually from Webhook Logs.
* **Test sends:** the **Send test data** button posts a synthetic payload (`event: "cleartalk.webhook.test"`). Its field names intentionally don't match a real call payload — build field mappings in your receiving system from a real call, not the test.

## When payload encryption is on

Organizations with HIPAA-grade payload encryption enabled (Security page) send every payload as an encrypted envelope instead of plaintext JSON:

```json
{ "encrypted_data": "&lt;base64&gt;", "IV": "&lt;base64&gt;" }
```

AES-256-CBC with your organization's key; decrypting yields exactly the JSON documented above. The signature is computed over the envelope, so verify-then-decrypt works. Note that no-code receivers (HighLevel, Zapier) can't decrypt — encryption is for customers running their own receiving endpoint.

### What turning encryption on changes

* **Webhook payloads** leave ClearTalk encrypted with your key, and we keep only the encrypted copy in Webhook Logs.
* **Call records** keep no transcript, summary, recording link or phone number on our side; your system receives them in the encrypted payload.
* **Support access** needs a fresh security code for each visit, and diagnostics show the structure of a call without its content.

It does not change how the rest of your account is stored. Text message threads, contacts and their notes, booking attendees and assistant chats are kept as they are for every account, because the agents and your dashboard read them. Keep protected health information out of those fields if your agreement requires it.
