> ## 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.

# How weya works: agents, campaigns, contacts and attempts

> The building blocks of weya (agents, channels, campaigns, contacts and attempts) and what happens to a contact from upload to the final call result.

weya has five building blocks. An **agent** holds the conversation, a **channel** connects it to people, a **campaign** decides who to reach and when, each **contact** in the campaign gets one or more **attempts**, and every attempt ends with a **result**. Knowing how they connect makes the dashboard, the API and the webhook payload much easier to read.

## Building blocks

| Concept | What it is | In the API |
| - | - | - |
| **Agent** | The AI that holds the conversation: prompt, voice, language, knowledge bases, tools and post-call metrics. Voice, video and WhatsApp agents are separate types. | Agent `_id` |
| **Channel** | Where the agent meets people. For voice, a phone number with an **outbound agent** (places calls) and an **inbound agent** (answers calls) assigned. For WhatsApp, a WhatsApp Business number. For video, the join link of a video campaign. | Phone number `_id` |
| **Campaign** | A set of contacts plus the rules for reaching them: calling numbers, allowed days, calling hours, timezone, holiday list, retries and where results go. | `batchId` |
| **Contact** | One person in a campaign, with their phone number and the variables your agent uses (for example `customer_name`). | `call_id`, `lead_data` |
| **Attempt** | One call to a contact. A contact can have several attempts, up to the campaign's retry limit. | `request_uuid` |

> [!NOTE]
>
> The API and the webhook payload use the older word **batch** for a campaign, so a campaign's ID is `batchId` or `batch_id`.

### Campaign types

| Type | Behaviour |
| - | - |
| `outbound` | weya calls the contacts you upload |
| `inbound` | The campaign only receives calls on its numbers. No contact list is needed |
| `mixed` | An outbound campaign whose numbers also accept call-backs |

## The life of a contact

From the moment you add a contact until its final result, a contact moves through the same stages. Step through them below.

Status:

Back
Next

1. Added: the contact is saved with status `pending`.
2. Queued: the contact is placed in the campaign's calling queue (`queued`).
3. Dialled: inside the calling window and when a line is free, weya dials from one of the campaign's calling numbers. The agent assigned to that number holds the conversation.
4. Attempt ends: the provider reports how the call ended (`completed`, `no-answer`, `busy`, `voicemail` and so on).
5. Retry or finish: if another attempt is needed and the contact has attempts left, weya schedules it after the campaign's delay. Otherwise the contact is finished.
6. Result delivered: weya analyses the conversation into your post-call metrics and sends the result to your webhook or CRM about five minutes after the call ends.

### When calls are placed

Calls are placed only when all of these are true:

* Today is one of the campaign's **allowed days** and not on its **holiday list**.
* The current time, in the campaign's **timezone**, is inside its **calling hours**.
* The campaign isn't paused.
* A line is free. Your account has a **concurrency limit**: the number of calls that can be live at the same time. weya sets it for your account. Contacts beyond it wait until a call ends.

Outside the calling window nothing is dialled, and the campaign carries on when the window next opens.

### Retries

A campaign's `retry` setting is the maximum number of attempts per contact (1 to 10), and `delay` is the wait between attempts in minutes (5 to 1440). When an attempt ends without the outcome you need, for example no answer, weya schedules the next attempt for `delay` minutes later, still inside the calling window. The webhook's `next_attempt_after` field tells you when it is due.

While a retry is waiting, the contact's latest attempt still shows the previous call's status. Agents with **Retry on voicemail** turned on also retry calls that reach voicemail.

## Call statuses

Every attempt ends with one of these statuses, sent as `callStatus` in the webhook:

| Status | Meaning |
| - | - |
| `completed` | The call connected and the conversation ended normally |
| `no-answer` | The call rang but nobody picked up |
| `busy` | The line was busy |
| `voicemail` | The call reached voicemail |
| `ivr` | The call reached an automated phone menu |
| `failed` | The call couldn't be connected, for example an invalid number |
| `canceled` | The call was cancelled before it connected |
| `timeout` | The call didn't connect in time |
| `aborted` | The call was never placed, for example because the number is on your Do Not Call list or the account ran out of credit |

## Results

When a call ends, weya analyses the conversation using the agent's [post-call metrics](https://docs.weya.ai/single-prompt/step4.md) and sends a result to every destination attached to the campaign: a [webhook](https://docs.weya.ai/integration/webhooks.md), a [CRM](https://docs.weya.ai/integration/crmintegration.md) or a Google Sheet. The result includes the status, duration, recording, the metric values in `call_analysis`, the contact's variables in `lead_data`, and `call_outcome`.

## Next steps

> [card] [Create a campaign](https://docs.weya.ai/campaigns/createcampaign.md)
>
> Set up calling days, hours and retries in the dashboard.

> [card] [Call result webhooks](https://docs.weya.ai/integration/webhooks.md)
>
> Receive each result in your own system.


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