Botmetrics

The Botmetrics Developer Hub

Welcome to the Bot Metrics developer hub. You'll find comprehensive guides and documentation to help you start working with Bot Metrics as quickly as possible, as well as support if you get stuck. Let's jump right in!

Getting Started for Mobile, Web and SMS

Botmetrics: Analytics for Mobile, Web and SMS Conversations

botmetrics makes it simple to measure, grow and engage users on your website or within your mobile

We’ll show you how to get started collecting metrics in 3 easy steps:

Step 1: Sign up for Botmetrics

Sign up for Botmetrics for free and select the Globe Icon for custom integration.

Follow the steps add your preferred language SDK to your Bot Code.

Step 2: Create a Message Payload

In your Bot create a message payload which includes the following fields for each incoming and outgoing message. Typically this is done in the "Message Handler" portion that sends and receives messages from your users.

Required and Optional Fields

Note:

  • All fields are required except the user_attributes hash which is optional
  • is_to_bot can be true or false
  • is_from_bot can be true or false
  • timezone is integer and is a valid timezone offset from GMT
message_payload = 
{
  "id": "unique ID representing an event",
  "timestamp": "JSON representation of timestamp, e.g. 2012-04-23T18:25:43.511Z",
  "text": "Text of message",
  "event_type": "type of event, currently only supports the value 'message'",
  "is_for_bot": boolean,
  "is_from_bot": boolean,
  "user_id": "unique ID representing the user",
  "bot_id": "unique ID representing the bot",
  "user_attributes": {
    "first_name": "First Name of the User",
    "last_name": "Last Name of the User",
    "full_name": "Full Name of the User",
    "email": "Email of the user",
    "timezone": -7,
    "gender": "Gender of user"
  }
}

HTTPS API

If you're using the Botmetrics HTTPS API endpoint be sure to escape the strings in the JSON payload object.

Step 3: Send the Payload to Botmetrics

Now, using the Botmetrics SDKs you can send the events to Botmetrics by simply calling the Track function. This portion is also typically in the "Message Handler" portion of the code.

For example, in javascript it looks like this:

Botmetrics.track(message_payload, {
    apiKey: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyNCwiZXhwIjoxNzgzNDA0OTA0fQ.LHRU1kkeOvdsNoqkSZTgyPSGAAgEY4WMkZB12q1x9Bg",
    botId: "000901c34ba6"
  });

Step 4: Test your First Messages

Deploy your code and head over to the Botmetrics to track custom events, see transcripts from your users and to re-engage them.

From the Botmetrics Dashboard click in to see the Messages To Bot

From here you can see the individual users and click in to see individual conversation Transcripts.

Viola!


What's Next

Want to see what else you can do with Botmetrics?

Tracking Links and Link Conversion with Botmetrics

Getting Started for Mobile, Web and SMS