Contact Activity
curl "https://api.whatbot.in/public/v1/contacts/whatsapp-activity?source_ref=crm-lead-4821" \ -H "X-API-Key: wa_live_xxx"Query parameters
Section titled “Query parameters”| Field | Type | Required | Description |
|---|---|---|---|
| source_ref | string | One of source_ref / phone | The source_ref you set on the contact with POST /contacts. Preferred — it works for contacts pushed without a phone number. |
| phone | string | One of source_ref / phone | The contact’s number, any format. Matched exactly. Works even for a number that was never pushed as a contact but has conversations. |
| lead_id | string | Your own id for the record. Echoed back as lead_id, for correlating the response. |
Passing neither returns 422. A source_ref with no matching contact is not an
error: you get 200 with every section empty, so you can render “no WhatsApp activity
yet” without special-casing it.
Response
Section titled “Response”{ "lead_id": "crm-lead-4821", "contact": { "id": "4f1c...", "phone": "+919876543210", "name": "Ravi Kumar", "attributes": { "city": "Chennai" }, "tags": ["gold"], "opt_in": "opted_in" }, "summary": { "conversations": 1, "flow_runs": 2, "ai_sessions": 1, "forms_filled": 1, "broadcasts_received": 4, "last_message_at": "2026-09-15T10:03:12+00:00" }, "conversations": [ { "id": "c9e6f0f7-...", "phone_number": "919876543210", "contact_name": "Ravi Kumar", "status": "open", "last_message_at": "...", "phone_number_id": "1066..." } ], "flows": [ { "execution_id": "7d1e...", "flow_name": "Site visit booking", "status": "completed", "responses": [ { "question": "...", "answer": "..." } ], "variables": { } } ], "ai_sessions": [ { "session_id": "...", "agent_name": "Sales assistant", "status": "...", "turns": [ { "user_text": "...", "agent_text": "..." } ] } ], "forms": [ { "response_id": "...", "form_name": "Site visit", "submitted_at": "...", "answers": { } } ], "broadcasts": [ { "broadcast_name": "Diwali offer", "template_name": "diwali_offer", "status": "read", "sent_at": "..." } ], "truncated": { "flows": false, "ai_sessions": false, "forms": false, "broadcasts": false }}| Section | What it holds | Cap |
|---|---|---|
contact | The contact record. opt_in is opted_in, opted_out or pending. When there is no contact record, id, name and opt_in are null and attributes/tags are empty; on a phone lookup, phone still echoes the number you passed. | — |
conversations | The contact’s conversations, one per business number they’ve talked to. | 25 |
flows | Flow runs, with the questions asked and the answers given. | 25 |
ai_sessions | AI agent conversations, with their turns. | 10 sessions, 50 turns in all |
forms | Submitted WhatsApp forms and their answers. | 25 |
broadcasts | Broadcasts sent to the contact, with delivery status. | 50 |
summary | Counts of the above, plus the latest last_message_at. | — |
truncated | true for a section that reached its cap — there may be more history than shown. | — |
Each section is the most recent entries first. lead_id is the value you passed, or
a lead linked to one of the contact’s conversations.
Errors
Section titled “Errors”| Status | Cause |
|---|---|
401 | Missing/invalid API key |
422 | Neither a source_ref nor a valid phone was given |