Api

Conversations

API Documentation

Conversation Structure

The /v1/api/conversations endpoint allows you to retrieve a complete list of conversations. A conversation represents a session between a user and a bot.

Endpoint

GET /v1/api/conversations

Response Structure

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

{
   "id": 7202,
   "type": "freeshot",
   "count": 10,
   "sessionid": "tC4lQY781a207d-8ca7-44e5-9939-03d18e9a99a8",
   "firstUserMessage": "Hej",
   "firstBotMessage": "{\"message\":\"Hej! W czym moge Ci dzisiaj pomoc\"}",
   "createdOn": "2024-06-23T11:34:35.397713Z"
}

Field Descriptions

  • id: Unique identifier for the conversation
  • type: Type of conversation (e.g., "freeshot")
  • count: Number of messages in the conversation
  • sessionid: Unique session identifier
  • firstUserMessage: The initial message from the user
  • firstBotMessage: The first response from the bot (JSON string)
  • createdOn: Timestamp of when the conversation was created

Example Requests

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

curl -X GET "https://botuj.pl/v1/api/conversations" \
     -H "Authorization: Bearer TWOJ_KLUCZ_API"

Remember to replace YOUR_API_KEY with your actual API key in all examples.

Pagination

The API supports pagination to handle large datasets efficiently. 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/conversations?page=2&per_page=50

This will retrieve the second page of results, with 50 conversations per page.

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, and codes in the 5xx range indicate an error with our servers.

For more detailed information about our API, including rate limits and error codes, please refer to our comprehensive API documentation.