Getting Started for Facebook Bots

Botmetrics: Analytics for Messenger Bots

botmetrics makes it simple to get instant analytics and gives you levers to increase engagement with your Facebook Messenger Bot without additional engineering work.

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

Step 1: Facebook Page Access Token

Add your Facebook Page Access Token to botmetrics

Step 2: Update Your Bot's Webhook Handler

Add a line of code to your webhook handler and collect data

// Remember to run `npm install --save botmetrics` in your app.
//
// If you are using an Express-based app, parse the request body
// and pass along req.body as an argument to Botmetrics
// for example:
var express = require('express');
var app = express();
var bodyParser = require('body-parser');
var Botmetrics = require('botmetrics');

app.use(bodyParser.json()); // for parsing application/json

app.post('/webhooks', function(req, res) {
  Botmetrics.track(req.body, {
    apiKey: process.env.BOTMETRICS_API_KEY,
    botId: process.env.BOTMETRICS_BOT_ID
  });
  
  res.status(200).send("ok");
});

app.listen(5000, function () {
  console.log('facebook bot listening on port 5000!');
});

Step 3: Profit

You can now instantly see detailed metrics about your customers such as new and active user growth, demographic and geographic distributions, and user action attributes. With no additional engineering effort you will also have the ability to segment users based on these characteristics and send them targeted smart time-zone aware notifications.

Get Botmetrics for free and engage your customers like never before.