Messaging Types
Text
bot.say('Hello World!');
Audio
bot.say([{ audioFile: 'http://www.noiseaddicts.com/samples_1w72b820/4927.mp3' }]);
File
bot.say([{ file: 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf' }]);
Image
bot.say([{ imageUrl: 'https://placeholdit.imgix.net/~text?txtsize=33&txt=250%C3%97150&w=250&h=150' }]);
Video
bot.say([{ videoUrl: 'http://techslides.com/demos/sample-videos/small.mp4' }]);
Button
bot.say([{
text: 'Click you favorite day'
}],
[{
title: 'Monday'
},{
title: 'Friday'
}]
);
Carousel
bot.say([{
elements: [{
title: 'Hello World',
subtitle: 'AKA a carousel',
imageUrl: 'https://placeholdit.imgix.net/~text?txtsize=33&txt=250%C3%97150&w=250&h=150',
buttons: [{
title: 'Back'
}]
}]
}]);
List
bot.say([{
listView: {
topElementSize: 'compact',
cards: [{
title: 'List',
subtitle: 'At least',
image_url: 'https://placeholdit.imgix.net/~text?txtsize=33&txt=250%C3%97150&w=250&h=150'
}, {
title: 'Template',
subtitle: 'two elements',
image_url: 'https://placeholdit.imgix.net/~text?txtsize=33&txt=250%C3%97150&w=250&h=150'
}]
}
}]);
URL Button
bot.say([{
text: 'The URL button is just a button that links out to another website.'
}],
[{
title: 'Google',
url: 'https://www.yahoo.com'
},{
title: 'Yahoo',
url: 'https://www.google.com'
}]);
Quick Replies
bot.say('Some text above the quick replies', {
quickReplies: [{
title: 'Quick'
}, {
title:'Reply'
}]
});
Updated over 5 years ago