Socket
Book a DemoInstallSign in
Socket

botkit-fb-quick-reply

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

botkit-fb-quick-reply

A botkit middleware to handle Facebook Messenger quick reply in an intuitive manner

0.1.0
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

botkit-fb-quick-reply Build Status

A Botkit middleware to handle Facebook Messenger's quick reply in an intuitive manner

Using this Botkit middleware allows your controller to "listen" on Facebook Messenger quick reply payloads instead of the quick reply label/text. In addition, it also supports backwards compatibility to prevent breaking any existing code.

The message object is updated to the following:

message.payload = message.quick_reply.payload;
message.text = message.quick_reply.payload;
message.label = message.quick_reply.text;
message.type = eventName || 'facebook_quick_reply';

Install

$ npm install --save botkit-fb-quick-reply

Usage

const quickReplyMiddleware = require('botkit-fb-quick-reply');

// Load middleware
quickReplyMiddleware(controller);
// Now controller can handle "facebook_quick_reply" events and set messages accordingly
// messages.label = quick reply text label
// message.payload = quick reply payload

// Listen to events by the payload
controller.hears('MY_QUICK_REPLY_PAYLOAD', 'facebook_quick_reply', doSomething);

// Listen to a payload that can be provided from a postback OR quick reply
controller.hears('MY_QUICK_REPLY_PAYLOAD', ['facebook_quick_reply', 'facebook_postback'], doSomethingElse);

API

botkitFbQuickReply(controller [, options])

controller

Type: object

A botkit configured controller

options

Configure the middleware

options.eventName

Type: string
Default: facebook_quick_reply

Override the default quick reply event name. For example, you can use facebook_postback if you feel have overlapping functionalities from the menu or quick replies.

options.backwardsCompatibility

Type: boolean
Default: false

This will trigger both a message_received in the default behavior, and in the new facebook_quick_reply event. Thus activate this if you want backwards compability, but want to use the newer means of handling quick reply events.

License

MIT © Mako AI

Keywords

botkit middleware

FAQs

Package last updated on 01 Jun 2018

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.