Every time the current conversation changes (for example, when you click a new conversation in the list), an event is sent to our library. We can listen to these events and operate on them like this.
Front.on('conversation', function (data) {
// triggered when a conversation is loaded
});
Front.on('no_conversation', function () {
// triggered when no conversation is selected
});
Front.on('panel_visible', function (visible) {
// triggered when your plugin becomes visible or invisible
// you can also test Front.visible
});
The data object set to the callbacks of the event contains four fields:
contact
The conversation's contactconversation
The conversation objectmessage
The most recent message objectotherMessages
an array of the following messages