Events are used to get notified on events from the SDK, such as customer actions, expert actions, or technical events such as login events.
Available events are:
Events Args:
MESSAGE_RECEIVED
| Property | type |
| type | string (text, image, video, other) |
| message | string |
| from | string |
MESSAGE_SENT
| Property | type |
| type | string (text, image, video, other) |
| message | string |
| metadata? | MetaData |
| sessionId? | string |
SEND_MESSAGE_FAILED
| Property | type |
| type | string (text, image, video, other) |
| message | string |
| metadata? | MetaData |
| sessionId? | string |
| error? | any |
MetaData
| Property | type |
| senderType | Device \ | Team |
| messagingPool | string |
| expertise | string |
SESSION_CHANGED
| Property | type |
| action | string (created, assigned, resolved, cancelled, escalated) |
| sessionId? | string |
| expertId? | string |
LOGGED_IN
Events Args:
| Property | type |
| token | string |
| homeUserId | string |
LOGGED_OUT
No payload.
LOGIN_FAILED
PROACTIVE_EXPERIENCE_VIEWED
| Property | type |
| experienceType | string |
TOKEN_IS_ABOUT_TO_EXPIRE
No payload.
TIMELINE_ITEM_SKIPPED
| Property | type |
| itemContentId | string |
FABIO_CLICKED
| Property | type |
| isExpanded | boolean |
CHAT_TOGGLE_ANIMATION_ENDED
| Property | type |
| isExpanded | boolean |
Example of registering to events:
const registerToEvents = (eventEmitter: any) => {
eventEmitter.on('NEW_MESSAGE', (args: any) => {
console.log('registerEventEmitter NewMessage', args);
});
eventEmitter.on('ACTION', (args: any) => {
console.log('registerEventEmitter Action', args);
});
};
AE_SDK.initialize('APPKEY', { registerToEvents });
Last updated on 10/1/2020 by Maor