INTRODUCTION / INTRODUCTION

Introduction

The Botanalytics API is organized around REST. Our API has predictable, resource-oriented URLs, and uses HTTP response codes to indicate API errors. We use built-in HTTP features, like HTTP authentication and HTTP verbs, which are understood by off-the-shelf HTTP clients. We support cross-origin resource sharing, allowing you to interact securely with our API from a client-side web application (though you should never expose your secret API token in any public website's client-side code). JSON is returned by all API responses, including errors, although our API libraries convert responses to appropriate language-specific objects. Be sure to subscribe to Botanalytics's API announce mailing list to receive information on new additions and changes to Botanalytics's API and language libraries.

Authentication

Authenticate your account by including your token in API requests. You can manage your API tokens in the Botlist. Your API token carry many privileges, so be sure to keep them secure! Do not share your API token in publicly accessible areas such GitHub, client-side code, and so forth. All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail.

Errors

Botanalytics uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a charge failed, etc.). Codes in the 5xx range indicate an error with Botanalytics's servers.


200, 201 OK Everything worked as expected (some API calls may return 201 instead).

400 Bad Request The request was unacceptable, often due to missing a required parameter.

401 Unauthorized You forgot to include your API token or it is wrong.

404 Not Found The requested resource doesn't exist.

500, 502, 503, 504 Server Errors Something went wrong on Botanalytics's end. Try again later. (These are rare.)

API libraries

Official libraries for the Botanalytics API are available in several languages such as Node.js, Python and Ruby.

API Endpoint

https://api.botanalytics.co/v1/

Live Person Takeover - Hybrid Mode

On Hybrid mode, human representative can join the conversation with pausing the bot. To improve the engagement of conversations, you can pause the bot and join the conversation. You can send messages as If they are coming from your bot. After you talk with your user, you can enable bot again before leaving the conversation.

Facebook Messenger



Messages

Node.js
Python
Ruby
cURL
  • const Botanalytics = require('botanalytics').
  • FacebookMessenger(process.env.BOTANALYTICS_TOKEN);

  • app.post('/webhook/', function (req, res) {
  • ...
  • var data = req.body;
  • Botanalytics.logIncomingMessage(req.body);
  • ...
  • ...
  • Botanalytics.logOutgoingMessage(
  • messageData,
  • sender,
  • process.env.FACEBOOK_PAGE_TOKEN);
  • ...
  • })
  • recipient

    required

    string

    Always null for incoming messages

  • timestamp

    required

    number

    Timestamp of the message in milliseconds

  • message

    required

    object

    Facebook's message object

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/facebook-messenger/

Node.js code example

Facebook Messenger Livechat Settings

Livechat settings can be either set via botlist page or you can make a REST call.

cURL
  • curl --include \
  • --request PATCH \
  • --header "Authorization: Token BOTANALYTICS_TOKEN" \
  • --data-binary "{
  • \"platform_token\": \"..\",
  • \"webhook_url\": \"..\",
  • }" \
  • 'https://api.botanalytics.co/v1/bots/me'
  • platform_token

    required

    string

    Facebook Messenger bot's auth token

  • webhook_url

    required

    string

    Pause webhook url,

    https://yourbotswebhookurl/pause

Header Authorization:Token BOTANALYTICS_TOKEN

Patchhttps://api.botanalytics.co/api/v1/bots/me/

Facebook Messenger Pause Webhook

Your webhook will recieve two fields in the body:

userId Facebook user ID of the session to pause

paused Whether to pause the bot or not

While the details of the implementation may vary, at a high level, your webhook should keep track of which user sessions are paused. Whenever a new message is received, check if the session is paused for that user, and if so, stop the bot responding.

Facebook Webhook Example:

Node.js
  • var pausedUsers = {}
  • app.post('/pause', jsonParser, function (req, res) {
  • const userId = req.body.userId
  • const paused = req.body.paused
  • pausedUsers[userId] = paused
  • res.send("ok")
  • });

And then, check the status after receiving a message:

Node.js
  • app.post('/webhook/', jsonParser, function (req, res) {
  • ...
  • if(req.body.entry){
  • req.body.entry.forEach(function(entry){
  • if(entry.messaging){
  • entry.messaging.forEach(function(event){
  • var recipientId = event.sender.id;
  • if(!pausedUsers[recipientId]){
  • //handle message if session is not paused for this userId
  • [...]
  • }
  • }
  • }
  • }
  • }
  • ...
  • }

Facebook User Profile

Node.js
Python
Ruby
cURL
  • const Botanalytics = require('botanalytics').
  • FacebookMessenger(process.env.BOTANALYTICS_TOKEN);

  • var profileData = {
  • "first_name": "..."
  • "last_name": "..."
  • "profile_pic": "..."
  • "locale": "..."
  • "timezone": "..."
  • "gender": "..."
  • "user_id": "..."
  • };
  • Botanalytics.logUserProfile(profileData);
  • user_id

    required

    string

    Facebook Page-scoped ID of the user

  • first_name

    optional

    string

    Facebook's user profile 'first_name'

  • last_name

    optional

    string

    Facebook's user profile 'last_name'

  • profile_pic

    optional

    string

    Facebook's user profile 'profile_pic'

  • locale

    optional

    string

    Facebook's user profile 'locale'

  • timezone

    optional

    number

    Facebook's user profile 'timezone'

  • gender

    optional

    object

    Facebook's user profile gender

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/facebook-messenger/users/

Google Assistant



Actions SDK

Node.js/Actions SDK
cURL
  • const { actionssdk } = require ( 'actions-on-google' );
  • const Botanalytics = require ( 'botanalytics' ).
  • GoogleAssistant ( process.env.BOTANALYTICS_TOKEN );
  • const app = actionssdk();
  • Botanalytics. attach ( app );

  • exports.sillyNameMaker = ( req, res ) => {
  • ...
  • Handle your app
  • ...
  • };

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/google-assistant/

Node.js/Actions Sdk code example

DialogFlow with NPM

Node.js/Dialogflow
  • const { dialogflow } = require ( 'actions-on-google' );
  • const Botanalytics = require ( 'botanalytics' ).
  • GoogleAssistant ( process.env.BOTANALYTICS_TOKEN );
  • const app = dialogflow();
  • Botanalytics. attach ( app );

  • exports.sillyNameMaker = ( req, res ) => {
  • ...
  • Handle your app
  • ...
  • };

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/google-assistant/

Node.js/Dialogflow code example

Dialogflow with Firebase

Node.js/Dialogflow with Firebase
  • const Botanalytics = require('botanalytics').
  • GoogleAssistant(process.env.BOTANALYTICS_TOKEN);

  • const { dialogflow } = require ( 'actions-on-google' );
  • const Botanalytics = require ( 'botanalytics' ).
  • GoogleAssistant ( process.env.BOTANALYTICS_TOKEN );
  • const app = dialogflow();
  • ...
  • Handle your app
  • ...
  • Botanalytics. attach ( app );

  • exports.dialogflowFirebaseFulfillment = functions.https. onRequest ( app );

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/google-assistant/

Python SDK

Python SDK
  • from botanalytics.google import GoogleAssistant

  • botanalytics = GoogleAssistant(debug=True,
  • token=os.environ['BOTANALYTICS_API_TOKEN'],
  • callback=err_callback,
  • async=True)

  • ...
  • botanalytics.log(request_payload, response_payload)
  • ...

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/google-assistant/

Python SDK with Google Cloud Functions

Python SDK with Google Cloud Functions
  • from botanalytics.google import GoogleAssistantCloudFunctions

  • botanalytics = GoogleAssistantCloudFunctions(debug=True,
  • token=os.environ['BOTANALYTICS_API_TOKEN'],
  • async=True)

  • ...
  • botanalytics.log(request_payload, response_payload)
  • ...

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/google-assistant/

Ruby SDK

Ruby SDK
  • require 'botanalytics'
  • botanalytics = Botanalytics::GoogleAssistant.new(
  • :debug => true,
  • :async => true,
  • :token => ENV['BOTANALYTICS_API_TOKEN'],
  • :callback => :error_callback)
  • ...
  • botanalytics.log(request_payload, response_payload)
  • ...

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/google-assistant/

Amazon Alexa



Lambda with Skills Kit V2

Node.js/Lambda with Skills Kit V2
cUrl
  • const Botanalytics = require('botanalytics').
  • AmazonAlexa(process.env.BOTANALYTICS_TOKEN);

  • const skill = Alexa. SkillBuilders . custom ()
  • . withSkillId ( "Your alexa skill id" )
  • . addRequestHandlers ( Handler1,Handler2,... )
  • . addErrorHandlers ( ErrorHandler1,... )
  • . create ();
  • exports.handler = Botanalytics.handler(event, context) {
  • ...
  • return skill . invoke ( event, context );
  • ...
  • }

  • -----OR-----
  • const lambda = Alexa. SkillBuilders . custom ()
  • . withSkillId ( "Your alexa skill id" )
  • . addRequestHandlers ( Handler1,Handler2,... )
  • . addErrorHandlers ( ErrorHandler1,... )
  • . lambda ();
  • exports.handler = Botanalytics .handler ( lambda );

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/amazon-alexa/

Node.js code example

Node.js Webhook

Node.js Webhook
  • const Botanalytics = require('botanalytics').
  • AmazonAlexa(process.env.BOTANALYTICS_TOKEN);

  • app.post('/alexa', (req, res) => {
  • ...
  • const responseBody = {
  • "version": "1.0",
  • "response": {
  • "outputSpeech": {
  • "type": "SSML",
  • "ssml": "Botanalytics Rocks"
  • },
  • "directives": [
  • {
  • "type": "AudioPlayer.Play",
  • "playBehavior": "ENQUEUE",
  • "audioItem": {
  • "stream": {
  • "expectedPreviousToken": "...",
  • "token": "...",
  • "url": "https://botanalytics.co/",
  • "offsetInMilliseconds": 0
  • }
  • }
  • }
  • ],
  • }
  • Botanalytics.log(req.body, responseBody);
  • ...
  • res.send(responseBody);
  • };

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/amazon-alexa/

Python SDK with Lambda

Python SDK with Lambda
  • from botanalytics.amazon import AmazonAlexaLambda

  • botanalytics = AmazonAlexaLambda(debug=True,
  • token=os.environ['BOTANALYTICS_API_TOKEN'],
  • async_logging=True)

  • ...
  • botanalytics.log(request_payload, response_payload)
  • ...

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/amazon-alexa/

Python SDK

Python SDK
  • from botanalytics.amazon import AmazonAlexa

  • botanalytics = AmazonAlexa(debug=True,
  • token=os.environ['BOTANALYTICS_API_TOKEN'],
  • callback=err_callback)

  • ...
  • botanalytics.log(request_payload, response_payload)
  • ...

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/amazon-alexa/

Ruby SDK

Ruby SDK
  • require 'botanalytics'
  • botanalytics = Botanalytics::AmazonAlexa.new(
  • :debug => true,
  • :async => true,
  • :token => ENV['BOTANALYTICS_API_TOKEN'],
  • :callback => :error_callback)
  • ...
  • botanalytics.log(request_payload, response_payload)
  • ...

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/amazon-alexa/

Twitter



Botanalytics provides one click integration for Twitter bots.

Slack



Slack Initialize

When you first connect slack via rtm.start, please initialize using this endpoint. Please keep in mind If you are using one of our official libraries this is done in the background.

cUrl
  • curl --include \
  • --request POST \
  • --header "Authorization: Token BOTANALYTICS_TOKEN" \
  • --data-binary "{
  • \"self\": {},
  • \"team\": {},
  • \"users\": [],
  • \"channels\": [],
  • \"groups\": [],
  • \"mpims\": [],
  • \"ims\": [],
  • \"bots\": []
  • }" \
  • 'https://api.botanalytics.co/v1/bots/slack/initialize/'
  • self

    required

    object

    Slack's rtm.start self

  • team

    required

    object

    Slack's rtm.start team

  • users

    required

    object

    Slack's rtm.start users

  • channels

    required

    object

    Slack's rtm.start channels

  • groups

    required

    object

    Slack's rtm.start groups

  • mpims

    required

    object

    Slack's rtm.start mpims

  • ims

    required

    object

    Slack's rtm.start ims

  • bots

    required

    object

    Slack's rtm.start bots

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/bots/slack/initialize/

Slack Rtm Api

Node.js
Python
Ruby
cUrl
  • const rtm = new RtmClient(CONFIG.slack.eventapi,{
  • dataStore: false,
  • useRtmConnect: true
  • });
  • const Botanalytics = require('botanalytics').
  • SlackRTMApi(process.env.BOTANALYTICS_TOKEN);

  • ...
  • Botanalytics.attach(rtm, console.error);
  • ...
  • object

    Slack's RTM Message object

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/slack/

Slack Events Api

Node.js
Python
Ruby
cUrl
  • const Botanalytics = require('botanalytics').
  • SlackEventApi(process.env.BOTANALYTICS_TOKEN,
  • process.env.SLACK_BOT_TOKEN);

  • const slackEventHandler = function(request, h) {
  • ...
  • Botanalytics.log(request.payload);
  • ...
  • }
  • object

    Slack's Events API Message object

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/slack/event/

Slack Events Api Button Click

Node.js
Python
Ruby
cUrl
  • const Botanalytics = require('botanalytics').
  • SlackEventApi(process.env.BOTANALYTICS_TOKEN,
  • process.env.SLACK_BOT_TOKEN);

  • const slackEventHandler = function(request, h) {
  • ...
  • Botanalytics.log(request.payload);
  • ...
  • }
  • const runServer = async () => {
  • server.route({
  • method: 'POST',
  • path : '/slack/interactive',
  • handler : function (request, h) {
  • ...
  • Botanalytics.log(JSON.parse(request.payload.payload));
  • return null;
  • }
  • });
  • ...
  • }
  • string

    Slack's Events API Button Click object

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/slack/interactive/

Kik



Messages

Node.js
cURL
  • const Botanalytics = require('botanalytics').
  • Kik(process.env.BOTANALYTICS_TOKEN);

  • ...
  • let bot = new Bot({
  • username: process.env.KIK_USERNAME,
  • apiKey: process.env.KIK_APIKEY,
  • baseUrl: process.env.KIK_BASEURL
  • });
  • bot.updateBotConfiguration();
  • Botanalytics.attach(bot);
  • ...
  • messages

    required

    array

    Array of Kik's message object

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/kik/

Node.js code example

User Profile

Node.js
cURL
  • const Botanalytics = require('botanalytics').
  • Kik(process.env.BOTANALYTICS_TOKEN);

  • ...
  • let bot = new Bot({
  • username: process.env.KIK_USERNAME,
  • apiKey: process.env.KIK_APIKEY,
  • baseUrl: process.env.KIK_BASEURL
  • });
  • bot.updateBotConfiguration();
  • Botanalytics.attach(bot);
  • ...
  • username

    required

    string

    Kik's user profile 'username'

  • firstName

    optional

    string

    Kik's user profile 'firstName'

  • lastName

    optional

    string

    Kik's user profile 'lastName'

  • profilePicUrl

    optional

    string

    Kik's user profile 'profilePicUrl'

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/kik/users/

Viber



Messages

Node.js
cURL
  • const Botanalytics = require('botanalytics').
  • Viber(process.env.BOTANALYTICS_TOKEN);

  • ...
  • const bot = new ViberBot(logger, {
  • authToken: process.env.VIBER_PUBLIC_ACCOUNT_ACCESS_TOKEN_KEY,
  • name: "Is It Up",
  • avatar: "https://raw.githubusercontent.com/devrelv/drop/master/151-icon.png"
  • });
  • Botanalytics.attach(bot, (err) => {
  • console.log('Callback error: ' + util.inspect(err));
  • });
  • ...
  • message

    required

    string

    Viber's message object

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/viber/

Node.js code example

User Profile

Node.js
cURL
  • const Botanalytics = require('botanalytics').
  • Viber(process.env.BOTANALYTICS_TOKEN);

  • ...
  • const bot = new ViberBot(logger, {
  • authToken: process.env.VIBER_PUBLIC_ACCOUNT_ACCESS_TOKEN_KEY,
  • name: "Is It Up",
  • avatar: "https://raw.githubusercontent.com/devrelv/drop/master/151-icon.png"
  • });
  • Botanalytics.attach(bot, (err) => {
  • console.log('Callback error: ' + util.inspect(err));
  • });
  • ...
  • id

    required

    string

    Viber's user detail id

  • name

    optional

    string

    Viber's user detail name

  • avatar

    optional

    string

    Viber's user detail avatar

  • country

    optional

    string

    Viber's user detail country

  • language

    optional

    string

    Viber's user detail language

  • primary_device_os

    optional

    string

    Viber's user detail primary_device_os

  • api_version

    optional

    string

    Viber's user detail api_version

  • viber_version

    optional

    string

    Viber's user detail viber_version

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/viber/users/

Line



Incoming Messages

cURL
  • curl --include \
  • --request POST \
  • --header "Authorization: Token BOTANALYTICS_TOKEN" \
  • --data-binary "{
  • \"events\": [],
  • }" \
  • 'https://api.botanalytics.co/v1/messages/line/'
  • events

    required

    array

    Array of Line's event payload

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/line/

Outgoing Messages

cURL
  • curl --include \
  • --request POST \
  • --header "Authorization: Token BOTANALYTICS_TOKEN" \
  • --data-binary "{
  • \"request\": \"..\",
  • \"response\": \"..\",
  • }" \
  • 'https://api.botanalytics.co/v1/messages/line/'
  • to

    required

    string

    ID of the target recipient

  • timestamp

    required

    int

    Timestamp of the message

  • messages

    required

    array

    Array of Line's event payload

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/line/

User Profile

cURL
  • curl --include \
  • --request POST \
  • --header "Authorization: Token BOTANALYTICS_TOKEN" \
  • --data-binary "{
  • "displayName":"LINE taro",
  • "userId":"U4af4980629...",
  • "pictureUrl":"http://obs.line-apps.com/...",
  • "statusMessage":"Hello, LINE!"
  • }" \
  • 'https://api.botanalytics.co/v1/line/users/'
  • userId

    required

    string

    Line's user profile userId

  • displayName

    required

    string

    Line's user profile displayName

  • pictureUrl

    required

    optional

    Line's user profile pictureUrl

  • statusMessage

    optional

    string

    Line's user profile statusMessage

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/line/users/

WeChat



Messages

cURL
  • curl --include \
  • --request POST \
  • --header "Authorization: Token BOTANALYTICS_TOKEN" \
  • --data-binary "{
  • \"is_sender_bot\": true,
  • \"message\": {
  • }
  • }" \
  • 'https://api.botanalytics.co/v1/messages/wechat/'
  • message

    required

    object

    WeChat's message object

  • is_sender_bot

    required

    boolean

    true If sms is sent by Bot, false otherwise

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/wechat/

User Profile

cURL
  • curl --include \
  • curl --include \
  • --request POST \
  • --header "Authorization: Token BOTANALYTICS_TOKEN" \
  • --data-binary "{
  • \"openid\": \"o6_bmjrPTlm6_2sgVt7hMZOPfL2M\",
  • \"nickname\": \"Band\",
  • \"sex\": 1,
  • \"language\": \"zh_CN\",
  • \"city\": \"Guangzhou\",
  • \"province\": \"Guangdong\",
  • \"country\": \"China\",
  • \"headimgurl\": \"...",
  • \"subscribe_time\": 1382694957
  • }" \
  • 'https://api.botanalytics.co/v1/wechat/users/'
  • openid

    required

    string

    WeChat's user profile penid

  • nickname

    optional

    string

    WeChat's user profile nickname

  • sex

    optional

    int

    WeChat's user profile sex

  • language

    optional

    string

    WeChat's user profile language

  • city

    optional

    string

    WeChat's user profile city

  • province

    optional

    string

    WeChat's user profile province

  • country

    optional

    string

    WeChat's user profile country

  • headimgurl

    optional

    string

    WeChat's user profile headimgurl

  • subscribe_time

    optional

    int

    WeChat's user profile subscribe_time

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/wechat/users/

Twilio Sms



cURL
  • curl --include \
  • --request POST \
  • --header "Authorization: Token BOTANALYTICS_TOKEN" \
  • --data-binary "{
  • \"is_sender_bot\":
  • \"message\": {
  • }
  • }" \
  • 'https://api.botanalytics.co/v1/twilio/sms/messages/'
  • is_sender_bot

    required

    boolean

    true If sms is sent by Bot, false otherwise

  • message

    required

    object

    Twilio's sms object

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/twilio/sms/messages/

Microsoft Bot Framework



Node.js
cURL
  • const Botanalytics = require('botanalytics').
  • MicrosoftBotFramework(process.env.BOTANALYTICS_TOKEN);

  • ...
  • var bot = new builder.UniversalBot(connector);
  • // Use the middleware
  • bot.use({
  • receive: Botanalytics.receive,
  • send: Botanalytics.send
  • });
  • ...
  • message

    required

    object

    Microsoft Bot Framework's message object

  • timestamp

    required

    int

    Timestamp of the message

  • is_sender_bot

    required

    boolean

    true If sms is sent by Bot, false otherwise

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/microsoft-bot-framework/

Skype



Node.js
cURL
  • const Botanalytics = require('botanalytics').
  • MicrosoftBotFramework(process.env.BOTANALYTICS_TOKEN);

  • ...
  • var bot = new builder.UniversalBot(connector);
  • // Use the middleware
  • bot.use({
  • receive: Botanalytics.receive,
  • send: Botanalytics.send
  • });
  • ...
  • message

    required

    object

    Microsoft Bot Framework's message object

  • timestamp

    required

    int

    Timestamp of the message

  • is_sender_bot

    required

    boolean

    true If sms is sent by Bot, false otherwise

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/microsoft-bot-framework/

Microsoft Teams



Node.js
cURL
  • const Botanalytics = require('botanalytics').
  • MicrosoftBotFramework(process.env.BOTANALYTICS_TOKEN);

  • ...
  • var bot = new builder.UniversalBot(connector);
  • // Use the middleware
  • bot.use({
  • receive: Botanalytics.receive,
  • send: Botanalytics.send
  • });
  • ...
  • message

    required

    object

    Microsoft Bot Framework's message object

  • timestamp

    required

    int

    Timestamp of the message

  • is_sender_bot

    required

    boolean

    true If sms is sent by Bot, false otherwise

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/microsoft-bot-framework/

Telegram



Node.js
cURL
  • const Botanalytics = require('botanalytics').
  • MicrosoftBotFramework(process.env.BOTANALYTICS_TOKEN);

  • ...
  • var bot = new builder.UniversalBot(connector);
  • // Use the middleware
  • bot.use({
  • receive: Botanalytics.receive,
  • send: Botanalytics.send
  • });
  • ...
  • message

    required

    object

    Microsoft Bot Framework's message object

  • timestamp

    required

    int

    Timestamp of the message

  • is_sender_bot

    required

    boolean

    true If sms is sent by Bot, false otherwise

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/microsoft-bot-framework/

Cortana



Node.js
cURL
  • const Botanalytics = require('botanalytics').
  • MicrosoftBotFramework(process.env.BOTANALYTICS_TOKEN);

  • ...
  • var bot = new builder.UniversalBot(connector);
  • // Use the middleware
  • bot.use({
  • receive: Botanalytics.receive,
  • send: Botanalytics.send
  • });
  • ...
  • message

    required

    object

    Microsoft Bot Framework's message object

  • timestamp

    required

    int

    Timestamp of the message

  • is_sender_bot

    required

    boolean

    true If sms is sent by Bot, false otherwise

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/microsoft-bot-framework/

GroupMe



Node.js
cURL
  • const Botanalytics = require('botanalytics').
  • MicrosoftBotFramework(process.env.BOTANALYTICS_TOKEN);

  • ...
  • var bot = new builder.UniversalBot(connector);
  • // Use the middleware
  • bot.use({
  • receive: Botanalytics.receive,
  • send: Botanalytics.send
  • });
  • ...
  • message

    required

    object

    Microsoft Bot Framework's message object

  • timestamp

    required

    int

    Timestamp of the message

  • is_sender_bot

    required

    boolean

    true If sms is sent by Bot, false otherwise

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/microsoft-bot-framework/

Bing



Node.js
cURL
  • const Botanalytics = require('botanalytics').
  • MicrosoftBotFramework(process.env.BOTANALYTICS_TOKEN);

  • ...
  • var bot = new builder.UniversalBot(connector);
  • // Use the middleware
  • bot.use({
  • receive: Botanalytics.receive,
  • send: Botanalytics.send
  • });
  • ...
  • message

    required

    object

    Microsoft Bot Framework's message object

  • timestamp

    required

    int

    Timestamp of the message

  • is_sender_bot

    required

    boolean

    true If sms is sent by Bot, false otherwise

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/microsoft-bot-framework/

Generic



Python
Ruby
cUrl
  • from botanalytics.generic import Generic


  • botanalytics = Generic(debug=True,
  • token=os.environ['BOTANALYTICS_API_TOKEN'],
  • callback=err_callback,
  • async=True)

  • ...
  • botanalytics.log(message)
  • ...
  • is_sender_bot

    required

    boolean

    true If sms is sent by Bot, false otherwise

  • user

    required

    object

  • message

    required

    object

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/generic/

Web Chat



Python
Ruby
cUrl
  • from botanalytics.generic import Generic


  • botanalytics = Generic(debug=True,
  • token=os.environ['BOTANALYTICS_API_TOKEN'],
  • callback=err_callback,
  • async=True)

  • ...
  • botanalytics.log(message)
  • ...
  • is_sender_bot

    required

    boolean

    true If sms is sent by Bot, false otherwise

  • user

    required

    object

  • message

    required

    object

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/generic/

Sms



Python
Ruby
cUrl
  • from botanalytics.generic import Generic


  • botanalytics = Generic(debug=True,
  • token=os.environ['BOTANALYTICS_API_TOKEN'],
  • callback=err_callback,
  • async=True)

  • ...
  • botanalytics.log(message)
  • ...
  • is_sender_bot

    required

    boolean

    true If sms is sent by Bot, false otherwise

  • user

    required

    object

  • message

    required

    object

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/generic/

Email



Python
Ruby
cUrl
  • from botanalytics.generic import Generic


  • botanalytics = Generic(debug=True,
  • token=os.environ['BOTANALYTICS_API_TOKEN'],
  • callback=err_callback,
  • async=True)

  • ...
  • botanalytics.log(message)
  • ...
  • is_sender_bot

    required

    boolean

    true If sms is sent by Bot, false otherwise

  • user

    required

    object

  • message

    required

    object

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/generic/

Drift

  • 1-Login into your Drift account and click on “settings”.

  • 2-Navigate to Apps section through App Settings

  • 3-You’ll see Botanalytics in Apps list

  • 4-Click “Connect” to proceed

  • 5-Authorize App so that we can receive data from you

  • 6-Provide your bot’s details and save

  • 7-If it says “we need to receive data from you” when you click “check connection”, that means the integration is successful and we’re excitedly waiting for your conversational data to analyse. You can click on Dashboard to see your data.

  • 8-Voila, you’re all set!

Chatfuel

  • 1-Go to Chatfuel and click on the ‘’Analyze’’ tab on the right menu.

  • 2-Select the bot you want to connect to Botanalytics.

  • 3-Click on the ‘’Analyze’’ tab on the left menu.

  • 4-When you scroll down, you’ll see the ‘’Third-Party Analytics’’ title, click on ‘’Show Analytics Tools’’ button, Botanalytics will appear as shown below:

  • 5-Click on ‘’Connect’’ button to integrate your bot into Botanalytics.

  • 6-You'll be redirected to Facebook login page for Botanalytics, after click on the page your bot is associated, you will have your Chatfuel bot integrated into Botanalytics.

  • 7-Good to go! You’re all set.

Motion.ai

  • 1-First of all, go to Botanalytics. Sign up with your credentials as it is shown below:

  • 2-Once you sign up, you will get to the page where you need to select your platform and get your token from.

  • 3-Select Motion.ai as your platform while filling out your fields.

  • 4-After you save your settings, you'll seee your token to move forward.

  • 5-Copy your token and go to Motion.ai

  • 6-Open your bot settings on Motion AI and click on the add-on tab.

  • 7-When you scroll down, you’ll see Botanalytics title.

  • 8-Paste your token and save your changes.

  • 9-Then, go to Botanalytics’ integration page again and check your connection with Motion.ai.

  • 10-You're good to measure your engagement.

Smooch

  • 1-Login into your Smooch account. Select your application. As shown below, click the ''Connect channels'' button.

  • 2-After you click, you can select Botanalytics under the ''Build A Bot'' category from the integrations page.

  • 3-Click ''Visit to Install'' button on Botanalytics' profile page on Smooch.io as shown below:

  • 4-After it directs you to sign up for Botanalytics, fill out the signup form with your credentials.

  • 5-You can select the app you would like to integrate on the connection page.

  • 6-Allow the app connection to move forward with the integration steps. If you click ''Deny'', it will cancel the integration. You will have to start over.

  • 7-Your bot integration is set. On the page below, check your connection to have your metrics measured.

  • 8-Wait for a while to see your data on Botanalytics. When your bot processes the data on Smooch.io, Botanalytics will receive and you'll start to see your dashboard and metrics.

  • 9-You're all set.

Amio

  • 1-Login into your Amio account. Select an existing channel or create new one.

  • 2-In Integrations tab click on Connect Integration.

  • 3-Select Botanalytics from the integration list

  • 4-Fill required fields: Name, Token and Channel, and click Connect. You can see the details here

  • 5-Wait for a while to see your data on Botanalytics. When your bot processes the data on Amio.io, Botanalytics will receive and you'll start to see your dashboard and metrics.

  • 6-You're all set.

Amazon Lex



Node.js
  • const Botanalytics = require('botanalytics').
  • AmazonLex(process.env.BOTANALYTICS_TOKEN);

  • exports.handler = (event, context, callback) => {
  • ...
  • dispatch(event, (response) => {
  • Botanalytics.log(event, context, response);
  • });
  • ...
  • };

Header Authorization:Token BOTANALYTICS_TOKEN

Posthttps://api.botanalytics.co/v1/messages/amazon-lex/

Node.js code example