User Verification in Messaging for Web
To learn about and set up User Verification, see User Verification in Salesforce Help.
This section describes the steps you must take from your web client to ensure a personalized and secure conversation between a verified user and an agent. See the associated documentation for each step of this sequence.
- Before you initialize the API from the code snippet that we provide, add event listeners for two events.
onEmbeddedMessagingReadynotifies you when the API is ready for requests.
onEmbeddedMessagingIdentityTokenExpirednotifies you if the identity token has expired.
- At some point after the
onEmbeddedMessagingReadyevent is dispatched, pass the identity token to the API using the
setIdentityTokenmethod. You must call this API for every tab or window where you want the user to have an authenticated conversation. Since the token is stored in the browser’s memory, you must also call this method after a page refresh. JWTs must be signed using the RS256 algorithm.
- When the identity token expires, the
onEmbeddedMessagingIdentityTokenExpiredmethod is dispatched. You have approximately 30 seconds to update the token and call the
setIdentityTokenmethod with the new token. If you don't respond within 30 seconds, the messaging session and user data are automatically cleared.
- When the user logs out, call
clearSession. This method clears all messaging and user data from all tabs and windows. When the API is ready for another conversation,
onEmbeddedMessagingReadyis dispatched again.
Be sure to call
setIdentityToken for every tab or window where you want access to the authorized messaging conversation. Also, call
clearSession when the user logs out.
This sample code illustrates how you can implement the key steps of this sequence.
The Messaging for Web reference documentation describes these methods in more detail.