avaamo-customchannel
v1.7.3
Published
A connector to Avaamo bot engine using the custom channel in synchronous mode
Downloads
21
Readme
Avaamo custom channel integration
A module to help with custom channel implementation for Avaamo
Installation
Current stable release (1.3.x
)
$ npm install avaamo-customchannel
Loading and configuring the module
const { Avaamo } = require('avaamo-customchannel');
Usage
NOTE: The documentation below is up-to-date with 1.x.x
releases
// User details
var userId = '[email protected]';
var fname = 'John';
var lname = 'Doe';
// Get the channel webhook URL and the channel UUID from the custom channel settings
var channelWebhook = 'https://c*.avaamo.com//bot_connector_webhooks/7086c1cb-c055-4981-81c9-9e0b9fd8166a/message.json';
var channelUuid = 'b3024f50-2116-47b2-8e28-10c0feb08270';
// Initialize the channel
var avaamo = new Avaamo(userId, channelWebhook, channelUuid, fname, lname);
avaamo.query('hello there').then(responses => console.log(responses));
Parser
Parser is a useful class that can help you parse the JSON response from avaamo.query()
into structured classes. You will need to import the Parser class in addition to the Avaamo class
const { Avaamo, Parser } = require('avaamo-customchannel');
// Initialize the channel
var avaamo = new Avaamo(userId, channelWebhook, channelUuid, fname, lname);
// Query the channel and parse the response
avaamo.query('hello there').then((responses) => {
for (let i = 0; i < responses.length; i++) {
let parser = new Parser(responses[i]);
let reply = parser.parse();
console.log(reply);
}
});
Other parsers
- TeamsParser
- [SlackParser]