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 name or phone number
account_idstringFilter by WhatsApp account
{
"status": "success",
"data": {
"items": [
{
"id": "uuid",
"phone_number": "+1234567890",
"name": "John Doe",
"profile_name": "John",
"avatar_url": "https://...",
"account_id": "uuid",
"assigned_to": "uuid",
"last_message_at": "2024-01-01T12:00:00Z",
"created_at": "2024-01-01T00:00:00Z"
}
],
"total": 100,
"page": 1,
"limit": 20,
"total_pages": 5
}
}

Retrieve a single contact by ID.

Terminal window
GET /api/contacts/{id}
{
"status": "success",
"data": {
"id": "uuid",
"phone_number": "+1234567890",
"name": "John Doe",
"profile_name": "John",
"avatar_url": "https://...",
"account_id": "uuid",
"assigned_to": "uuid",
"metadata": {
"custom_field": "value"
},
"last_message_at": "2024-01-01T12:00:00Z",
"created_at": "2024-01-01T00:00:00Z"
}
}

Create a new contact.

Terminal window
POST /api/contacts
{
"phone_number": "+1234567890",
"name": "John Doe",
"account_id": "uuid",
"metadata": {
"custom_field": "value"
}
}
{
"status": "success",
"data": {
"id": "uuid",
"phone_number": "+1234567890",
"name": "John Doe",
"account_id": "uuid",
"created_at": "2024-01-01T00:00:00Z"
}
}

Update an existing contact.

Terminal window
PUT /api/contacts/{id}
{
"name": "John Smith",
"metadata": {
"custom_field": "updated_value"
}
}
{
"status": "success",
"data": {
"id": "uuid",
"phone_number": "+1234567890",
"name": "John Smith",
"metadata": {
"custom_field": "updated_value"
},
"updated_at": "2024-01-01T12:00: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": "uuid"
}

To unassign a contact, set user_id to null:

{
"user_id": null
}
{
"status": "success",
"data": {
"id": "uuid",
"assigned_to": "uuid",
"updated_at": "2024-01-01T12:00:00Z"
}
}

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