Context Events in Enhanced Web Chat v2

This method of passing context events is only available in Enhanced Web Chat v2. For more information, see Enhanced Chat in Salesforce Help.

The optional utilAPI method enables you to pass information like the current page or a recent search to the agent. See the reference for setSessionContext.

You can also use the event handlers in the utilAPI.setSessionContext() method to perform actions after the context is set.

  • then event handler—If the context is set successfully, you can use this handler to, for example, update the UI or record analytics.
  • catch event handler—If there’s an error setting the context, you can use this handler to, for example, retry or display an error message.
  • finally event handler—This handler runs after the attempt to set context completes, whether it succeeds or fails. Use this handler to run any clean-up actions.