0.2.1 • Published 6 years ago

bottender-botimize v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

Bottender Botimize

npm Build Status License: MIT

Middleware for using Botimize with Bottender.

Installation

npm install bottender-botimize

Example

const { MessengerBot } = require('bottender');
const { createServer } = require('bottender/express');
const botimizeMiddleware = require('bottender-botimize/express');

const bot = new MessengerBot({
  accessToken: '__FILL_YOUR_TOKEN_HERE__',
  appSecret: '__FILL_YOUR_SECRET_HERE__',
});

bot.onEvent(async context => {
  await context.sendText('Hello World');
});

const server = createServer(bot, {
  verifyToken: '__FILL_YOUR_VERIFY_TOKEN_HERE__',
  webhookMiddleware: botimizeMiddleware(bot, {
    apiKey: '__FILL_YOUR_BOTIMIZE_KEY_HERE__',
    platform: 'facebook',
  }),
});

server.listen(5000, () => {
  console.log('server is running on 5000 port...');
});

Server

Supported servers:

  • express
  • koa

express

const botimizeMiddleware = require('bottender-botimize/express');

koa

const botimizeMiddleware = require('bottender-botimize/koa');

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-botimize.git

Install the dependencies:

cd bottender-botimize
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