Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,26 @@ Removes the Persistent Menu.

----------------------

### Setup the embedded Express server

You may only want to set the behavior of the Express server running Bootbot.

#### `.use(expressMiddleware)`

Use this method to add middlewares to the embedded Express server

```javascript
'use strict';
const BootBot = require('bootbot');
const cookieParser = require('cookie-parser');

const bot = new BootBot();

bot.use(cookieParser());

bot.start();
```

### Bypassing Express

You may only want to use bootbot for the Facebook related config and the simple to use Send API features but handle routing from somewhere else. Or there may be times where you want to send a message out of band, like if you get a postback callback and need to end a conversation flow immediately.
Expand Down
4 changes: 4 additions & 0 deletions lib/BootBot.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ class BootBot extends EventEmitter {
this._conversations = [];
}

use(handlers) {
this.app.use(handlers)
}

start(port) {
this._initWebhook();
this.app.set('port', port || 3000);
Expand Down