0.14.21 / 2018-02-05
- [new] Support all of methods on
ConsoleContext
withfallbackMethods: true
#184, for example:
const bot = new ConsoleBot({ fallbackMethods: true });
bot.onEvent(async context => {
await context.sendText('Hello World');
await context.sendImage('https://example.com/vr.jpg');
await context.sendButtonTemplate('What do you want to do next?', [
{
type: 'web_url',
url: 'https://petersapparel.parseapp.com',
title: 'Show Website',
},
{
type: 'postback',
title: 'Start Chatting',
payload: 'USER_DEFINED_PAYLOAD',
},
]);
});
Result:
Bot > Hello World
Bot > sendImage: ["https://example.com/vr.jpg"]
Bot > sendButtonTemplate: ["What do you want to do next?",[{"type":"web_url","url":"https://petersapparel.parseapp.com","title":"Show Website"},{"type":"postback","title":"Start Chatting","payload":"USER_DEFINED_PAYLOAD"}]]