Bottender
-
Flexible - Declare handlers as any JavaScript function.
-
Modern - Source written with ES6/ES7 syntax and great async await
supports.
-
Modular - Use session stores, server framework adapters and platform
connectors with same interface.
-
Learn Once, Write Anywhere - Handle multiple platforms with consistent
development experience.
Bottender is built on top of
Messaging APIs.
Documentation
You can find the Bottender documentation on the website.
Examples
We have a bunch of examples in the
examples folder.
Here is the first one to get you started:
const { ConsoleBot } = require('bottender');
const bot = new ConsoleBot();
bot.onEvent(async context => {
await context.sendText('Hello World');
});
bot.createRuntime();
This will create and run a bot which always reply "Hello World" in the console.
You'll notice that there is an async function to be passed to the onEvent
method, we call it handler. You can put your bot logic in there.
Installation
You can install Bottender globally to use the cli tools:
npm install -g bottender
Or install it locally to use it programmatically:
npm install bottender
Contributing
Pull Requests and issue reports are welcome. You can follow steps below to
submit your pull requests:
Fork, then clone the repo:
git clone git@github.com:your-username/bottender.git
Install the dependencies:
cd bottender
yarn
Make sure the tests pass (including eslint, flow checks and jest tests):
yarn test
Make your changes and tests, and make sure the tests pass.
License
MIT © Yoctol
0.14.7 / 2017-11-30
messenger
- [new] Add
mapPageToAccessToken
to support multiple pages (Experimental) #47
new MessengerBot({
appSecret: '__FILL_YOUR_SECRET_HERE__',
mapPageToAccessToken: (pageId) => accessToken,
});
Note: API may changes between any versions.
line
- [new] Export
context.reply
and context.push
methods. #52 - [new] New CLI commands to sync LINE rich menus: #50
$ bottender line menu get
$ bottender line menu set
$ bottender line menu delete
slack
- [new] Add support to interactive messages, and you can get action from it: #41
if (context.event.isInteractiveMessage) {
console.log(context.event.action);
}