Report API
Whereas the Message Report Endpoint deals with the specific content of messages, this endpoint allows you to fetch data related to the volume of chats that your bot(s) has/have had in a given time period.
Endpoint:
GET /api/frontend/reports/conversations/?fromDate=2020-01-25&toDate=2020-03-25
Parameters accepted:
Query | Required | Format | Default Value |
fromDate | Starting date for the report period | 2020-01-25 | No default value, but a value is required in order to fetch data from the endpoint |
toDate | End date for the report period | 2020-03-25 | No default value, but a value is required in order to fetch data from the endpoint |
includeEmptyResults | Optional | boolean | False |
includeTestConversations | Optional | boolean | False |
When you fire the webhook, it will use the email address defined on your BotXO profile to send you an email containing the metrics for the specified time period.
The metrics contain information such as:
The name of the bot, which channel it's deployed to, the number of conversations it has had, the number of messages that have been exchanged, and more.
Example of use:
curl 'https://me.botxo.co/api/frontend/reports/conversations/?fromDate={fromDate}&toDate={toDate}'
\ -H 'authorization: JWT {userToken}' -H 'content-type: application/json'
You can fetch your {userToken} by navigating to the top bar, clicking your name, and pressing on My Profile. In that section, there's a field named "public API auth token". Copy the contents of it into your request to replace the {userToken} part of the request.
Sample response:
{
"number_of_messages_sent": 490, // The number of messages sent from the bot
"bot_channel": "WebChat", // The channel the bot is deployed to
"bot_uuid": "fa9c6564-9879-4fc3-a131-2676fb12376", // Bot UUID
"number_of_messages_received": 490, // The number of messages sent from the user
"number_of_conversations": 57, // The number of conversations that have taken place
"bot_name": "Documentation Bot", // The name of the bot
"company_name": "BotXO Staff", // The name of the company the bot belongs to
"bot_current_version": 25 // How many times the bot has been saved
}
To simply the process of making this request, we've created a webhook template that will allow you to easily fetch the information without the need for a third-party API.
Comments
0 comments
Please sign in to leave a comment.