---
schema_version: "1"
id: 704f683bb0567409ca809837489db6d54ce7c5cc4eece04fcefc4626261e5396
title: Get started With APIs for Enhanced Web Chat
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/service-cloud/messaging-web/guides/api-overview.md
canonical_url: https://developer.salesforce.com/docs/service/messaging-web/guide/api-overview.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 5767628059f46366f22fb2cd9dea0eb7adaf960d67842ed3c15777dfc090d9fd
products:
  - Enhanced Web Chat
  - Service Cloud Developer Content
---
# Get started With APIs for Enhanced Web Chat

To use the JavaScript APIs for Enhanced Web Chat, add the code snippet provided by Salesforce from your deployment settings to your web page. See [Enhanced Web Chat Reference](/docs/service/messaging-web/references) for more details on the APIs.

Here are the steps to configure your web page to use the Enhanced Web Chat APIs.

1. From Setup, in the Quick Find box, enter `Embedded Service Deployments`, and select **Embedded Service Deployments**. See [Configure an Enhanced Web Chat Deployment](https://help.salesforce.com/s/articleView?id=service.miaw_configure_web_deployment_1.htm) in Salesforce Help.
2. Click **Code Snippet**.

   ![Enhanced Web Chat Code Snippet](https://developer.salesforce.com/docs/media/messaging-web/setup-code-snippet-ui1.png)

3. To retrieve the code snippet, follow the on-screen instructions.

   ![Enhanced Web Chat Code Snippet](https://developer.salesforce.com/docs/media/messaging-web/setup-code-snippet-ui2.png)

4. Add the code snippet to your web page. Here’s an example of a code snippet.

   ```javascript
<script type='text/javascript'>
       function initEmbeddedMessaging() {
           try {
               // The language setting can have the format 'en' or 'en-US'.
               embeddedservice_bootstrap.settings.language = 'en_US';

               embeddedservice_bootstrap.init(
                   '000000000000000',
                   'ExampleDeployment',
                   'https://example.my.site.com/',
                   {
                       scrt2URL: 'https://example.my.salesforce-scrt.com'
                   }
               );
           } catch (err) {
               console.error('Error loading Embedded Messaging: ', err);
           }
       };
   </script>
   <script type='text/javascript' src='https://example.my.site.com/12345/assets/js/bootstrap.min.js' onload='initEmbeddedMessaging()'></script>
```

5. Add the Enhanced Web Chat APIs to your web page. You can call the APIs inside or outside the code snippet, but call them after the client dispatches the [`onEmbeddedMessagingReady`](/docs/service/messaging-web/guide/event-listeners.html) event. If you call the APIs before receiving this event, they don't execute.

   **note:** If your Enhanced Web Chat deployment is on an Experience Cloud site, follow the instructions in _Salesforce Help_ to add JavaScript code to the head markup section of your site. See [Configure an Enhanced Web Chat Deployment in an Experience Builder Site](https://help.salesforce.com/s/articleView?id=service.miaw_deployment_experience_builder.htm) in _Salesforce Help_.


6. To ensure that Enhanced Web Chat works optimally, always republish your deployment after testing newly added features and bug fixes. See [Configure an Enhanced Web Chat Deployment](https://help.salesforce.com/s/articleView?id=service.miaw_configure_web_deployment_1.htm) in Salesforce Help.
