Developer/IT > Whisbi API > API Reference > Events > Introduction

Introduction


Notice: rest_validate_value_from_schema was called incorrectly. The "type" schema keyword for can only be one of the built-in types: array, object, string, number, integer, boolean, and null. Please see Debugging in WordPress for more information. (This message was added in version 5.5.0.) in /nas/content/live/whisbihc/wp-includes/functions.php on line 5229

These are all the events of the Whisbi widgets. Use them to bind listeners to specific events in the Whisbi experience, in order to trigger actions in your part when they occur.

EXAMPLE

var conf = {
version: '1.32.0',
api: {...},
general: {...},
oneToMany: {...},
oneToOne: {...},
events: {
checkScoreBeforeWidgetLoaded: checkScoreBeforeWidgetLoaded,
widgetLoaded: widgetLoaded,
otoCmbRequested: otoCmbRequested,
otoPreSessionRequest: otoPreSessionRequest,
chatbotBeforeDataCollect: chatbotBeforeDataCollect
}
};
whisbi.setup(conf);

function checkScoreBeforeWidgetLoaded() {
console.log('Widget with scoring data');
}

function widgetLoaded() {
console.log('Widget loaded');
}

function otoCmbRequested(data) {
console.log('Lead:', data.lead);
}

function otoPreSessionRequest (data, done) {
// Modify data received
data.callCenters = ['callCenter_01', 'callCenter_02'];
data.customer.extra = 'extra info';
// Send back data modified to request a session
done(result);
}

function chatbotBeforeDataCollect (data, done) {
console.log('Node:', data.nodeId);
// Notify you are done
done();
}
Copy Code