Skip to main content

Hi all,

Had a question about initializing MIAW sessions in a custom wrapper. Calling the original code snippet for initialization works, however, when the wrapper is destroyed (the modal containing the MIAW session is destroyed) and re-opened, a second initialization attempt fails. I tried looking through the MIAW documentation to find anything like a recipe for how this lifecycle is is supposed to be handled (e.g. does the chat need to programmatically destroyed, or should a check run against the original initialization and call a slimmed down version of the snippet to populate the same chat?).

Thanks in advance!

1 respuesta
  1. 22 abr 2024, 17:17

    Hi @Davis Johnson.

     

    Modal? for a chat session?

     

    onEmbeddedMessagingIdentityTokenExpired 

    The client dispatches the onEmbeddedMessagingIdentityTokenExpired event when you interact with the client after both the Salesforce authorization token and identity token have expired. If the Salesforce authorization token expires, but the identity token is still valid, the client generates a new Salesforce authorization token and keeps the session active without sending the onEmbeddedMessagingIdentityTokenExpired event.

    If you want to continue the session but the identity token has expired, you can renew the token and send it to the client using the setIdentityToken method in the event handler. The messaging session and user data are cleared automatically if you don't respond within 30 seconds of the onEmbeddedMessagingIdentityTokenExpired event being dispatched. If you want to clear the session before the 30 seconds have expired explicitly, you can call the clearSession method.

    https://developer.salesforce.com/docs/service/messaging-web/references/m4w-reference/event-listeners.html

    Perhaps this problem.

0/9000