Is an environment for testing Messenger Bot flows
const botPreview = require('bot-preview');
const config = {
flowsDirectory: __dirname + '/flows',
configFile: __dirname + '/config.json',
};
botPreview.start(config);
Just create a config.json file with this fields:
{
"loop": false,
"likes": "35K",
"botName": "Example Bot",
"botCategory": "Shopping",
"botWelcomeMessage": "Hi User, Welcome!",
"displayedCarrier": "Carrier"
}
A preview flow is just txt file with an especial format, we can mock:
- Bot message
- User message
- Typing indicator
- Quick reply
- Quick reply selection
- Button template
- Button template selection
- Generic cards
- Scroll generic cards
- Select a generic card button
See ./flows/test.txt
bot::"Hello there, this is a message from bot"
user::"Hello there, this is a message from user"
...
['option 1', 'option 2', 'option 3']
qr::
qr::0
"This is a text for buttons"::['button 1', 'button 2']
bt::
bt::1
Start a generic card carrousel use !# and end it with #! to create a new card use >
!#
imageUrl::https://i.ytimg.com/vi/56ucT_Hw4bg/hqdefault.jpg
title::This is the first card
subtitle::this is a card sub title
buttons::option one|option two
>
imageUrl::https://i.ytimg.com/vi/56ucT_Hw4bg/hqdefault.jpg
title::This is a second card
subtitle::Did you see it?
buttons::Yes, i see it|Nop
>
imageUrl::https://i.ytimg.com/vi/56ucT_Hw4bg/hqdefault.jpg
title::This is a third card
subtitle::Did you see it?
buttons::Yes, i see it|Nop
#!
scroll::
scroll::1
sc::
sc::0
This library is using jQuery.fbMessenger of Matthias Gall
This project is a spare time project of Rodrigo Navarro and in no way affiliated with Facebook.
"Facebook" is a registered trademark of Facebook, Inc., Menlo Park Calif., US. "iPhone" is a registered trademark of Apple Inc., Cupertino Calif., US. Other mentioned trademarks are trademarks of their respective owners.
Licensed under MIT license terms. See file LICENSE.
This is an experimental library, Feel fre to contribute, fork and email me rodrigonavarro23@gmail.com