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

Introduction

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.33.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