Get Conversation Detail
Get Conversation Detail
Retrieves detailed message history for a conversation based on the provided conversation_id. The response includes message details such as message_id, user questions, message type, message content, and message creation timestamp.
Request Method
GET
Request URL
https://api-${endpoint}.gptbots.ai/v1/messages
Authentication
See API Overview for authentication details.
Request
Example Request
curl -X GET 'https://api-${endpoint}.gptbots.ai/v1/messages?conversation_id=xxxxxx&user_id=123456&page=1&page_size=100' \
-H 'Authorization: Bearer ${API Key}'
curl -X GET 'https://api-${endpoint}.gptbots.ai/v1/messages?conversation_id=xxxxxx&user_id=123456&page=1&page_size=100' \
-H 'Authorization: Bearer ${API Key}'
Dieser Codeblock im schwebenden Fenster
Request Headers
| Field | Type | Description |
|---|---|---|
| Authorization | Bearer ${API Key} | Use Authorization: Bearer ${API Key} for authentication. Get API key from API Key page. |
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| conversation_id | string | Yes | Conversation identifier. |
| page | int | Yes | Page number to retrieve. |
| page_size | int | Yes | Number of results per page, max 100. |
Response
Example Response
{
"total": 100,
"messages": [
{
"message_id": "645dd86906931c4a9e0ffb1f",
"parent_message_id": "",
"message_type": "ANSWER",
"text": "Hello, I'm a customer service agent, please ask me anything.",
"create_time": 1683871849906
},
{
"message_id": "745dd86906931c4a9e0ffb1f",
"parent_message_id": "645dd86906931c4a9e0ffb1f",
"message_type": "QUESTION",
"text": "What are the features of JPush?",
"create_time": 1683871849906
},
{
"message_id": "845dd86906931c4a9e0ffb1f",
"parent_message_id": "745dd86906931c4a9e0ffb1f",
"message_type": "ANSWER",
"text": "JPush is a powerful platform...",
"create_time": 1683871849906
}
]
}
{
"total": 100,
"messages": [
{
"message_id": "645dd86906931c4a9e0ffb1f",
"parent_message_id": "",
"message_type": "ANSWER",
"text": "Hello, I'm a customer service agent, please ask me anything.",
"create_time": 1683871849906
},
{
"message_id": "745dd86906931c4a9e0ffb1f",
"parent_message_id": "645dd86906931c4a9e0ffb1f",
"message_type": "QUESTION",
"text": "What are the features of JPush?",
"create_time": 1683871849906
},
{
"message_id": "845dd86906931c4a9e0ffb1f",
"parent_message_id": "745dd86906931c4a9e0ffb1f",
"message_type": "ANSWER",
"text": "JPush is a powerful platform...",
"create_time": 1683871849906
}
]
}
Dieser Codeblock im schwebenden Fenster
Successful Response
| Field | Type | Description |
|---|---|---|
| total | string | Total number of messages in conversation. |
| messages | JSON Array | Message details. |
| message_id | string | Unique message ID. |
| parent_message_id | string | ID of parent message. |
| message_type | string | Message type, ANSWER or QUESTION. |
| text | string | Message text. |
| create_time | long | Timestamp message was created. |
Failed Response
| Field | Type | Description |
|---|---|---|
| code | int | Error code. |
| message | string | Error details. |
Error Codes
| Code | Message |
|---|---|
| 40000 | Invalid parameter. |
| 40005 | Page number exceeds total. |
| 40127 | Authentication failed. |
| 40356 | Conversation does not exist. |
| 20059 | Agent deleted |
