Event Listeners
These events can be accessed from the addEventListener
method for the window.
This event is dispatched when the Salesforce JavaScript API for Messaging is ready to use. At this point, you can make calls such as setIdentityToken
and setHiddenPrechatFields
.
To let you know that the API is ready for calls, this method is called in the following situations.
- Whenever a new page with the web client is loaded.
- For user-verified conversations: after the user logs out (
userVerificationAPI.clearSession
is called) and the API is ready for another conversation. - For anonymous conversations: after the conversation has ended and the user closes the chat window.
This event is dispatched when the user verification token has expired. If you want to continue the session, you can renew the token and then call setIdentityToken
with the renewed token. If you don't respond within 30 seconds, the messaging session and user data are automatically cleared. If you want to explicitly clear the session before the 30 seconds have expired, you can call clearSession
.