Socket
Socket
Sign inDemoInstall

api-ai-botkit-facebook

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

api-ai-botkit-facebook

Utility lib for creating Facebook Messenger bots with Botkit and api.ai


Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

api-ai-botkit-facebook

npm

Utility lib for creating Facebook Messenger bots with Botkit and api.ai. Based off of the api-ai-botkit.

For usage sample code see examples/sample_bot.js

Steps for using lib

Install library from npm

npm install --save api-ai-botkit-facebook

Import Library

const apiaibotkit = require('api-ai-botkit-facebook');

Create apiai object using token from http://api.ai website

const apiai = apiaibotkit(apiaiToken);

Use apiai object in controller.hears

controller.hears('.*', 'message_received', function (bot, message) {
    apiai.process(message, bot);
});

Implement different reactions to appropriate actions

apiai
  .action('greetings', function (message, resp, bot) {
    var responseText = resp.result.fulfillment.speech;
    bot.reply(message, responseText);
  })
  .action('input.unknown', function (message, resp, bot) {
    bot.reply(message, "Sorry, I don't understand");
  })
  .action(null, function(message, resp, bot) {
    // handle all actions no not specified with
    // other actions (e.g., greetings and input.unknown)
    var responseText = resp.result.fulfillment.speech;
    bot.reply(message, responseText);
  })
;

Keywords

FAQs

Package last updated on 29 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc