Facebook Integration with BotKit and NPM

Dashbot offers Botkit middleware to make plugging into your facebook bot easy.

Create a bot API key

Each bot needs its own API key for tracking.

Create a bot to get an API key.

Install Dashbot via NPM

npm install --save dashbot

Include Dashbot

Use the API key created above.

const dashbot = require('dashbot')(process.env.DASHBOT_API_KEY).facebook;

After you create your Botkit controller, simply add send and receive middleware

const controller = Botkit.facebookbot(...);

// Add the dashbot middleware
controller.middleware.receive.use(dashbot.receive);
controller.middleware.send.use(dashbot.send);

Example

View a complete example.

Close Menu