1.0.4 • Published 6 years ago
customchannel v1.0.4
customchannel
A module to help with custom channel implementation for Avaamo
Installation
Current stable release (1.x.x
)
$ npm install customchannel --save
Loading and configuring the module
const customChannel = require('customchannel');
Usage
NOTE: The documentation below is up-to-date with 1.x.x
releases
// 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 channel = new customChannel(channelWebhook, channelUuid);
// Optionally provide first and last name for the user
channel.fname = 'John';
channel.lname = 'Doe';
// userUuid accepts a unique value for each user. This will be autogenerated if left blank
channel.userUuid = 'john.doe@gmail.com';
// Send the message to Avaamo
let message = 'Hi';
let send = channel.sendMessage(message);
// Parse response from Avaamo
send.then((response) => {
console.log("Reply: " + JSON.stringify(response));
}).catch((e) => console.log(e));