Get contacts by status
Contact Analytics
Get contacts by status
Returns contacts filtered by status and calculates how long they have been waiting (from last_inbound_message.created_at until now). Adds a “waiting_time” field that represents (in seconds) how long that contact has been waiting. Sorted by waiting_time descending (longest wait first).
GET
Get contacts by status
Overview
Get contacts filtered by their conversation status (unattended, attended, ai-attended, ai-away) with calculated waiting times. This endpoint helps you identify contacts that need attention and prioritize responses based on how long they’ve been waiting. Perfect for building priority queues, monitoring SLAs, and ensuring no customer is left waiting too long.Use Cases
- Priority Queue: Display contacts sorted by waiting time
- SLA Monitoring: Track contacts approaching SLA thresholds
- Workload Distribution: Identify unattended conversations for assignment
- Response Urgency: Find contacts waiting longest for response
- Status Dashboard: Monitor conversations by status
- Customer Service Quality: Ensure timely responses to all customers
Authentication
This endpoint requires authentication using an API key. Include your API key in the request header:Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
page | number | Yes | Page number (starts at 1) |
status | string | Yes | Contact status to filter by |
pipelineId | string | No | Filter by specific pipeline UUID |
Status Values
| Status | Description |
|---|---|
unattended | New messages not yet attended by team member |
attended | Currently being handled by human team member |
ai-attended | Being handled by AI assistant |
ai-away | AI temporarily unavailable, waiting for human handoff |
Response Structure
| Field | Type | Description |
|---|---|---|
data | array | Array of contact objects with waiting times |
total | number | Total number of contacts matching criteria |
Contact Object
| Field | Type | Description |
|---|---|---|
id | string (UUID) | Contact’s unique identifier |
name | string | Contact’s name |
created_at | string (ISO) | Contact creation timestamp |
platform | string | Communication channel |
chat_status | string | Current chat status |
waiting_time | number | Time waiting for response (in seconds) |
active_ticket_v2 | object | null | Active ticket information |
assigned_agents | array | List of assigned team members |
Example Requests
Get Unattended Contacts
Filter by Pipeline
Example Response
Common Use Cases
1. Display Priority Queue
2. SLA Alert System
3. Auto-Assignment Based on Wait Time
4. Status Dashboard
Waiting Time Calculation
Thewaiting_time field is calculated as:
- Unit: Seconds
- Sorted: Longest waiting time first
- Real-time: Calculated at query time
Pagination
- Each page returns up to 50 contacts
- Contacts sorted by waiting_time DESC (longest wait first)
- Use
totalfield to determine total matching contacts
Error Responses
| Status Code | Description |
|---|---|
| 400 | Bad Request - Invalid status or parameters |
| 401 | Unauthorized - Invalid or missing API key |
| 500 | Internal Server Error - Something went wrong |
Important Notes
- Sorted by Urgency: Longest waiting contacts appear first
- Active Tickets: Only shows contacts with active tickets
- Real-time: Waiting time calculated dynamically
- Status Filter Required: Must specify a status
Related Endpoints
- GET /api/analytics/team/snapshot/unanswered-conversations-details - Alternative with more filters
- GET /api/analytics/team/snapshot/agent-distribution - See current workload
- POST /api/public/contact//assign-team-member/ - Assign contacts to team members
Headers
API key
Query Parameters
Page number
Example:
"1"
Available options:
contact_created_at, ticket_created_at, last_inbound_message, last_outbound_message, id Available options:
whatsapp, playground, instagram, webchat, web-whatsapp, messenger, sms Pipeline ID
Example:
"1234567890"
Status
Available options:
unattended, attended, ai-attended, ai-away 