Add recipients
POST https://api.diska.ai/v1/campaigns/{campaign_id}/recipients
Scope: campaigns:write
Repeated numbers and repeated external_id values are skipped, so you can retry the request. Numbers on the do-not-call list become excluded. The response counts what was added, duplicated, excluded and invalid (with each one's reason).
Parameters
Path
| Name | Type | Required | Description |
|---|---|---|---|
campaign_id | string | Yes | The campaign's ID. |
Request body
application/json
| Field | Type | Required | Description |
|---|---|---|---|
recipients | array | Yes | The recipients (1 to 1000). |
recipients[].phone | string | Yes | Angolan mobile. 3 to 40 characters. |
recipients[].name | string | null | No | Name, so the agent can address the person. Up to 120 characters. |
recipients[].email | string | null | No | Email. Up to 254 characters. |
recipients[].variables | object | No | Call variables. |
recipients[].external_id | string | null | No | Your own ID; a repeat is skipped. Up to 120 characters. |
{
"recipients": [
{
"phone": "+244923000000",
"name": "Ana Silva",
"external_id": "crm-1042",
"variables": {
"consulta": "sexta, 10h"
}
},
{
"phone": "+244924000000",
"name": "João Neto",
"external_id": "crm-1043"
}
]
}
Examples
curl -X POST "https://api.diska.ai/v1/campaigns/<campaign_id>/recipients" \
-H "Authorization: Bearer $DISKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"recipients":[{"phone":"+244923000000","name":"Ana Silva","external_id":"crm-1042","variables":{"consulta":"sexta, 10h"}},{"phone":"+244924000000","name":"João Neto","external_id":"crm-1043"}]}'
import os
import requests
response = requests.post(
"https://api.diska.ai/v1/campaigns/<campaign_id>/recipients",
headers={"Authorization": f"Bearer {os.environ['DISKA_API_KEY']}"},
json={
"recipients": [{
"phone": "+244923000000",
"name": "Ana Silva",
"external_id": "crm-1042",
"variables": {
"consulta": "sexta, 10h",
},
}, {
"phone": "+244924000000",
"name": "João Neto",
"external_id": "crm-1043",
}],
},
timeout=30,
)
response.raise_for_status()
print(response.json())
// Node.js 18 or later, in a .mjs file
const response = await fetch('https://api.diska.ai/v1/campaigns/<campaign_id>/recipients', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.DISKA_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"recipients": [
{
"phone": "+244923000000",
"name": "Ana Silva",
"external_id": "crm-1042",
"variables": {
"consulta": "sexta, 10h"
}
},
{
"phone": "+244924000000",
"name": "João Neto",
"external_id": "crm-1043"
}
]
})
})
if (!response.ok) throw new Error(`${response.status} ${await response.text()}`)
console.log(await response.json())
<?php
$ch = curl_init('https://api.diska.ai/v1/campaigns/<campaign_id>/recipients');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('DISKA_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'recipients' => [[
'phone' => '+244923000000',
'name' => 'Ana Silva',
'external_id' => 'crm-1042',
'variables' => [
'consulta' => 'sexta, 10h',
],
], [
'phone' => '+244924000000',
'name' => 'João Neto',
'external_id' => 'crm-1043',
]],
]),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
if ($status >= 400) {
throw new RuntimeException("HTTP $status: $body");
}
print_r(json_decode($body, true));
Try it
Send the request from this page, with your key. The key stays on this page: it is not stored and is only sent to api.diska.ai. Use a test key with the fewest scopes you need.
https://api.diska.ai/v1/campaigns/{campaign_id}/recipientsResponse 200
| Field | Type | Description |
|---|---|---|
added | integer | Added. |
duplicates | integer | Skipped as duplicates. |
excluded | integer | On the do-not-call list. |
invalid | array | Refused, with the reason. |
invalid[].row | integer | Position in the request (from 1). |
invalid[].phone | string | Number sent. |
invalid[].reason | string | Reason. |
warnings | array | Added with warnings (for example, variables dropped). |
warnings[].row | integer | Position in the request (from 1). |
warnings[].phone | string | Number sent. |
warnings[].reason | string | Reason. |
total | integer | Campaign recipients after the request. |
{
"added": 0,
"duplicates": 0,
"excluded": 0,
"invalid": [
{
"row": 0,
"phone": "…",
"reason": "…"
}
],
"warnings": [
{
"row": 0,
"phone": "…",
"reason": "…"
}
],
"total": 1
}
Errors
| Code | When |
|---|---|
404 | Campaign not found. |
409 | The campaign already ended or was cancelled. |
Errors common to every endpoint (401, 403, 422, 429 and 5xx) are in Errors.
Get a campaign
The campaign with its indicators (stats) and, when it is waiting, the reason (waiting_reason) and the next window (next_window_at).
List recipients
The recipients with their state, the call outcome (outcome), the attempts and the call's call_session_id (the id of GET /v1/calls/{call_id}).

