How to launch Salesforce Messaging for In-App and Web after few seconds?

How to launch Salesforce Messaging for In-App and Web after few seconds?

We have to control the initEmbeddedMessaging() calling to launch Salesforce Messaging for In-App and Web after few seconds. instead of calling it in onload, we use setTimeout to call the function after few seconds.

Sample Code:

<html>
    <!--
        Copy Paste the Embedded Service Code Snippet here
    -->
  <script type='text/javascript' src='https://infallibletechiemiaw.my.site.com/ESWMessagingforInAppa1676392506026/assets/js/bootstrap.min.js'>    
  </script>

  <script>
    setTimeout( () => {
      console.log( 'Loading Messaging now' );
      initEmbeddedMessaging();
    }, 5000 );
  </script>
</html>

setTimeout() will delay launch Salesforce Messaging for In-App and Web.

Leave a Reply