Coder Social home page Coder Social logo

jordanabderrachid / node-botmetrics Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mnort9/node-botmetrics

0.0 2.0 0.0 5 KB

Official NodeJS client for BotMetrics - Bot & Conversation Analytics

Home Page: https://bot-metrics.com

JavaScript 100.00%

node-botmetrics's Introduction

node-botmetrics

Official NodeJS client for BotMetrics, bot & conversation analytics.

Installation

npm install node-botmetrics --save

Facebook Messenger SDK

var botmetrics = require('node-botmetrics')('API_TOKEN').facebook;

Incoming

app.post('/webhook', function (req, res) {
    botmetrics.trackIncoming(req.body);
    
    // Handle incoming message...
}

Outgoing

// Example POST to Facebook

var fbData = {
    recipient: { id: fbUserId },
    message: {
        text: 'Hi there!'
    }
};

var options = {
    url: 'https://graph.facebook.com/v2.6/me/messages',
    qs: { access_token: FB_PAGE_TOKEN },
    method: 'POST',
    json: fbData
};

request(options, function(err, res, body) {
    if (err) return console.log(err);
    
    // After FB post is successful, send req data to BotMetrics
    botmetrics.trackOutgoing(fbData);
});

Other Messaging Platforms

var botmetrics = require('node-botmetrics')('API_TOKEN');

botmetrics.track({
    text: 'Hi there!',
    message_type: 'outgoing',
    user_id: '54367392345234',
    platform: 'kik'
});

Debug Mode

// Turn on debug mode to print BotMetrics API messages
var botmetrics = require('node-botmetrics')('API_TOKEN', true);

Documentation

View complete documentation here: https://bot-metrics.com/docs

node-botmetrics's People

Contributors

mnort9 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.