1.0.7 • Published 5 years ago
botflow v1.0.7
BotFlow
JavaScript (nodejs) library that accepts Twilio Studio alike JSON configuration files and provides the same functionality on an independent back-end service.
Features
- Data gathering over a bot-conversation & sending to remotes;
- Sending message to client & awaiting for response to continue the flow;
- Message templating and variable injection using handlebars;
- Action Triggers
split-based-on,send-message,make-http-request(see usecases at/examples/*); - Condition triggers
regex,equal_to,not_equal_to,matches_any_of(see usecases at/examples/json/*); - Populates remote response data into scope;
How to?
- Install yarn globally with
npm i -g yarn; Ideally you'd like to build it with
yarn buildand import from/bin;- Run example survey:
yarn test:survey; - Run example appointment:
yarn test:appointment;
- Run example survey:
You can also
npm i botflowthen use following example:
const BotFlow = require('botflow');
const Configuration = require('./JSON_CONFIG_FILE_PATH.json');
const instance = new BotFlow(
{
From: 'SENDER_ID/NAME/REFERENCE',
To: 'RECEIVER_ID/NAME/REFERENCE'
},
Configuration
);
(async () => {
const reply = await instance.query('start');
console.log(reply);
console.log(instance);
})();Libraries used:
node-fetchhttps://www.npmjs.com/package/node-fetchnode-cachehttps://www.npmjs.com/package/node-cachehandlebarshttps://handlebarsjs.com/
TODOs:
- Create npmjs package;
- Write a documentation;
- Improvements and more customization;
Notes:
- Project is heavily inspired by Twilio Studio and Chatflows as on https://www.twilio.com/console/studio.
- This is a a hobby project & early version therefore slight changes will/might be applied anytime.
- You can always make a pull request in case of a good contribution.
Built with ♥ by https://github.com/artuuro