{"title":"Configure your store for the AI agent","slug":"configure-your-store-for-the-ai-agent","url":"https://support.storeconnect.com/articles/configure-your-store-for-the-ai-agent","url_markdown":"https://support.storeconnect.com/articles/configure-your-store-for-the-ai-agent.md","subtitle":null,"summary":"Deploy your Agentforce agent to your StoreConnect site by setting up an Embedded Service Deployment, creating a messaging channel with Omni-Channel routing, identifying logged-in customers via hidden pre-chat fields, and adding the chat code snippet to your store.","type":"Help_Documentation","video_url":"","keywords":"ai agent, agentforce, configure store, embedded service deployment, omni-channel, messaging channel, chat setup, pre-chat fields, customer identity, chat code snippet, ai chat, storeconnect ai","last_modified":"2026-08-21T07:12:35+0000","body_markdown":":::note\nThis topic relates to using AI agents to service your customers, not how to [use agents for building on StoreConnect](use-ai-agents-with-storeconnect).\n:::\n\n## Set up a standard embedded service deployment\n\n1.  In the Salesforce **Setup**, go to **Feature Settings \u003e Digital Experiences \u003e Settings.**\n\n2.  Select the **Enable Digital Experiences** option and **Save**.\n\n3.  Go to **Feature Settings \u003e Service\u003e Omni-Channel \u003e Routing Configurations.**\n\n4.  Create a new routing configuration:\n\n    -   Name e.g. Steve Sales Rep Routing\n\n    -   Routing Priority **1**\n\n    -   Routing Model **Most Available**\n\n    -   Units of Capacity **2.0**\n\n5.  **Save.**\n\n\n### Create a fallback queue\n\n1.  Go to **Users \u003e Queues** and create a new queue with **Messaging Session** enabled. This will be your fallback queue when the agent is not active. \n\n2.  Set the **Routing Configuration** to be the one you created previously.\n\n    ![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) \n\n\n### Add a flow\n\n1.  Go to **Flows** and select **New Flow**.\n\n2.  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.\n\n    ![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) \n\n3.  In the element manager, create 3 new text variables with inputs enabled. Call them **recordId**, **storeId**, and **customerId** (case sensitive).\n\n4.  Create a **Get Records** element which will query **MessagingSession** records where the record id = the recordId input variable.\n\n5.  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).\n\n6.  (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.\n\n7.  Create a ‘Route Work’ action and enter the following:\n\n    -   Set the Record Id Variable to be recordId, \n\n    -   Service Channel to be ‘Messaging’, \n\n    -   Route To ‘Agentforce Service Agent’\n\n    -   Agentforce Service Agent to your Agent\n\n    -   Fallback Queue to the queue record you created before.\n\n        ![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)\n\n8.  Save and activate the flow.\n\n\n### Create a new channel\n\n1.  Go to **Setup \u003e Messaging settings**.\n\n2.  Select **New Channel**.\n\n3.  Select **Next** and select **Enhanced Chat**. \n\n4.  Select **Next**.\n\n5.  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).\n\n6.  Select **Next**.\n\n7.  Set **Channel Routing** to the omniflow you created previously, and set the **Fallback Queue** to the queue created previously.\n\n    ![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)\n\n8.  **Save**.\n\n\n### Add custom parameters to the channel\n\n1.  Go back to the **Messaging Settings** tab and select your new channel. \n\n2.  Scroll to the **Custom Parameters** section and create two new parameters:\n\n    **Parameter 1 — store identity:**\n    -   Name: `storeId`\n    -   **Data Type**: string, maximum length 18\n    -   **Save**\n\n    **Parameter 2 — customer identity:**\n    -   Name: `customerId`\n    -   **Data Type**: string, maximum length 36\n    -   **Save**\n\n3.  In the **Parameter Mappings** section, create mappings for both parameters:\n    -   Map **storeId** to the **storeId** flow variable name.\n    -   Map **customerId** to the **customerId** flow variable name.\n\n4.  Go to **Feature Settings \u003e Service\u003e Embedded Service \u003e Embedded Service Deployments**. \n\n5.  Select **Embedded Service Deployment**\n\n6.  In the **Pre-Chat** field section:\n\n    -   Activate the pre-chat feature.\n\n    -   Select both **storeId** and **customerId** in the **Hidden Pre-Chat** fields.\n\n    -   **Save**.\n\n7.  You can customize the look and feel of the Agent here as well including avatars and branding.\n\n8.  Once you have made your changes, select **Publish**.\n\n9.  Copy the Chat Code snippet, you’ll use this on your StoreConnect site.\n\n:::note\nBecause 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.\n:::\n\n\n### Add the chat code snippet to the store\n\n1.  Navigate to your store record and on the page navigate to the ‘Body Content’ field.\n\n2.  Create or update a content block.\n\n    ![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) \n\n    -   Select **No added styling** as the **Content Template**.\n\n    -   Paste the chat code snippet into the **Content** field.\n\n    -   After the initEmbeddedMessaging function, add the following code to set the hidden pre-chat fields.\n\n        \n```liquid\n\n        {% if current_store %}\n\n          window.addEventListener(\"onEmbeddedMessagingReady\", function() {\n            embeddedservice_bootstrap.prechatAPI.setHiddenPrechatFields({\n              storeId: \"{{ current_store.id }}\"{% if current_customer %},\n              customerId: \"{{ current_customer.Id }}\"{% endif %}\n            });\n          });\n\n        {% endif %}\n        ```\n\n\n        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.\n\n3.  Select **Save**.\n\n:::tip\nFor 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).\n:::\n\nOpen your StoreConnect site and test the agent via the messaging window!"}