# Configure your store for the AI agent

Source: https://support.storeconnect.com/articles/configure-your-store-for-the-ai-agent · Last modified 21 August 2026

:::note
This topic relates to using AI agents to service your customers, not how to [use agents for building on StoreConnect](use-ai-agents-with-storeconnect).
:::

## Set up a standard embedded service deployment

1.  In the Salesforce **Setup**, go to **Feature Settings > Digital Experiences > Settings.**

2.  Select the **Enable Digital Experiences** option and **Save**.

3.  Go to **Feature Settings > Service> Omni-Channel > Routing Configurations.**

4.  Create a new routing configuration:

    -   Name e.g. Steve Sales Rep Routing

    -   Routing Priority **1**

    -   Routing Model **Most Available**

    -   Units of Capacity **2.0**

5.  **Save.**


### Create a fallback queue

1.  Go to **Users > Queues** and create a new queue with **Messaging Session** enabled. This will be your fallback queue when the agent is not active. 

2.  Set the **Routing Configuration** to be the one you created previously.

    ![Fallback queue](https://res.cloudinary.com/hzkr6fi81/image/upload/v1765236267/knowledge/AgentforceAI/Configure_your_store_for_the_AI_agent_0-add-a-fallback-queue_fxrhis.png) 


### Add a flow

1.  Go to **Flows** and select **New Flow**.

2.  Set the **Flow Type** to **Omni-Channel Flow**. If you can't see the option, you may need to switch on the **Omni-Channel** option in your Salesforce settings.

    ![OmniChannel Flow type](https://res.cloudinary.com/hzkr6fi81/image/upload/v1765261585/knowledge/AgentforceAI/Configure_your_store_for_the_AI_agent_2-create-omni-flow_qmmqyd.png) 

3.  In the element manager, create 3 new text variables with inputs enabled. Call them **recordId**, **storeId**, and **customerId** (case sensitive).

4.  Create a **Get Records** element which will query **MessagingSession** records where the record id = the recordId input variable.

5.  Update the **MessagingSession** record with the **recordId**, saving it to a custom field ‘StoreId\_\_c’ (can be a text or lookup field to the Store record).

6.  (Optional) To associate the session with a known customer: add a **Get Records** element to look up a **Contact** where `s_c__Id__c` equals the **customerId** variable. If a match is found, add an **Update Records** element to set the **ContactId** field on the MessagingSession record. This links the session to the customer’s record before the agent takes over.

7.  Create a ‘Route Work’ action and enter the following:

    -   Set the Record Id Variable to be recordId, 

    -   Service Channel to be ‘Messaging’, 

    -   Route To ‘Agentforce Service Agent’

    -   Agentforce Service Agent to your Agent

    -   Fallback Queue to the queue record you created before.

        ![Configure omniflow flow](https://res.cloudinary.com/hzkr6fi81/image/upload/v1765236268/knowledge/AgentforceAI/Configure_your_store_for_the_AI_agent_3-omni-flow-elements_biraol.png)

8.  Save and activate the flow.


### Create a new channel

1.  Go to **Setup > Messaging settings**.

2.  Select **New Channel**.

3.  Select **Next** and select **Enhanced Chat**. 

4.  Select **Next**.

5.  Enter a channel name, set the deployment type to **Web**, and enter your store’s domain (you can find this on your store record in StoreConnect).

6.  Select **Next**.

7.  Set **Channel Routing** to the omniflow you created previously, and set the **Fallback Queue** to the queue created previously.

    ![Channel routing setup](https://res.cloudinary.com/hzkr6fi81/image/upload/v1765261695/knowledge/AgentforceAI/Configure_your_store_for_the_AI_agent_5-channel-routing_uy1oic.png)

8.  **Save**.


### Add custom parameters to the channel

1.  Go back to the **Messaging Settings** tab and select your new channel. 

2.  Scroll to the **Custom Parameters** section and create two new parameters:

    **Parameter 1 — store identity:**
    -   Name: `storeId`
    -   **Data Type**: string, maximum length 18
    -   **Save**

    **Parameter 2 — customer identity:**
    -   Name: `customerId`
    -   **Data Type**: string, maximum length 36
    -   **Save**

3.  In the **Parameter Mappings** section, create mappings for both parameters:
    -   Map **storeId** to the **storeId** flow variable name.
    -   Map **customerId** to the **customerId** flow variable name.

4.  Go to **Feature Settings > Service> Embedded Service > Embedded Service Deployments**. 

5.  Select **Embedded Service Deployment**

6.  In the **Pre-Chat** field section:

    -   Activate the pre-chat feature.

    -   Select both **storeId** and **customerId** in the **Hidden Pre-Chat** fields.

    -   **Save**.

7.  You can customize the look and feel of the Agent here as well including avatars and branding.

8.  Once you have made your changes, select **Publish**.

9.  Copy the Chat Code snippet, you’ll use this on your StoreConnect site.

:::note
Because StoreConnect manages its own customer authentication independently of Salesforce, Agentforce sessions always start as guest sessions. Passing `customerId` as a hidden pre-chat field and associating it with a Contact record in the Omni flow is how you give the agent context about who it is talking to. If the visitor is not logged in, the `customerId` field will be empty and the session proceeds as a true anonymous interaction.
:::


### Add the chat code snippet to the store

1.  Navigate to your store record and on the page navigate to the ‘Body Content’ field.

2.  Create or update a content block.

    ![Content block with chat code](https://res.cloudinary.com/hzkr6fi81/image/upload/v1765236269/knowledge/AgentforceAI/Configure_your_store_for_the_AI_agent_7-embedded-deployment-snippet_npszig.png) 

    -   Select **No added styling** as the **Content Template**.

    -   Paste the chat code snippet into the **Content** field.

    -   After the initEmbeddedMessaging function, add the following code to set the hidden pre-chat fields.

        
```liquid

        {% if current_store %}

          window.addEventListener("onEmbeddedMessagingReady", function() {
            embeddedservice_bootstrap.prechatAPI.setHiddenPrechatFields({
              storeId: "{{ current_store.id }}"{% if current_customer %},
              customerId: "{{ current_customer.Id }}"{% endif %}
            });
          });

        {% endif %}
        ```


        The `customerId` value is the StoreConnect UUID stored in the `s_c__Id__c` field on the Contact record. It is only set when a customer is logged in — for guest visitors the field is omitted and the session proceeds anonymously.

3.  Select **Save**.

:::tip
For mid-session identity verification, Salesforce's built-in OTP flow (email or SMS) lets you verify a customer's identity during a conversation without requiring them to log in first. To use a tamper-proof signed token instead of a plain ID, see [Embed Salesforce LWC components in your storefront](embed-salesforce-lwc-components-in-your-storefront).
:::

Open your StoreConnect site and test the agent via the messaging window!

---

## Follow StoreConnect

- [Email Newsletter](https://getstoreconnect.com/c/lp-newsletter)
- [LinkedIn Newsletter](https://www.linkedin.com/build-relation/newsletter-follow?entityUrn=7444956928444862464)
- [YouTube](https://www.youtube.com/channel/UCngKdP2x8l1wcbAKW3tvU8g)
- [LinkedIn](https://www.linkedin.com/company/storeconnect)
- [X / Twitter](https://x.com/storeconnecthq)

## Popular Links

- [Partners](https://getstoreconnect.com/partners)
- [News](https://getstoreconnect.com/articles/news)
- [Events](https://getstoreconnect.com/articles/events)
- [Feature Comparison](https://getstoreconnect.com/how-we-compare)
- [Download a free trial](https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000FMkeKUAT)
- [Book a Demo](https://getstoreconnect.com/contact)

## Documentation

- [Help documentation](https://support.storeconnect.com/help-documentation)
- [AI agents](https://support.storeconnect.com/ai)
- [Videos & tutorials](https://support.storeconnect.com/videos-tutorials)
- [Developer reference](https://support.storeconnect.com/developer-reference)
- [Release notes](https://support.storeconnect.com/release-notes)
- [Troubleshooting](https://support.storeconnect.com/troubleshooting)
- [Trust Center](https://trust.getstoreconnect.com/)
- [Status Page](https://status.storeconnect.com/)

## Contact

- info@getstoreconnect.com
- US +1 415 745 3230
- AUS +61 2 8365 2308

100 S Ashley Dr, Suite 600-2461
Tampa FL 33602-600 USA

Level 22, Sydney Place
180 George Street
Sydney, NSW, 2000, AUS

---

StoreConnect Support — https://support.storeconnect.com/articles/configure-your-store-for-the-ai-agent