Api

Message

Conversation Messages

The /v1/api/conversation-messages/:id endpoint allows you to retrieve all messages from a specific conversation.

Endpoint

GET /v1/api/conversation-messages/:id

Where :id is the unique identifier of the conversation.

Response Structure

Each message object in the response will have the following structure:

{
  "id": 10906,
  "message": "Who are you",
  "userId": "781a207d-8ca7-44e5-9939-03d18e9a99a8",
  "isUser": true,
  "type": "freeshot",
  "createdOn": "2024-06-23T11:58:10.169778Z"
}

Field Descriptions

  • id: Unique identifier of the message
  • message: Content of the message
  • userId: Identifier of the user who sent the message
  • isUser: Flag indicating whether the message is from the user (true) or the bot (false)
  • type: Type of message (e.g., "freeshot")
  • createdOn: Timestamp of when the message was created

Example Requests

Here are examples of how to make a request to the /v1/api/conversation-messages/:id endpoint using various programming languages and tools:

curl -X GET "https://botuj.pl/v1/api/conversation-messages/1234" \
     -H "Authorization: Bearer YOUR_API_KEY"

Remember to replace YOUR_API_KEY with your actual API key, and 1234 with the appropriate conversation identifier in all examples.

Pagination

The API supports pagination to efficiently manage large datasets. Use the following query parameters:

  • page: Page number (default: 1)
  • per_page: Number of items per page (default: 20, max: 100)

Example:

GET /v1/api/conversation-messages/1234?page=2&per_page=50

This query will retrieve the second page of results, with 50 messages per page for the conversation with ID 1234.

Error Handling

The API uses conventional HTTP response codes to indicate the success or failure of requests. Codes in the 2xx range indicate success, codes in the 4xx range indicate an error that failed given the information provided (e.g., invalid conversation ID), and codes in the 5xx range indicate an error with our servers.