Get Leads

Get Leads

This guide assists you with gathering leads.

The Get Leads API endpoint allows you to retrieve leads generated from a chatbot's conversations. By using this endpoint, you can obtain names, phone numbers, and emails from users who interact with your chatbots.

Endpoint

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

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 chatbot for which you want to retrieve leads..
  • startDate - (string): Represents the start date of the date range for fetching conversations. The date should be in "Year-Month-Day" format (e.g., 2023-07-10, not 2023-7-10).
  • endDate - (string): Represents the end date of the date range for fetching conversations. The date should be in "Year-Month-Day" format (e.g., 2023-07-13, not 2023-7-13).
  • page - (string): Specifies the page number of the results for pagination.
  • size - (string): Indicates the number of results per page, which is also used for pagination.

Example Request


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

fetch('https://www.chatzuri.com/api/v1/get-leads?chatbotId=%5BYour%20Chatbot%20ID%5D&startDate=2023-01-01&endDate=2023-12-12&page=1&size=10', 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-leads?chatbotId=%5BYour%20Chatbot%20ID%5D&startDate=2023-01-01&endDate=2023-12-12&page=1&size=10"

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

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

print(response.text)


curl --request GET \
     --url 'https://www.chatzuri.com/api/v1/get-leads?chatbotId=%5BYour%20Chatbot%20ID%5D&startDate=2023-01-01&endDate=2023-12-12&page=1&size=10' \
     --header 'accept: application/json'


GET /api/v1/get-leads?chatbotId=%5BYour%20Chatbot%20ID%5D&startDate=2023-01-01&endDate=2023-12-12&page=1&size=10 HTTP/1.1
Accept: application/json
Host: www.chatzuri.com

Response

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

{  
  "data": [  
    {  
      "id": 0,  
      "created_at": "string",  
      "chatbot_owner_user_id": "string",  
      "chatbot_id": "string",  
      "phone": "string",  
      "email": "string",  
      "name": "string"  
    }  
  ]  
}

Response codes.
  • 202 - Returns an array collectedCustomers[] containing conversations that match the provided filters. These conversations represent leads generated by the chatbot..
  • 400 - If the start/end dates provided are invalid.
  • 401 - If the API request is unauthorized..
  • 404 - If the chatbotId provided is invalid and does not correspond to any existing chatbot.
  • 500 - If there is an internal server error while processing the request.
By making use of the Get Leads API endpoint, you can retrieve and analyze potential leads generated through the chatbot interactions.