Set up a standard embedded service deployment
In the Salesforce Setup, go to Feature Settings > Digital Experiences > Settings.
Select the Enable Digital Experiences option and Save.
Go to Feature Settings > Service> Omni-Channel > Routing Configurations.
Create a new routing configuration:
Name e.g. Steve Sales Rep Routing
Routing Priority 1
Routing Model Most Available
Units of Capacity 2.0
Save.
Create a fallback queue
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.
Set the Routing Configuration to be the one you created previously.

Add a flow
Go to Flows and select New Flow.
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.
In the element manager, create 2 new text variables with inputs enabled. Call one recordId and the other storeId (case sensitive).
Create a Get Records element which will query MessagingSession records where the record id = the recordId input variable.
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).
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.

Save and activate the flow.
Create a new channel
Go to Setup > Messaging settings.
Select New Channel.
Select Next and select Enhanced Chat.
Select Next.
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).
Select Next.
Set Channel Routing to the omniflow you created previously, and set the Fallback Queue to the queue created previously.

Save.
Add custom parameters to the channel
Go back to the Messaging Settings tab and select your new channel.
Scroll to the Custom Parameters section and create a new parameter.
Enter the storeId
In the Data Type field, select string with a maximum length of 18.
Save.
In the Parameter Mappings section, create a new mapping and map storeId to the storeId flow variable name.
Go to Feature Settings > Service> Embedded Service > Embedded Service Deployments.
Select Embedded Service Deployment
In the Pre-Chat field section:
Activate the pre-chat feature.
Select the storeId in the Hidden Pre-Chat field.
Save.
You can customise the look and feel of the Agent here as well including avatars and branding.
Once you have made your changes, select Publish.
Copy the Chat Code snippet, you’ll use this on your StoreConnect site.
Add the chat code snippet to the store
Navigate to your store record and on the page navigate to the ‘Body Content’ field.
Create or update a content block.
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 storeId pre-chat field.
{% if current_store %} window.addEventListener("onEmbeddedMessagingReady", function() { embeddedservice_bootstrap.prechatAPI.setHiddenPrechatFields({ storeId: "{{ current_store.id }}" }); }); {% endif %}
Select Save.
Open your StoreConnect site and test the agent via the messaging window!