@kiina/bot-controller
v1.2.1
Published
This package exports a Class meant for controlling the bot setup and environment configuration.
Downloads
5
Keywords
Readme
Bot Controller
This package exports a Class meant for controlling the bot setup and environment configuration.
Installation
npm install @kiina/bot-controller
Usage
const BotController = require('@kiina/bot-controller');
const botProviders = [
{
type: require('botmaster-messenger'),
config: {
credentials: {
verifyToken: '<fb-verify-token>',
pageToken: '<fb-page-token>',
fbAppSecret: '<fb-app-secret>',
},
webhookEndpoint: 'fb-endpoint' // http://my-host.com/messenger/<webhookEndpoint>
}
}
];
const bot = new BotController(botProviders);
const exampleMiddleware = {
type: 'incoming',
name: 'example',
controller: async (bot, update) => {
return bot.reply(update, 'Hello world!');
}
};
controller.addMiddleware(exampleMiddleware);