botkit-messenger-samples

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: process.env.serverUrl
});
});
Available Commands in Messenger
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"
}
]
}
]
}
}
}]