Get Conversations

Get Conversations

Guide for getting conversations from a chatbot.

The Get Conversations API endpoint allows you to retrieve conversations from a specific chatbot. You can filter conversations based on various criteria, including the chatbot's ID, date range, and filtered sources.

Endpoint

POST https://www.chatzuri.com/api/v1/get-conversations

Request Headers

The API request must include the following headers.
  • Authorization: Bearer - The secret key for authenticating the API request.
  • Content-Type: application/json - The content type of the request payload.

Request Body

The request body should contain the following parameters:
  • chatbotId - (string, required): The ID of the target chatbot from which you want to retrieve conversations (found in the chatbot settings).
  • filteredSources - (string, optional): A comma-separated string of sources to be filtered for the chatbot's conversation. The sources can be any of the following:
    • "API"
    • "Chatzuri site"
    • "Instagram"
    • "Messenger"
    • "Slack"
    • "Unspecified"
    • "WhatsApp"
    • "Widget or Iframe"
  • startDate - (string, optional): A string representing the start date of the range within which conversations are to be fetched. The date string is expected to be in the "Year-Month-Day" format (e.g., 2023-07-10, not 2023-7-10).
  • endDate - (string, optional): A string representing the end date of the range within which conversations are to be fetched. The date string is expected to be in the "Year-Month-Day" format (e.g., 2023-07-13, not 2023-7-13).
  • page - (string, optional, default=1): A string representing the page number of the results, used for pagination.
  • size - (string, optional, default=10, max=100): A string representing the number of results per page, also used for pagination.

Example Request


const options = {method: 'GET', headers: {accept: 'application/json'}};

fetch('https://www.chatzuri.com/api/v1/get-conversations?chatbotId=startDate=2023-01-01&endDate=2023-12-12&page=1&size=20', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));


import requests

url = "https://www.chatzuri.com/api/v1/get-conversations?chatbotId=startDate=2023-01-01&endDate=2023-12-12&page=1&size=20"

headers = {"accept": "application/json"}

response = requests.get(url, headers=headers)

print(response.text)





curl --request GET \
     --url 'https://www.chatzuri.com/api/v1/get-conversations?chatbotId=startDate=2023-01-01&endDate=2023-12-12&page=1&size=20' \
     --header 'accept: application/json'




Response

The API response will be a JSON object with the following structure:

{
  "data": [
    {
      "id": "string",
      "created_at": "string",
      "messages": [
        {
          "role": "string",
          "content": "string"
        }
      ],
      "chatbot_id": "string",
      "customer": "string",
      "source": "string"
    }
  ]
}

The Get Conversations API endpoint provides a way to retrieve conversations from a chatbot based on specified filters. The response includes an array of conversations, each with its relevant details.
  • 200 - (string, required): The name of the chatbot to be created.
  • sourceText - (string, optional): The text data for the chatbot. This field is subject to the character limit based on your plan