Skip to main content
This quickstart launches an outbound calling campaign entirely through the weya API. You look up your IDs, register a webhook for call results, upload your contacts as a campaign and start calling. When each call ends, weya posts its result to your webhook.

Before you start

You need three things, set up once in the dashboard: You also need a public HTTPS endpoint that accepts POST requests, to receive call results. For testing, a request inspector such as webhook.site works.
1

Get your user ID

Some campaign endpoints take the ID of the user that owns the key.
Save data._id as USER_ID.
2

Find the phone number to call from

List your numbers and pick one whose outboundAgentName is the agent you want to make the calls.
Response (trimmed)
Save that number’s _id as PHONE_ID. The campaign calls from this number, and the outbound agent assigned to it handles every call.
3

Register a webhook for call results

Save data._id as WEBHOOK_ID. If you set bearerToken, weya sends it as Authorization: Bearer <token> with every delivery, so your endpoint can reject anything else.
4

Upload your contacts as a campaign

Create a CSV with a phoneNumber column plus one column for each variable your agent’s prompt uses:
contacts.csv
Upload it to create the campaign, with the calling schedule and the webhook attached:
Save data.batch[0]._id as BATCH_ID and data.uuid as UPLOAD_ID.
If any row is invalid, the whole upload is rejected and the response lists each bad row with its reason. Fix the rows, or add --form 'type="true"' to skip invalid rows and upload the rest.
5

Start calling

The campaign is queued straight away. Calls are placed only on the allowed days, inside the calling window, in the campaign’s timezone. Outside that window the campaign waits and starts calling when the window opens.
6

Receive the results

About five minutes after each call ends, once the recording and the transcript analysis are ready, weya posts the result to your webhook:
Respond with any 2xx status. See Call result webhooks for every field and how retries work.
You now have a campaign that dials your contacts within its calling window, retries unanswered contacts up to three times, and sends every result to your system.

Add contacts as they arrive

If your contacts come from your own system over time instead of in one file, create the campaign once with Create Campaign and send contacts to it with Add Calls to Campaign. Each object needs phoneNumber, plus the variables your agent uses. Calling starts automatically after the contacts are added, so you don’t call Start Campaign for them.
Create Campaign doesn’t take a webhook. To attach one to a campaign created this way, pause it and set pushingCrms with Update Campaign. Only calls that end after the update are sent.

Control a running campaign

Next steps

Core concepts

What happens to a contact between upload and result.

Call result webhooks

Payload fields, delivery timing and retries.