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

# Receive weya call results on your webhook

> Send every finished weya call to your own endpoint as JSON: set up a webhook, read each payload field, and handle delivery timing, retries and duplicates.

A weya webhook sends the result of every finished call in a campaign to your endpoint as a JSON `POST` request. Each result carries the call status, recording, the values of your post-call metrics and the contact's own data, so you can update your CRM, trigger a follow-up or feed a report without polling.

## Set up a webhook

A webhook is a URL registered once for your organization and then attached to the campaigns that should use it. Each organization can have up to 5 webhooks.

**1. Create the webhook**

Register your endpoint URL in the dashboard, or with [Create Webhook](https://docs.weya.ai/api-reference/Webhooks/createWebhooks.md):

```bash theme={null}
curl --location 'https://api.weya.live/backend/api/webhooks' \
  --header "x-api-key: $WEYA_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "Call results",
    "url": "https://your-domain.com/weya/call-results",
    "bearerToken": "YOUR_ENDPOINT_TOKEN"
  }'
```

**2. Attach it to a campaign**

In the dashboard, add the webhook to the campaign under **Track Call Outcomes**. Through the API, set `pushingCrms` when you [upload a campaign](https://docs.weya.ai/api-reference/Campaigns/uploadCSV.md) or [update one](https://docs.weya.ai/api-reference/Campaigns/updateBatch.md):

```json theme={null}
"pushingCrms": [{ "type": "webhook", "crmId": "<webhook _id>", "schemaId": "<webhook _id>" }]
```

**3. Return 2xx from your endpoint**

Respond with any `2xx` status within 10 seconds. Do slow work, such as CRM writes, after you respond.

> [!WARNING]
>
> A webhook attached to a campaign receives only calls that end **after** it was attached. To send calls that already finished, select them in the dashboard and use the bulk CRM sync.

## Securing your endpoint

* If you set `bearerToken`, every delivery includes `Authorization: Bearer <token>`. Reject requests without it.
* Deliveries come from a fixed weya IP address. If your firewall only accepts known addresses, ask weya for it.
* Only the URL and bearer token are used. Custom headers and body templates are not sent.
* Register the final URL of your endpoint. weya follows redirects, but a `301` or `302` turns the `POST` into a `GET`, so the body is lost.

## Payload

```json Example payload theme={null}
{
  "call_id": "6a1f0c2e9b8d7a6f5e4d3c2b",
  "request_uuid": "b0c1d2e3-f4a5-6789-abcd-ef0123456789",
  "batch_id": "64e5f12345abcdef98765432",
  "agent_id": "686ab1234567890abcdef456",
  "campaign_channel": "voice",
  "phoneNumber": "+919800000001",
  "callingNumber": "+919876543210",
  "call_direction": "outbound",
  "callStatus": "completed",
  "call_outcome": "Promise to pay",
  "call_started_at": "2026-11-19T10:32:05+05:30",
  "duration": 94,
  "recordingUrl": "https://...",
  "call_analysis": [
    { "metric_name": "Promise date", "metric_value": "2026-12-05" }
  ],
  "lead_data": { "customer_name": "Asha", "amount_due": "4500" },
  "next_attempt_after": "",
  "is_expired": false,
  "expired_reason": "",
  "initial_lead_data": { "_notice": "deprecated — Weya webhooks no longer send initial_lead_data; use lead_data instead" }
}
```

**call\_id** `string`

The contact's ID in the campaign. It stays the same across all attempts to that contact.

**request\_uuid** `string`

The ID of this attempt. Use it as your idempotency key: each attempt has its own `request_uuid`.

**batch\_id** `string`

The campaign's ID.

**agent\_id** `string`

The agent that handled the call.

**campaign\_channel** `string`

The channel. `voice` for calls.

**phoneNumber** `string`

The contact's phone number.

**callingNumber** `string`

The weya phone number the call was made from or received on.

**call\_direction** `string`

Whether the call was outbound or inbound.

**callStatus** `string`

How the attempt ended. See [call statuses](https://docs.weya.ai/get-started/concepts.md#call-statuses).

**call\_outcome** `string`

The call's outcome from the post-call analysis. Empty when no outcome was determined.

**call\_started\_at** `string`

When the call started (ISO 8601), in the campaign's timezone.

**duration** `number`

Length of the call.

**recordingUrl** `string`

Link to the call recording, when there is one.

**call\_analysis** `array[object]`

One entry per [post-call metric](https://docs.weya.ai/single-prompt/step4.md) defined on the agent, each with `metric_name` and `metric_value`.

**lead\_data** `object`

The contact's variables, as uploaded: the columns of your CSV or the fields you sent in `callData`.

**next\_attempt\_after** `string`

When the next attempt to this contact is scheduled, in the campaign's timezone. Empty when no further attempt is scheduled.

**is\_expired** `boolean`

`true` when weya will make no further attempts to this contact. `expired_reason` says why.

**initial\_lead\_data** `object` *deprecated*

No longer populated. Use `lead_data`.

## When results are sent

weya sends one result per finished attempt with one of these statuses: `completed`, `no-answer`, `busy`, `failed`, `voicemail`, `ivr`, `canceled`, `timeout` or `aborted`. Attempts that were never dialled don't produce a webhook.

The first delivery happens about **five minutes after the call ends**, so the recording and the transcript analysis are included. If the analysis still isn't ready, weya checks again every three minutes for up to 30 minutes.

> [!WARNING]
>
> A `completed` call whose analysis still isn't ready after 30 minutes is not sent. Watch for completed calls that never reach your endpoint, and check that the agent has post-call metrics defined.

## Retries

If your endpoint doesn't return `2xx`, weya decides whether to try again from the response:

| Your endpoint returns | What weya does |
| - | - |
| `2xx` | Delivered. No more attempts |
| No response within 10 seconds, a network error, `408`, `429` or `5xx` | Retries, up to 8 deliveries in total over about 22 hours |
| Any other `4xx` | Stops. The result is not sent again |

Retries wait 1 minute, 5 minutes, 15 minutes, 1 hour, 3 hours, 6 hours, then 12 hours, each with up to 10% random jitter. If you return a `Retry-After` header, weya waits that long instead, between 30 seconds and 6 hours. Pick a response below to see the schedule.

Retry schedule for network errors, timeouts, 408, 429 and 5xx: delivery 1 at about 5 minutes after the call ends, then retries after 1 minute, 5 minutes, 15 minutes, 1 hour, 3 hours, 6 hours and 12 hours (8 deliveries, about 22 hours of retries). Other 4xx responses stop delivery immediately.

## Handling duplicates

Your endpoint can receive the same attempt more than once, for example when the recording arrives after the first delivery and weya re-sends the result with it. Treat `request_uuid` as the key: store the latest payload for each `request_uuid` and overwrite older ones.

> [!TIP]
>
> To build one record per contact, group results by `call_id` and keep the one with the latest `call_started_at`.

## Stop sending results

Remove the webhook from the campaign's **Track Call Outcomes**, or delete the webhook to stop it in every campaign at once. Retries that are already scheduled may still arrive.

## Related

> [card] [Post-call metrics](https://docs.weya.ai/single-prompt/step4.md)
>
> Define what goes into `call_analysis`.

> [card] [Webhooks API](https://docs.weya.ai/api-reference/Webhooks/getWebhooks.md)
>
> Create, list, update and delete webhooks.


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