Get Conversation Records

Get conversation records from conversation ID.

Request Method

GET

Request URL

https://api.gptbots.ai/v1/messages

Request Authentication

See Overview for authentication details.

Request

Request Example

curl -X GET 'https://api.gptbots.ai/v1/messages?conversation_id=xxxxxx&user_id=123456&page=1&page_size=100' \
  -H 'Authorization: Bearer your_apikey' \
  -H 'Content-Type: application/json'

Request Headers

FieldTypeDescription

Authorization

Bearer ${token}

Use Authorization: Bearer ${token} for authentication. Get the key from the API Keys page as token.

Content-Type

application/json

Data type, set to application/json.

Request Body

FieldTypeRequiredDescription

conversation_id

string

Yes

Conversation identifier.

user_id

string

Yes

User identifier.

page

int

Yes

Page number, indicating which page of data you want to request.

page_size

int

Yes

Number of data per page, indicating how many data entries you want returned per page, max 100.

Response

Response Example

{
  "total": 100,
  "messages": [
    {
      "message_id": "645dd86906931c4a9e0ffb1f",
      "parent_message_id": "",
      "message_type": "ANSWER", 
      "text": "Hello, I'm a customer service chatbot, 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
    }
  ]
}

Success Response

FieldTypeDescription

total

string

Total number of messages in this conversation.

messages

JSON Array

Message details.

- message_id

string

Unique identifier of the message.

- parent_message_id

string

Unique identifier of the parent message.

- message_type

string

Message type, value: ANSWER, QUESTION.

- text

string

Message content.

- create_time

int

Timestamp when the message was created.

Failure Response

FieldTypeDescription

code

int

Error code.

message

string

Error details.

Error Codes

CodeMessage

40000

Parameter error

40005

Pagination parameter cannot be greater than total count

40127

Developer authentication failed

40356

Conversation does not exist

Last updated