Learn how to retrieve datapoints collected in a conversation
This endpoint allows you to get datapoint values collected.
Datapoints collected in the middle of a conversation may be inaccurate or incomplete. After ~10 minutes of inactivity in a conversation, we refresh the collected datapoints to be more accurate. Depending on when you send your request, you may receive different information.
Endpoint
Method: GET
https://proxy.botsheets.com/api/v0/conversations/datapoints
Request Headers
Headers:
Authorization: Bearer <API KEY>
"Authorization" is the key and the value should include Bearer plus your Botsheets API Secret Key. You can get a Botsheets Secret Key in your Botsheets account by navigating to Bot Settings > Webhook / API > API Key and Documentation. One Secret Key is used for all chatbots on your Botsheets account.
Content-Type: application/json
This is the type of request you'll make.
Request Body
The body should contain the following:
conversationId
(string, required)
A UNIQUE identifier for the current conversation is required. Botsheets handles the chat history for you. However, each conversation must have a unique conversation ID. We recommend generating a UUID, however there is no schema enforcement besides being a string.
botId
(string, required)
The ID for the bot the conversation is with. Your botID can be found by navigating to Bot Settings > Webhook / API > API Key and Documentation..
Example:
{
"conversationId": "06811cd5-5595-41b2-98c2-dc108c0473bd",
"botId": "65fa4da045a986ffccec07w3",
}
Example Request
const response = await fetch('https://proxy.botsheets.com/api/v0/conversations/datapoints', {
method: 'POST',
headers: {
Authorization: 'Bearer <API Key>'
},
body: JSON.stringify({
"conversationId": "string",
"botId": "string"
})
});
curl https://proxy.botsheets.com/api/v0/conversations/datapoints \
-H 'Authorization: Bearer <API Key>' \
-d '{
"conversationId": "string",
"botId": "string"
}'
Response
Response will be a JSON object containing a in the following format:
{ datapoints: {
"Datapoint Key": "Datapoint Value",
"Datapoint Key 2": "Datapoint value 2",
...
}}