Overview
Retrieve conversations with a contact, automatically grouped into conversation threads. Messages are intelligently organized by time gaps and context, making it easy to understand the flow of communication. This endpoint is ideal when you want to display conversation history in a chat-like interface with messages grouped into distinct conversation sessions.Use Cases
- Chat Interface: Display conversation history in a threaded chat UI
- Conversation Analysis: Analyze conversation patterns and engagement
- Context Building: Get conversation context for AI or agent responses
- Support Ticket View: Show conversation threads for support tickets
- Activity Timeline: Display communication timeline with grouped sessions
- Export Conversations: Export conversation history for records
Authentication
This endpoint requires authentication using an API key. Include your API key in the request header:Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
aiContactId | string (UUID) | Yes | Unique identifier of the contact |
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
daysBack | number | No | Number of days back to retrieve conversations |
Days Back: If not provided, retrieves all conversations. Use this to limit
results to recent conversations only.
Response Structure
Returns an array of conversation objects. Each conversation represents a grouped thread of messages:Conversation Object
Field | Type | Description |
---|---|---|
conversation_id | number | Unique numeric identifier for the conversation |
conversation_date | string (ISO) | Timestamp when the conversation started |
stage_id | string (UUID) | Pipeline stage during this conversation |
conversation_channel | string (UUID) | Channel/phone identifier |
platform | string | Communication channel (whatsapp, web-whatsapp, etc.) |
phone_number_channel | string | Your WhatsApp phone number (with +) |
conversation_detail | array | Array of message objects in this conversation |
Message Object
Each message in theconversation_detail
array contains:
Field | Type | Description |
---|---|---|
id | string | Unique message identifier (numeric string) |
body | string | Message content/text |
created_at | string (ISO) | Message timestamp |
direction | string | βinboundβ (from contact) or βoutboundβ (to contact) |
platform_contact_id | string (UUID) | Platform-specific contact identifier |
status | string | Message status (read, sent, delivered) |
type | string | Message type (text, image, video, reaction, etc.) |
user_id | string | null | Agent who sent the message (if outbound by human) |
assistant_id | string | null | AI assistant that sent the message (if AI-generated) |
Example Request
Get All Conversations
Get Last 7 Days of Conversations
Example Response
Common Use Cases
1. Display Chat Interface
2. Get Recent Conversations Only
3. Analyze Conversation Patterns
4. Export Conversation History
Key Features
Agent vs AI Detection
This endpoint provides visibility into who sent each outbound message:user_id
present: Message was sent by a human agentassistant_id
present: Message was sent by AI assistant- Both null: Message sent by customer (inbound)
Message Types
The endpoint supports various message types:text
: Regular text messagesimage
: Image messagesvideo
: Video messagesaudio
: Audio/voice messagesreaction
: Emoji reactions to messagesdocument
: File/document attachments
How Conversations Are Grouped
Messages are automatically grouped into conversations based on:- Time Gaps: Messages separated by long periods are in different conversations
- Context Changes: Stage changes or significant topic shifts create new conversations
- Chronological Order: Conversations are ordered by most recent first
conversation_id
(numeric) that you can use for reference.
When to Use This Endpoint
β Use/conversations
when:
- Building a chat interface with conversation threads
- You want messages automatically grouped
- Displaying conversation history to users
- Analyzing conversation patterns
- Exporting readable conversation transcripts
- You need all messages in a flat list β Use
/v2/{aiContactId}/messages
- You need pagination for large message sets β Use
/v2/{aiContactId}/messages
- You want to process messages sequentially β Use
/v2/{aiContactId}/messages
Error Responses
Status Code | Description |
---|---|
401 | Unauthorized - Invalid or missing API key |
404 | Not Found - Contact not found |
500 | Internal Server Error - Something went wrong |
Performance Considerations
- All Messages: Without
daysBack
, returns all conversations (can be large) - Use daysBack: For better performance, limit to recent conversations
- No Pagination: All matching conversations returned at once
- Grouped Data: Response is larger than flat message list due to grouping
Related Endpoints
- GET /api/public/contact/v2//messages - Get messages with pagination (recommended for large datasets)
- GET /api/public/contact//info - Get contact info
- POST /api/public/contact//update-metadata - Update contact metadata
Comparison with Messages Endpoint
Feature | Conversations (This) | Messages v2 |
---|---|---|
Structure | Grouped: conversation_detail arrays | Flat list of messages |
Grouping Logic | Auto-grouped by time gaps & context | No grouping |
Pagination | No pagination | Required (page parameter) |
Time Filtering | daysBack parameter | Via page iteration |
Agent/AI Detection | β
user_id & assistant_id fields | Limited info |
Conversation Context | β
conversation_id , stage_id per thread | No conversation grouping |
Response Size | Larger (nested structure) | Smaller (flat structure) |
Best For | Chat UI, conversation threads | Bulk processing, exports, analytics |
Field Names | conversation_detail , direction lowercase | Different structure |
Message Order | Within conversations | Global chronological |
Headers
API key required to authorize the request
Path Parameters
ID of the AI contact
Query Parameters
Number of days back to retrieve conversations
Response
Conversations retrieved successfully.