Analytics
Returns WhatsApp analytics for a time range: total conversations, how many the AI handled and how many were referred to a person, outcomes, first response time for the agent and for your team, totals per number, and template results. Add inbox_id to look at one number.
curl --request POST \
--url 'https://api.nabrah.ai/api/ext/insights/whatsapp' \
--header 'X-API-Key: <your-api-key>' \
--header 'Content-Type: application/json' \
--data '{
"start": "2026-11-01T00:00:00+03:00",
"end": "2026-11-12T23:59:59+03:00",
"tz": "Asia/Riyadh"
}'{
"total": 0,
"ai_handled": 0,
"referred": 0,
"outcomes": {
"referred": 0,
"resolved": 0,
"in_progress": 0,
"not_handled": 0
},
"first_response_agent": {
"median_seconds": 0,
"p90_seconds": 0,
"count": 0
},
"first_response_team": {
"median_seconds": 0,
"count": 0
},
"numbers": [
{
"inbox_id": "00000000-0000-4000-8000-000000000000",
"name": "string",
"phone": "string",
"agent_id": "00000000-0000-4000-8000-000000000000",
"agent_name": "string",
"refer_to_human": false,
"conversations": 0,
"resolved": 0,
"referred": 0
}
],
"templates": [
{
"template_name": "string",
"language": "string",
"sent": 0,
"delivered": 0,
"read": 0,
"failed": 0
}
],
"unavailable": [
"string"
]
}These are the numbers shown on the Insights pages of the dashboard, for the same range and filters.
Counts follow the access of the member who created the API key. A key made by a member limited to some WhatsApp numbers only sees those numbers.
unavailableLists the parts that could not be loaded this time (for example "whatsapp" or "tickets"). Those parts come back empty; retry later for them.
CachingResults are cached for 15 minutes, or 1 minute when the range includes today.
Errors422 when the range or time zone is not valid. 503 with insights_timeout when the query takes too long; try a shorter range.
X-API-KeystringheaderrequiredYour workspace API key. Create one in the dashboard under API keys.
startstring (ISO 8601)requiredStart of the range, with a time zone offset, e.g. 2026-11-01T00:00:00+03:00.
endstring (ISO 8601)requiredEnd of the range. Must be after start, at most 366 days later, and not after the end of today in tz.
tzstringrequiredIANA time zone used for daily and hourly buckets, e.g. Asia/Riyadh.
agent_idstring (UUID)Only count conversations handled by this agent.
channelstring"all" (default), "voice" or "whatsapp".
inbox_idstring (UUID)Only count this WhatsApp number, from GET /api/ext/omni_v2/whatsapp/inboxes.
{
"start": "2026-11-01T00:00:00+03:00",
"end": "2026-11-12T23:59:59+03:00",
"tz": "Asia/Riyadh"
}Successful Response
application/json
Validation Error
application/json