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

# Call fields and webhooks

> Save what callers tell the agent to the contact record, and send call events to your own system.

When a call ends, the voice agent reads the transcript, saves what it learned to the contact record and writes a short summary of the call. With webhooks, your own system hears about each call as it starts, ends and is analysed.

## Custom fields

### How it works

[Custom fields](https://docs.newlead.ai/guide/conversations/custom-fields.md) are the customer data the agent handles on every call. You declare them in the voice agent's **Custom fields** panel, and they do two jobs:

* **On the way in:** values already on the contact record are available to the agent during the call. Write a field's name in double braces in the instructions or the greeting, for example "Hi `{{name}}`", and the agent says the value. **When it isn't known** fills that slot while the record doesn't have the value. It's never saved to the record or sent in a webhook.
* **On the way out:** after the call, the agent fills in the fields it worked out from the transcript and writes the summary shown as **What they asked for** in the call. A new value replaces the old one only when the agent is confident about it, and a field the caller didn't mention keeps its value.

Fields come in two groups. **Data** holds values such as a budget or an address. **Tags** group contacts by a value, such as the city, and work as a filter in **Conversations**. See [Tags](https://docs.newlead.ai/guide/conversations/tags.md).

### Set it up

**1. Open the panel**

Go to **AI Agents**, open the voice agent and select **Custom fields**.

**2. Add a field**

Select **Add field**, or **Add tag** for a tag. Fill **Name**, the key on the contact record, and **What it is**, which the agent reads to recognise the value. "How many bedrooms they are looking for" works better than "bedrooms".

**3. Ask for it in the instructions**

The agent won't ask for any of this on its own. In **Instructions and greeting**, ask for the value using the same name you gave the field.

**4. Save**

Save the panel. The next real call fills the fields.

### Good to know

* Without custom fields, calls get no summary and no fields, and the **Variables collected** webhook event isn't sent.
* A field called `caller_name`, `lead_name`, `contact_name` or `name` also sets the lead's name, if the lead doesn't have one yet.
* An agent can have up to 20 fields. Names use lowercase letters, digits and underscores, start with a letter, and some are reserved.
* Test calls don't fill fields.
* In a web call, the fields of the text agent behind the chat are used, plus any of the voice agent's fields that the text agent doesn't have.
* You can also send values when you place a call from the API, and the agent uses them during the call. See [Place a call](https://docs.newlead.ai/messages-and-calls.md#place-a-call).

## Webhooks

### How it works

A webhook endpoint is a URL of yours that receives the calls of one voice agent. Each delivery is signed with a secret, so your system can check it came from the platform. A voice agent sends four events:

| Event | When it's sent |
| - | - |
| **Call started** | A call starts. |
| **Call rejected** | A call is rejected before the agent answers, for example for lack of balance. |
| **Call ended** | A call ends. It carries the transcript and a link to the recording. |
| **Variables collected** | The fields from a call are ready, shortly after it ends. |

### Set it up

**1. Open the panel**

Go to **AI Agents**, open the voice agent and select **Webhooks**.

**2. Create the endpoint**

Select **New endpoint**. Fill **URL**, which must start with `https://`, an optional **Description**, and pick the **Events** you want.

**3. Copy the secret**

Select **Create endpoint** and copy the secret. It's shown only once: without it you'll need to delete the endpoint and create a new one.

**4. Send a test**

Use the send icon on the endpoint's row to queue a test delivery, then **Show deliveries** to see **Recent deliveries** and their result.

### Good to know

* Each agent can have up to 3 active endpoints.
* After 20 failed deliveries in a row, the endpoint pauses itself and shows **Paused**. Switching **Active** back on resets the count, but the events it missed aren't sent again.
* Test calls from the agent's page don't send events.
* What each event contains, how to verify the signature and how retries work are in the developer docs: [Webhook events](https://docs.newlead.ai/webhook-events.md), [Webhooks](https://docs.newlead.ai/webhooks.md) and [Verify webhook signatures](https://docs.newlead.ai/webhook-signatures.md).
* With n8n, the **Newlead Trigger** node creates the endpoint for you. See [n8n](https://docs.newlead.ai/n8n.md#receive-events).

## Related

* [Calls](https://docs.newlead.ai/guide/voice/calls.md)
* [Continue a call on WhatsApp](https://docs.newlead.ai/guide/voice/call-to-whatsapp.md)
* [Voice agents](https://docs.newlead.ai/guide/voice/voice-agents.md)


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