Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
conf added multiple facebook access tokens support Dec 19, 2017
examples/basic update basic example` Aug 23, 2017
fixtures/apiai fix: return full API.AI response on empty message Aug 28, 2017
src move restify parsers initialization Jan 14, 2018
tests Added support for pageId Jan 7, 2018
.eslintignore fixed by eslint Aug 8, 2017
.npmignore added multiple facebook access tokens support Dec 19, 2017
LICENSE Initial commit Jan 19, 2017
env_tmpl Remove Botlytics Jan 21, 2017
index.js Added support for pageId Jan 7, 2018
package.json 0.2.1 Jan 14, 2018


Build Status npm version npm


We believe the beginning of a successful bot has little to do with engineering and everything to do with the skill of the product owner in acquiring users and keeping them faster than their competition.

That's why we've open sourced our Facebook Messenger node.js code base so you can get all the latest features from API.AI, Facebook Messenger and Analytics like Dashbot and BotMetrics. While setting yourself up for success with a robust and extensible code base when you've tested your assumptions and are ready for an engineer to build domain specific features.


  • npm install botstack
  • set API keys in env_tmpl


Create index.js file with this content:

const BotStack = require('botstack');

class ExampleBot extends BotStack {};

const bot = new ExampleBot('example-bot');

Before the start of the bot, we need to set a few environment variables:


If you don't want to set environment variables explicitly, you can use the dotenv library.


  1. Create .env file in the root folder of your project Example:
  1. Create JS file:
class ExampleBot extends BotStack {};

const bot = new ExampleBot('example-bot');
  1. Run
node index.js

Other examples you can find in the examples folder of this repository.


  • Emjoi Support
  • Configurable 'Greeting, Get Started Button & Action Menu'
  • Simple User Onboarding Design
  • Facebook Referral Support- Track different links placed in different channels to see which is most effective
  • NLP - Inuitive and easy use Natural Langage Programming
  • Easily setup FB structured messages (Image, Quick Replys, Card, Custom Payload)
  • Analytics and Insights
  • Subscription and Broadcast capabilities with


  • BotStackjs - clean modular re-usable libraries
  • Node.js - Scalable fast code
  • API.AI - Best in class Natural Language Processing
  • Redis [Optional] - In-memory cache storage for thing like user sessions
  • Docker - Management and simplified deployment of services


  • Better Promise Support with Bluebird and request-promise
  • Good Test Coverage
  • Structured logging with Winston - specify additional metadata (like session id, user id, module name, etc)
  • Track Stack Traces with Sentry


  • Facebook Webviews
  • Rabbit MQ Support

How to get involved?

It's still early days and everything we are learning on customers messenger bots we are trying to incorporate here. If you are using this source code and make enhancements please feed the changes back in. If you are more a product person message me or add your ideas under the issues.