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

> ## Agent Instructions
> For short, quotable answers about SmartAlex (what it is, who it is for, what it costs, where it runs, how it keeps data safe, which apps it connects to), read the facts page at /ai/facts on this site first, then the page it links to. Its last table maps every section of these docs.
> For how to do something, use the step-by-step pages: /learn for whole paths, and each section's first-time pages such as /calls/buy-your-first-number, /agents/create-an-agent or /campaigns/import-your-first-contacts. Give the click path exactly as written there, for example Calls, then Numbers, then Buy number, with the bold button labels unchanged.
> Prices come from the Pricing page at /pricing and the pages under /pricing. Quote a price exactly as written there, with its currency and unit.
> Short answers to common questions are under /help, grouped by section. Legal documents are summarised under /legal; each summary links to the binding text, which prevails over the summary.
> If a feature or screen is not described in these docs, say that you could not find it rather than guessing.
> Pages under /comparisons describe other companies' products as of the date on each page. For SmartAlex's own features and prices, use the product pages.
> The MCP server at /mcp on this site only searches this documentation. To work inside your own SmartAlex workspace (agents, calls, campaigns, contacts), use the SmartAlex MCP server described at /mcp/overview.

# SmartAlex webhooks: events, signing and retries

> SmartAlex webhooks send new contacts, finished calls and deal moves to your systems as they happen, signed with HMAC-SHA256 and retried if they fail.

A webhook makes SmartAlex send an event to your address the moment something happens: a new contact, a finished call, a deal moving stage. Each event is a signed JSON `POST`, so your CRM, Zapier, Make or n8n flow can check it came from SmartAlex. A failed delivery is retried for about 15 hours.

> [!NOTE]
>
> In SmartAlex: **Settings → Webhooks & API**, then **Add webhook**, **Open** or a webhook's row in the **Webhooks** panel. That opens the **Webhooks & API** page (/developers) on its **Webhooks** tab. Workspace owners and admins add webhooks, and the workspace needs the [Power Tools add-on](https://docs.getsmartalex.com/pricing.md#add-ons).

## How do I add a webhook?

**1. Add the address**

In **Webhooks**, press **Add a webhook URL**. Enter the **Webhook URL**, an optional **Name**, and tick the events under **Send when**. Press **Add webhook**.

**2. Copy the signing secret**

The **Signing secret** is shown only once. Copy it into your receiver's settings now.

**3. Send a test event**

Press **Send a test event** on the webhook's row. It sends a `test.ping` event, and the result shows under **Recent deliveries**.

You can also ask a connected AI app to *"send new contacts to my CRM webhook"*. See [Usage examples](https://docs.getsmartalex.com/mcp/examples.md#how-do-i-send-new-contacts-to-my-crm).

## Which events can I send?

| Event | Label in SmartAlex | Sent when |
| - | - | - |
| `contact.created` | Contact created | A new contact from a call, a chat, a form or an import |
| `contact.updated` | Contact changed | Their details change, or they call or message again |
| `contact.deleted` | Contact deleted | A contact is deleted. Sends only the id, so your CRM can erase them too |
| `call.completed` | Call finished | A call ends |
| `campaign.completed` | Campaign finished | Everyone in a campaign has been called |
| `deal.created` | Deal created | A new deal |
| `deal.stage_changed` | Deal moved stage | A deal moves to another pipeline stage |
| `quote.created` | Quote created | A quote is made, with its reference, stay and amount due |
| `quote.sent` | Quote sent | A quote goes to the guest on WhatsApp |
| `quote.viewed` | Quote opened | The guest opens their quote for the first time |
| `quote.paid` | Quote paid | A quote is marked paid |

## What does a delivery look like?

Every event has the same envelope. `data` holds the record, here a contact:

```json theme={null}
{
  "id": "4f1c2b9e-7d3a-4e8b-9c61-2a5d8e0f3b17",
  "event": "contact.created",
  "tenant_id": "0b7e3c1a-52f4-4d9e-8a16-c3f09d2e7a45",
  "timestamp": "2026-11-26T09:14:03.512Z",
  "data": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "first_name": "Sarah",
    "last_name": "Chen",
    "email": "sarah@acmerealty.example",
    "phone": "+14155550123",
    "company": "Acme Realty",
    "tags": ["buyer"],
    "custom_fields": {},
    "created_at": "2026-11-26T09:14:02.991Z",
    "updated_at": "2026-11-26T09:14:02.991Z"
  }
}
```

Contact events also carry `status` and `channel` (where the contact first came from). They carry `latest_activity` (their last call or message, in one line) and `link` too, which opens the contact in SmartAlex.

Each delivery carries these headers:

| Header | What it holds |
| - | - |
| `X-SmartAlex-Signature` | HMAC-SHA256 of the raw body, as hex, made with your signing secret |
| `X-SmartAlex-Signature-Previous` | The same, made with your old secret, for 24 hours after you roll it |
| `X-SmartAlex-Event` | The event, such as `call.completed` |
| `X-SmartAlex-Delivery` | The event's `id`, the same on every attempt |
| `X-SmartAlex-Attempt` | 1 for the first try, 2 for the first retry, and so on |

## What does the Call finished event hold?

`call.completed` is sent once for each call, a few seconds after it ends. It says which call it was, who was called, how long it lasted and how it ended. It does not carry the summary or transcript: read those with the `call_id` (see [How do I read the call afterwards?](#how-do-i-read-the-call-afterwards)).

```json theme={null}
{
  "id": "9e2d4c71-3b8a-4f06-a5d2-71c0e8b94f13",
  "event": "call.completed",
  "tenant_id": "0b7e3c1a-52f4-4d9e-8a16-c3f09d2e7a45",
  "timestamp": "2026-12-01T09:04:41.204Z",
  "data": {
    "call_id": "c3a81f5e-6d29-4b7a-9e14-58f2d0b6a937",
    "direction": "outbound",
    "duration_seconds": 142,
    "sentiment": null,
    "contact_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "agent_id": "5f8e2a1c-9b47-4d36-8c05-e7a3b9d16f24",
    "campaign_id": "7d4b9e26-1f83-4a5c-b0e9-3c62f8a17d05",
    "outcome": "success",
    "call_type": "campaign",
    "attempt": 1
  }
}
```

| Field | What it holds |
| - | - |
| `call_id` | The call's id. Read the call with `GET /calls/{id}` |
| `direction` | `outbound` when your agent made the call, `inbound` when someone rang it, `webCall` from a browser |
| `duration_seconds` | How long the call lasted, in whole seconds. Usually `0` when nobody answered |
| `sentiment` | `positive`, `neutral` or `negative`. Usually `null` here, because it is worked out after the event is sent. Read it from the call |
| `contact_id` | The person called. It is the same `contact_id` the campaign web address returned for them |
| `agent_id` | The agent that made or took the call |
| `campaign_id` | The campaign the call belongs to, or `null` for a call outside a campaign |
| `outcome` | How the call ended. See the table below |
| `call_type` | `campaign`, `callback` (a call the person asked for), `inbound`, `outbound` (started by hand) or `web` |
| `attempt` | On a campaign call, which try it was for this person in this campaign, starting at `1`. `null` on other calls |

The event carries ids only, never the person's name or number. Read the person with `GET /contacts/{id}` and the `contacts:read` scope.

These are the outcomes you will see on campaign calls:

| `outcome` | What happened | Person reached? |
| - | - | - |
| `success` | The person answered and spoke with the agent | Yes |
| `transferred` | The agent passed the call to your team | Yes |
| `voicemail` | Voicemail or an answering machine picked up | No |
| `no_answer` | Nobody answered | No |
| `busy` | The line was busy | No |
| `no_conversation` | The call connected, but nobody spoke with the agent | No |
| `failed` | The call could not be completed | No |

Less often you may see `timeout`, `invalid_number` or `blocked`. Treat any value you do not recognise as not reached.

## How do I check the signature?

Work out the HMAC-SHA256 of the **raw** request body with your signing secret and compare it with `X-SmartAlex-Signature`. Use the body exactly as it arrived, because parsing and re-encoding the JSON changes it. Here is Node.js with Express:

```javascript theme={null}
import crypto from "node:crypto";
import express from "express";

const app = express();
const secret = process.env.SMARTALEX_WEBHOOK_SECRET;
const seen = new Set(); // use your database in production

function signedBy(body, signature, key) {
  if (!signature || !key) return false;
  const expected = crypto.createHmac("sha256", key).update(body).digest("hex");
  return expected.length === signature.length &&
    crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
}

app.post("/webhooks/smartalex", express.raw({ type: "application/json" }), (req, res) => {
  const ok = signedBy(req.body, req.get("X-SmartAlex-Signature"), secret);
  if (!ok) return res.status(401).send("Bad signature");

  const event = JSON.parse(req.body);
  const ageMs = Date.now() - Date.parse(event.timestamp);
  if (ageMs > 5 * 60 * 1000) return res.status(400).send("Too old");
  if (seen.has(event.id)) return res.sendStatus(200);
  seen.add(event.id);

  // Handle event.event and event.data here, then answer quickly.
  res.sendStatus(200);
});

app.listen(3000);
```

The same check in Python:

```python theme={null}
import hashlib
import hmac

def signed_by(raw_body: bytes, signature: str, secret: str) -> bool:
    expected = hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, signature or "")
```

The `timestamp` is set fresh on every attempt and the body is signed again. Refusing old timestamps stops a captured request being replayed later.

## What happens when a delivery fails?

SmartAlex waits up to 10 seconds for a `2xx` answer. A timeout, any other status or a redirect counts as a failure, and the event is sent again. This diagram shows the schedule.

```mermaid theme={null}
sequenceDiagram
    participant SA as SmartAlex
    participant You as Your address
    SA->>You: Attempt 1
    You-->>SA: 500 or no answer in 10 seconds
    Note over SA: Wait about 1 minute
    SA->>You: Attempt 2
    Note over SA: Then about 5 minutes, 30 minutes, 2 hours and 12 hours
    SA->>You: Attempt 6, the last
    You-->>SA: 200
```

* An event is tried at most 6 times, over about 15 hours.
* A webhook is switched off after 10 failed attempts in a row **and** nothing delivered for 24 hours. A short outage does not switch it off.
* Answer `200` as soon as you have stored the event, and do the slow work afterwards.

## What addresses can receive webhooks?

The URL must use `https` and resolve to a public address. SmartAlex checks this again at every delivery, so an address that later points somewhere private is refused. Redirects are not followed.

## How do I roll the signing secret?

Press **Roll signing secret** on the webhook's row, then **Roll secret**. The new secret is shown once. The old one keeps working for 24 hours. During that day each delivery is signed with both, in `X-SmartAlex-Signature` and `X-SmartAlex-Signature-Previous`, so update your receiver within the day.

## How do I send people into a campaign from my system?

A webhook carries events out of SmartAlex. To go the other way, give a running outbound campaign its own **web address**, and your system posts people to it to be called. This diagram shows the loop.

```mermaid theme={null}
flowchart LR
    S["Your system or form"] -->|"POST a person"| W["Campaign web address"]
    W --> C["Campaign calls them"]
    C -->|"call.completed webhook"| S
```

**1. Create the web address**

A workspace owner or admin asks their connected AI app, for example *"give my Demo Requests campaign a web address"*. The app uses `smartalex_create_trigger_webhook`, asks you to confirm the lawful basis for calling these people, and returns the address and a secret starting `sa_whk_`. The secret is shown once.

**2. Post people to it**

```bash theme={null}
curl -X POST "https://api.getsmartalex.com/functions/v1/campaign-trigger-webhook/your-trigger-id" \
  -H "Authorization: Bearer sa_whk_your_secret" \
  -H "Content-Type: application/json" \
  -d '{ "phone": "+14155550123", "first_name": "Sarah", "event_id": "form-8812" }'
```

Send one person, or up to 100 as `{ "people": [ ... ] }`. Each person is described under [What can each person carry?](#what-can-each-person-carry).

**3. Get the results**

Add a webhook for **Call finished**. Each call sends one `call.completed` event with its `call_id`, `contact_id` and `campaign_id`. Then read the summary and transcript with `GET /calls/{id}`.

The campaign must be running and have a call plan, or the address answers `409`. A wrong secret answers `401`. The campaign page shows the address under **Trigger**, with when it last received people and the daily limit.

### What can each person carry?

Here are two people in one request:

```json theme={null}
{
  "people": [
    {
      "phone": "+14155550123",
      "first_name": "Sarah",
      "last_name": "Chen",
      "email": "sarah@acmerealty.example",
      "notes": "Asked for a call back about the annual plan.",
      "fields": { "company": "Acme Realty", "account_owner": "Jordan", "reference": "BC-10442" },
      "call_at": "2026-12-01T09:00:00Z",
      "event_id": "crm-10442"
    },
    {
      "phone": "+14155550124",
      "first_name": "Tom",
      "event_id": "crm-10443"
    }
  ]
}
```

| Field | Needed | Format and limits |
| - | - | - |
| `phone` | Yes | International format, such as `+14155550123`. A local number is read in your workspace's country |
| `first_name`, `last_name` | No | Text. The agent uses their first name on the call |
| `email` | No | An email address. It is saved only when the contact has none yet |
| `notes` | No | Text of up to 500 characters, such as why you are calling |
| `fields` | No | A flat JSON object of up to 10 names and values, such as `{ "company": "Acme Realty" }`. Names up to 40 characters, values up to 100, and each value is text or a number. A list is refused |
| `call_at` | No | The earliest time to call, in ISO 8601 with its time zone: `2026-12-01T09:00:00Z` for UTC, or an offset such as `2026-12-01T11:00:00+02:00`. Up to 90 days ahead |
| `event_id` | No | Your own id for this person, up to 120 characters. Send the same one again and they are not added twice |

`call_at` is the earliest time, not an exact one. The call goes out at that time or after it, inside the campaign's calling hours and after any wait set on the web address. Leave it out, or send a time that has passed, and the person is called as soon as the hours allow.

### What does the web address answer?

A request that is read answers `200` with one result per person, in the order you sent them:

```json theme={null}
{
  "received": 3,
  "added": 1,
  "skipped": { "duplicate": 1, "invalid": 1 },
  "results": [
    { "index": 0, "outcome": "added", "contact_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890" },
    { "index": 1, "outcome": "duplicate", "contact_id": "e7f8a9b0-c1d2-4e3f-8a4b-5c6d7e8f9a01" },
    { "index": 2, "outcome": "invalid", "reason": "fields_invalid" }
  ]
}
```

`received` counts the people in the request, `added` counts those who joined the campaign, and `skipped` counts the rest by outcome. `index` is the person's place in your list, counting from 0.

`contact_id` is the person's id in SmartAlex, not a call id. No call exists yet when you post: the campaign calls the person later, inside its hours, and its call plan may try more than once. Every one of those calls sends **Call finished** with the same `contact_id` and `campaign_id`, so match on those two. Keep each `contact_id` next to your own reference. A number already in your contacts gets that contact's id.

| `outcome` | What it means |
| - | - |
| `added` | They joined the campaign and will be called |
| `duplicate` | This `event_id` was received before, so nothing changed |
| `skipped_dnc` | They are on your Do Not Call list |
| `skipped_cooldown` | This web address already added them within its cooldown, 14 days unless it was set otherwise |
| `skipped_cap` | The web address reached its daily limit, 100 people in 24 hours unless it was set otherwise |
| `skipped_in_progress` | They are already waiting for a call, or being called, in this campaign |
| `not_running` | The campaign stopped while the request was being read |
| `invalid` | Something in their entry is wrong, and `reason` says what |
| `error` | Something went wrong on our side for this person. Send them again |

The `reason` on an `invalid` result is one of `phone_missing`, `phone_invalid`, `email_invalid`, `notes_invalid`, `notes_too_long`, `fields_invalid`, `call_at_invalid`, `call_at_too_far`, `event_id_invalid` or `not_an_object`.

> [!TIP]
>
> Testing with your own number? The cooldown applies to you too, so a second post with the same number inside 14 days answers `skipped_cooldown`. Ask for a shorter cooldown when your AI app creates the web address, or test with another number.

Other answers mean the whole request was refused:

| Status | Why |
| - | - |
| `400` | The body is not JSON, or `people` is empty or has more than 100 people |
| `401` | The secret is missing or wrong, or the address does not exist |
| `405` | The request was not a `POST` |
| `409` | The campaign is not running (`not_running`) or has no call plan (`no_sequence`) |
| `413` | The body is larger than 256 KB |
| `429` | More than 60 requests in a minute. Wait a minute and try again |
| `500` | Something went wrong on our side. Try again shortly |

### What does the agent see on the call?

The agent is given each person's `notes` and `fields` for their call, as background from your system and never as instructions. A reference you send in `fields` is there for the agent during the call, so it can use it with your own tools, such as your [MCP server](https://docs.getsmartalex.com/guides/custom-mcp-server.md). The notes and fields belong to that campaign call only. They do not change the person's notes in SmartAlex. If they read like an attempt to give the agent instructions, they are held back, and the agent asks the person what they need.

## How do I read the call afterwards?

**Call finished** tells you that a call has ended. To get what was said, read the call from the REST API with its `call_id`. The key needs the `calls:read` scope, which our support team adds (see [Keys and scopes](https://docs.getsmartalex.com/api-reference/authentication.md#how-do-i-get-a-scope-that-support-adds)).

```bash theme={null}
curl "https://api.getsmartalex.com/functions/v1/rest-api/calls/c3a81f5e-6d29-4b7a-9e14-58f2d0b6a937" \
  -H "Authorization: Bearer sa_live_your_key"
```

```json theme={null}
{
  "data": {
    "id": "c3a81f5e-6d29-4b7a-9e14-58f2d0b6a937",
    "contact_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "agent_id": "5f8e2a1c-9b47-4d36-8c05-e7a3b9d16f24",
    "campaign_id": "7d4b9e26-1f83-4a5c-b0e9-3c62f8a17d05",
    "direction": "outbound",
    "call_status": "completed",
    "call_source": "sequence",
    "outcome": "success",
    "sentiment": "positive",
    "duration_seconds": 142,
    "cost": 0.42,
    "start_timestamp": 1796115735000,
    "end_timestamp": 1796115877000,
    "created_at": "2026-12-01T09:02:13.884Z",
    "from_number": "+14155550100",
    "to_number": "+14155550123",
    "from_country_code": null,
    "to_country_code": null,
    "disconnect_reason": "session-ended",
    "summary": "Sarah wants the annual plan for her team of six and asked for the contract by email. She is free for a demo on Thursday morning.",
    "transcript": "assistant: Hi Sarah, it's Alex from Acme Realty. You asked us to call you back about the annual plan. Is now a good time?\nuser: Yes, go ahead.\nassistant: Great. How many people are on your team?\nuser: Six of us.",
    "caller_self_identified_name": null,
    "review_rating": null,
    "call_rating": "good",
    "transfer_status": null,
    "transfer_destination": null,
    "transfer_type": null,
    "test_call": false,
    "speakers": {
      "assistant": "your agent, who made this call",
      "user": "the person your agent called"
    },
    "recording_available": true
  }
}
```

| Field | What it holds |
| - | - |
| `summary` | A short summary of the call, in plain text. It is written by the call's analysis a little after the call ends, so it can still be `null` when **Call finished** arrives. Calls where nobody spoke, such as voicemail, usually have none |
| `transcript` | The whole conversation as one text, one turn per line. Each line starts with who spoke, usually `assistant:` (your agent) or `user:` (the other person). `speakers` says who each label is on this call |
| `outcome` | How the call ended, with the same values as in **Call finished** |
| `sentiment` | `positive`, `neutral` or `negative`, or `null` until the analysis has run |
| `duration_seconds` | How long the call lasted, in whole seconds |
| `start_timestamp`, `end_timestamp` | When the call started and ended, in milliseconds since 1 January 1970 (UTC) |
| `call_rating` | How well the call went: `great`, `good`, `fair` or `poor`, or `not_connected` when nobody was reached |
| `recording_available` | Whether the call has a recording. The API gives no recording link: the recording plays on the call in SmartAlex |
| `test_call` | `true` for a test call |

If `summary` is `null`, read the call again a few minutes later. The call comes back without `transcript` when the person who made the key cannot see transcripts in SmartAlex.

## Can I manage webhooks with the API?

Yes. `GET /webhooks` lists them with the `webhooks:read` scope, which owners and admins can put on a key. `POST /webhooks` and `DELETE /webhooks/{id}` need `webhooks:manage`, which our support team adds. See [Keys and scopes](https://docs.getsmartalex.com/api-reference/authentication.md).

## Questions people ask

> [accordion] Can my system trigger calls and get the results back?
>
> Yes. Give a running campaign a web address from your AI app, post people to it, and the campaign calls them. A webhook on **Call finished** sends each result back.

> [accordion] How do I know a webhook came from SmartAlex?
>
> Work out the HMAC-SHA256 of the raw body with your signing secret and compare it with the `X-SmartAlex-Signature` header. If they do not match, refuse the request.

> [accordion] Why did my webhook stop?
>
> SmartAlex switches a webhook off after 10 failed attempts in a row with nothing delivered for 24 hours. Fix the address, then add the webhook again.

> [accordion] Can I get the same event twice?
>
> Yes, when a delivery is retried. Every attempt carries the same `id`, so store the ids you have handled and skip repeats.

> [accordion] Is the id the web address returns the call id?
>
> No. It returns each person's `contact_id`, because their call has not happened yet. Each **Call finished** event carries that `contact_id` and the `campaign_id` beside its own `call_id`, so match on the contact and campaign.

> [accordion] Does the agent see the notes and fields I send?
>
> Yes. The agent has each person's `notes` and `fields` during their call, as background from your system, never as instructions.

## Related

> [card] [Getting started](https://docs.getsmartalex.com/api-reference/introduction.md)
>
> The REST API, for reading and changing data.

> [card] [Automation with Zapier, Make and n8n](https://docs.getsmartalex.com/build-with/automation.md)
>
> Connect webhooks to thousands of apps.

> [card] [Keys and scopes](https://docs.getsmartalex.com/api-reference/authentication.md)
>
> Scopes for managing webhooks by API.

> [card] [Usage examples](https://docs.getsmartalex.com/mcp/examples.md)
>
> Set up a webhook from an AI app.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.