--- title: Embed Engagement Messenger in your web application description: Embed the source code of the messenger module that you configured in your website so that you can enable your customers to start using Engagement Messenger in your website. locale: en-US canonical_url: https://www.servicenow.com/docs/r/australia/customer-service-management/customer-self-service-and-omnichannel-engagement/embed-engagement-messenger-code-in-your-web-application.html release: australia product: Customer Self-service and Omnichannel Engagement classification: customer-self-service-and-omnichannel-engagement topic_type: task last_updated: "2026-03-12" reading_time_minutes: 3 breadcrumb: [Engagement Messenger, Set up self-service, Configure, Customer Service Management] --- # Embed Engagement Messenger in your web application Embed the source code of the messenger module that you configured in your website so that you can enable your customers to start using Engagement Messenger in your website. ## Before you begin - [Activate an Engagement Messenger module](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/customer-service-management/customer-self-service-and-omnichannel-engagement/activate-engagement-messenger-module.md). - Role required: sn\_csm\_ec.ec\_admin ## About this task Copy the source code of the messenger module that you activated and paste it in the HTML file of the website where you want to deploy the messenger. Next, depending on the authentication type that you selected for your configured messenger module, you may have to write code for functions to get the ID token and to start and stop the session for a logged-in user in the messenger. ## Procedure 1. Navigate to **All** > **Engagement Messenger** > **Modules**. 2. In the Edit module column of the messenger module that you want to install in your website, click **Edit**. The guided configuration view is displayed. 3. Click the **Implement** tab. 4. If you have done any changes to the Security settings section, click **Save**. The code of the Engagement Messenger module is updated. 5. Scroll down to the Embed code section and click **Copy code**. 6. Open the HTML file of your website and paste the copied code before the closing body tag. 7. For a messenger module with OIDC-based or SAMl-based authentication, complete the following configuration.
| Authentication type | Action |
|---|---|
| **OIDC-based** | 1. Write code for the getTokenCallBack\(\) function. 2. Call the SN\_CSM\_EC.onLogin\(\) function whenever users log in to your website. This function enables authenticated users to log in to Engagement Messenger seamlessly when they log in to your website. 3. Call the SN\_CSM\_EC.onLogout\(\) function whenever users log out from your website. This function enables authenticated users to seamlessly log out from Engagement Messenger and your website. |
| **SAML-based** | 1. Call the SN\_CSM\_EC.onLogin\(\) function whenever users log in to your website. This function enables authenticated users to log in to Engagement Messenger seamlessly when they log in to your website. 2. Call the SN\_CSM\_EC.onLogout\(\) function whenever users log out from your website. This function enables authenticated users to seamlessly log out from Engagement Messenger and your website. |