Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

botkit-messenger-samples

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

botkit-messenger-samples

Module to receive sample messages of all types from a Facebook Messenger chatbot

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

botkit-messenger-samples

npm

Module to receive sample messages of most types from a Facebook Messenger chatbot.

Takes the idea of sample message types from the Facebook Messenger Platform Sample project and moves it into a module for Botkit.

For usage sample code see examples/sample_bot.js

Steps for using lib

Install library from npm

npm install --save botkit-messenger-samples

Import Library

const MessengerSamples = require('botkit-messenger-samples');

Init the Library

controller.setupWebserver(process.env.port,function(err, webserver) {
  var messengerSamples = new MessengerSamples(controller, bot, {
    // serverUrl (e.g., https://my.domain.com)
    // needed to server up sample images
    serverUrl: process.env.serverUrl
    //, replyCb = function(err, body) {
    //    // call after a sample message is sent
    //  }
  });
});

Available Commands in Messenger

CommandResults
sample:helptext list of available commands
sample:audioan Audio Attachment embedded in a player
sample:buttona Button Template
sample:filea text File Attachment
sample:generica Generic Template
sample:gifan animated GIF Image Attachment
sample:imagean Image Attachment
sample:image:talla very tall Image Attachment
sample:image:widea very wide Image Attachment
sample:lista List Template top_element_style:large
note: on web, it is rendered as compact
sample:list:compacta List Template top_element_style:compact
sample:quick replya text message with Quick Replies
sample:read receiptthe mark_seen Sender Action
sample:receipta Receipt Template
sample:typing onthe typing_on Sender Action
sample:typing offthe typing_off Sender Action
sample:videoa Video Attachment embedded in a player
sample:json:{
"text": "Lorem Ipsum!"
}
any message type; after the sample:json: add any valid message, see Send API Reference

JSON Examples

Simple text

sample:json:{
  "text": "hello world"
}

Muliple messages

sample:json:[{
  "text": "hello world"
},{
  "attachment": {
    "type": "template",
    "payload": {
      "template_type": "generic",
      "elements": [
        {
          "title": "rift",
          "subtitle": "Next-generation virtual reality",
          "item_url": "https://www.oculus.com/en-us/rift/",
          "image_url": "http://assets.smalltalk.ai/sample-message/rift.png",
          "buttons": [
            {
              "type": "web_url",
              "url": "https://www.oculus.com/en-us/rift/",
              "title": "Open Web URL"
            },
            {
              "type": "postback",
              "title": "Call Postback",
              "payload": "Payload for first bubble"
            }
          ]
        },
        {
          "title": "touch",
          "subtitle": "Your Hands, Now in VR",
          "item_url": "https://www.oculus.com/en-us/touch/",
          "image_url": "http://assets.smalltalk.ai/sample-message/touch.png",
          "buttons": [
            {
              "type": "web_url",
              "url": "https://www.oculus.com/en-us/touch/",
              "title": "Open Web URL"
            },
            {
              "type": "postback",
              "title": "Call Postback",
              "payload": "Payload for second bubble"
            }
          ]
        }
      ]
    }
  }
}]

Keywords

FAQs

Package last updated on 11 Oct 2019

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