Skip to content

Contacts

Contacts represent WhatsApp users you communicate with. Each contact stores their phone number, profile information, and conversation history.

Retrieve a paginated list of contacts.

Terminal window
GET /api/contacts
ParameterTypeDescription
pageintegerPage number (default: 1)
limitintegerItems per page (default: 20, max: 100)
searchstringSearch by profile name or phone number
tagsstringFilter by tags (comma-separated, matches contacts with any of the tags)
{
"status": "success",
"data": {
"contacts": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"phone_number": "1234567890",
"name": "John Doe",
"profile_name": "John Doe",
"avatar_url": "https://...",
"status": "active",
"tags": ["vip", "support"],
"metadata": {
"plan": "premium",
"company": "Acme Corp"
},
"last_message_at": "2024-01-01T12:00:00Z",
"last_message_preview": "Hello there!",
"unread_count": 0,
"assigned_user_id": "880e8400-e29b-41d4-a716-446655440000",
"whatsapp_account": "default_account",
"last_inbound_at": "2024-01-01T11:59:00Z",
"service_window_open": true,
"marketing_opt_out": false,
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T12:00:00Z"
}
],
"total": 100,
"page": 1,
"limit": 20
}
}

Retrieve a single contact by ID.

Terminal window
GET /api/contacts/{id}
{
"status": "success",
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"phone_number": "1234567890",
"name": "John Doe",
"profile_name": "John Doe",
"avatar_url": "https://...",
"status": "active",
"tags": ["vip", "support"],
"metadata": {
"plan": "premium",
"company": "Acme Corp"
},
"last_message_at": "2024-01-01T12:00:00Z",
"last_message_preview": "Hello there!",
"unread_count": 0,
"assigned_user_id": "880e8400-e29b-41d4-a716-446655440000",
"whatsapp_account": "default_account",
"last_inbound_at": "2024-01-01T11:59:00Z",
"service_window_open": true,
"marketing_opt_out": false,
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T12:00:00Z"
}
}

Create a new contact.

Terminal window
POST /api/contacts
FieldTypeRequiredDescription
phone_numberstringYesPhone number of the contact
profile_namestringNoProfile/display name of the contact
whatsapp_accountstringNoDefault WhatsApp account name
tagsarrayNoArray of tags for the contact
metadataobjectNoCustom metadata fields
{
"phone_number": "1234567890",
"profile_name": "John Doe",
"whatsapp_account": "default_account",
"tags": ["vip"],
"metadata": {
"plan": "premium"
}
}
{
"status": "success",
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"phone_number": "1234567890",
"name": "John Doe",
"profile_name": "John Doe",
"avatar_url": "",
"status": "active",
"tags": ["vip"],
"metadata": {
"plan": "premium"
},
"last_message_at": null,
"last_message_preview": "",
"unread_count": 0,
"assigned_user_id": null,
"whatsapp_account": "default_account",
"last_inbound_at": null,
"service_window_open": false,
"marketing_opt_out": false,
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}
}

Update an existing contact.

Terminal window
PUT /api/contacts/{id}
FieldTypeDescription
profile_namestringUpdated profile/display name
whatsapp_accountstringUpdated default WhatsApp account name
tagsarrayUpdated array of tags
metadataobjectUpdated custom metadata object
assigned_user_iduuidAssign to a user ID
clear_assigned_agentbooleanSet to true to unassign
{
"profile_name": "John Smith",
"tags": ["vip", "churn-risk"],
"metadata": {
"plan": "premium",
"custom_field": "updated_value"
}
}
{
"status": "success",
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"phone_number": "1234567890",
"name": "John Smith",
"profile_name": "John Smith",
"avatar_url": "",
"status": "active",
"tags": ["vip", "churn-risk"],
"metadata": {
"plan": "premium",
"custom_field": "updated_value"
},
"last_message_at": "2024-01-01T12:00:00Z",
"last_message_preview": "Hello there!",
"unread_count": 0,
"assigned_user_id": null,
"whatsapp_account": "default_account",
"last_inbound_at": "2024-01-01T11:59:00Z",
"service_window_open": true,
"marketing_opt_out": false,
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T12:05:00Z"
}
}

Delete a contact and all associated data.

Terminal window
DELETE /api/contacts/{id}
{
"status": "success",
"data": null
}

Assign a contact to a team member.

Terminal window
PUT /api/contacts/{id}/assign
{
"user_id": "880e8400-e29b-41d4-a716-446655440000"
}

To unassign a contact, set user_id to null:

{
"user_id": null
}
{
"status": "success",
"data": {
"message": "Contact assigned successfully",
"assigned_user_id": "880e8400-e29b-41d4-a716-446655440000"
}
}

Mark all incoming messages from a contact as read and clear unread count.

Terminal window
POST /api/contacts/{id}/mark-read
{
"status": "success",
"data": {
"status": "ok"
}
}

The metadata field is a freeform JSON object that can hold any structured data. It is displayed in the Contact Info panel alongside tags and session data.

Different value types are rendered differently in the panel:

TypeDisplay
String, numberKey-value row
BooleanYes / No badge
ObjectCollapsible section with key-value rows
Array of objectsCollapsible table with column headers
Array of primitivesInline badges
{
"metadata": {
"plan": "premium",
"age": 30,
"active": true,
"address": {
"city": "Mumbai",
"state": "Maharashtra",
"zip": "400001"
},
"orders": [
{ "id": "ORD-001", "amount": 1500, "status": "delivered" },
{ "id": "ORD-002", "amount": 2300, "status": "pending" }
],
"interests": ["fitness", "tech", "travel"]
}
}

This renders as:

  • General section — plan, age, and active as key-value rows (boolean shown as a badge)
  • Address section — collapsible key-value pairs for city, state, zip
  • Orders section — collapsible table with Id, Amount, Status columns
  • Interests section — inline badges: fitness, tech, travel

The panel supports one level of nesting. Top-level keys are organized as follows:

Top-level valueRendered as
Primitive (string, number, boolean)Row in the General section
ObjectIts own collapsible section with key-value rows
Array of objectsIts own collapsible section with a table
Array of primitivesIts own collapsible section with badges

Values inside a nested object or array are always displayed as flat text. If a nested object contains another object, the inner value is shown as a raw JSON string. For example:

{
"metadata": {
"address": {
"city": "Mumbai",
"location": { "lat": 19.07, "lng": 72.87 }
}
}
}

Here city displays as Mumbai, but location displays as {"lat":19.07,"lng":72.87}.

Retrieve chatbot session data for a contact, including collected variables and panel configuration.

Terminal window
GET /api/contacts/{id}/session-data
{
"status": "success",
"data": {
"session_id": "uuid",
"flow_id": "uuid",
"flow_name": "Customer Support Flow",
"session_data": {
"customer_name": "John Doe",
"customer_email": "john@example.com",
"order_id": "ORD-12345",
"order_status": "shipped"
},
"panel_config": {
"sections": [
{
"id": "customer",
"label": "Customer Info",
"columns": 1,
"collapsible": true,
"default_collapsed": false,
"order": 1,
"fields": [
{"key": "customer_name", "label": "Name", "order": 1},
{"key": "customer_email", "label": "Email", "order": 2}
]
},
{
"id": "order",
"label": "Order Details",
"columns": 2,
"collapsible": true,
"default_collapsed": true,
"order": 2,
"fields": [
{"key": "order_id", "label": "Order ID", "order": 1},
{"key": "order_status", "label": "Status", "order": 2}
]
}
]
}
}
}
FieldTypeDescription
session_iduuidThe chatbot session ID
flow_iduuidThe flow that collected the data
flow_namestringName of the flow
session_dataobjectKey-value pairs of collected variables
panel_configobjectPanel display configuration from the flow