Retrieve Conversation Messages
Retrieves all messages from a specific customer support conversation.
Endpoint
GET /api/agents/customerSupport/conversations/messagesQuery Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversation_id | string | Yes | ID of the conversation whose messages to retrieve |
site_id | string | Yes | ID of the site to which the conversation belongs |
limit | number | No | Maximum number of messages to return (default: 50) |
offset | number | No | Number of messages to skip (for pagination, default: 0) |
Example Request
GET /api/agents/customerSupport/conversations/messages?conversation_id=8e7d5b3a-2c19-4f5e-9d08-87e31b409e26&site_id=9be0a6a2-5567-41bf-ad06-cb4014f0faf2Try It
API Tester
Este componente te permite probar diferentes endpoints de API.
Response
Success Response
{
"success": true,
"data": {
"messages": [
{
"id": "a1b2c3d4-e5f6-7a8b-9c0d-1e2f3a4b5c6d",
"content": "Hello, I'm having an issue with my recent order #12345. It shows as shipped but I haven't received it yet.",
"role": "user",
"created_at": "2023-10-15T18:22:45Z",
"conversation_id": "8e7d5b3a-2c19-4f5e-9d08-87e31b409e26",
"metadata": {
"source": "chat_widget"
}
},
{
"id": "b2c3d4e5-f6a7-8b9c-0d1e-2f3a4b5c6d7e",
"content": "I'm sorry to hear about the issue with your order. Let me check the status for you right away.",
"role": "assistant",
"created_at": "2023-10-15T18:23:15Z",
"conversation_id": "8e7d5b3a-2c19-4f5e-9d08-87e31b409e26",
"metadata": null
},
{
"id": "c3d4e5f6-a7b8-9c0d-1e2f-3a4b5c6d7e8f",
"content": "Thank you for your patience. I've checked your order and it appears it was shipped on October 12th. According to the tracking information, it should be delivered by tomorrow.",
"role": "assistant",
"created_at": "2023-10-15T18:25:30Z",
"conversation_id": "8e7d5b3a-2c19-4f5e-9d08-87e31b409e26",
"metadata": null
},
{
"id": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f9a",
"content": "Can you send me the tracking number so I can monitor it?",
"role": "user",
"created_at": "2023-10-15T18:27:10Z",
"conversation_id": "8e7d5b3a-2c19-4f5e-9d08-87e31b409e26",
"metadata": {
"source": "chat_widget"
}
},
{
"id": "e5f6a7b8-c9d0-1e2f-3a4b-5c6d7e8f9a0b",
"content": "Your order #12345 has been shipped and should arrive within 2-3 business days. You can track it using the link I just sent to your email.",
"role": "assistant",
"created_at": "2023-10-15T18:30:12Z",
"conversation_id": "8e7d5b3a-2c19-4f5e-9d08-87e31b409e26",
"metadata": {
"tracking_number": "USPS1234567890",
"email_sent": true
}
}
],
"pagination": {
"total": 5,
"page": 1,
"limit": 50,
"pages": 1
}
}
}Error Response
{
"success": false,
"error": {
"code": "INVALID_REQUEST",
"message": "conversation_id is required"
}
}Error Codes
| Code | Description |
|---|---|
INVALID_REQUEST | The request parameters are invalid (missing required fields or invalid UUID format) |
NOT_FOUND | The conversation was not found or does not belong to the specified site |
DATABASE_ERROR | Error occurred when querying the database |
INTERNAL_SERVER_ERROR | Internal system error occurred |
Notes
- This endpoint provides a paginated list of messages for a specific conversation
- Messages are ordered chronologically (by created_at) in ascending order
- Both the conversation_id and site_id parameters are required for security reasons
- Use the pagination parameters (limit and offset) to navigate through large message histories
Code Examples
JavaScript/Node.js
const fetchConversationMessages = async (conversationId, siteId) => {
const response = await fetch(`/api/agents/customerSupport/conversations/messages?conversation_id=${conversationId}&site_id=${siteId}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
}
});
return await response.json();
};Python
import requests
def fetch_conversation_messages(conversation_id, site_id, limit=50, offset=0):
params = {
'conversation_id': conversation_id,
'site_id': site_id,
'limit': limit,
'offset': offset
}
response = requests.get(
'https://your-api-base-url/api/agents/customerSupport/conversations/messages',
params=params
)
return response.json()Last updated on