Loading repository data…
Loading repository data…
mvrzan / repository
This repository holds the code and the implementation details of the Agentforce Personalization demo that was delivered at Salesforce Connections 2025.
This solution was presented at Salesforce Connections 2025, June 12th. It showcases how you can personalized your website based on a chat conversation you have with a Agentforce chatbot. The demo can be tested by going to the following link.
NOTE: You can ask about mobile devices, mobile plans, internet plans, bundles, entertainment or streaming options to trigger a personalization. Please keep in mind that the Agent will be able to understand only simple inquiries as this is just a simple demo.
DISCLAIMER: This software is to be considered "sample code", a Type B Deliverable, and is delivered "as-is" to the user. Salesforce bears no responsibility to support the use or implementation of this software.
This project demonstrates how to leverage Salesforce Personalization to tailor a user’s experience based on real-time chat interactions. By integrating an Agentforce chatbot with Salesforce Data Cloud event streaming, the application listens for user messages in chat sessions.
The chat messages are then picked up by the Salesforce backend and makes it ready for Salesforce Personalization.
When an incoming message is detected, it triggers a network call to the Salesforce Personalization which delivers individualized recommendations. This ensures that web content, product suggestions, and visual styling are dynamically adapted to each user’s conversation context, providing a customized and engaging experience.
The application flow is the following:
Client
deviceId is automatically generated by the Data Cloud Web SDK once the SDK is successfully loadeddeviceId is then provided to the Agentforce chat on every sent message via the Prechat APISalesforce Backend
deviceId from the Agent Actioncategory,idClient Personalization
Client
Salesforce
To run this application locally, you will need the following:
node -v in your terminal to check). Follow instructions if you don't have node installednpm version 10.0.0 or later installed (type npm -v in your terminal to check). Node.js includes npmgit installed. Follow the instructions to install gitThe first step is to clone the repository and install the project dependencies for the client folder via a terminal interface by running the npm install in the proper folder:
Client:
cd salesforce-connections-demo/client
npm install
The second step is to create a .env file in both the client folder. Find the .env.example files, copy and rename it to .env.
Client:
cd salesforce-connections-demo/client
cp .env.example .env
Edit the newly created .env files and update the variables with your account specific information.
# Salesforce Data Cloud details
VITE_DATA_CLOUD_WEB_SDK_URL=
# Embedded chat details
VITE_CHAT_ORG_ID=
VITE_CHAT_SCRIPT_URL=
VITE_CHAT_INSTANCE_URL=
VITE_CHAT_EMBEDDING_URL=
VITE_CHAT_EMBEDDING_API_NAME=
# Salesforce Personalization recommendation endpoint
VITE_PERSONALIZATION_ENDPOINT=
Once all of this is done, you are ready to run the application locally!
To run the application locally, use the command line, navigate to the client folder, ensure the dependencies are installed properly, and run the following:
cd salesforce-connections-demo/client
npm run dev
This will automatically run the development server. Your client app will run on http://localhost:5173.
When you make changes to your code, the server will automatically restart to fetch new changes.
In order for this application to work end to end, there are several Salesforce configuration steps that have to happen first.
Product Browse Engagement is the only DMO you should map for the behavioral events)Chat Activities, User Logged In, and User Logged Out are custom Data Model Objects that have a N:1 relationship to the Individual DMOPlease note that the
Chat Activities,User Logged In, andUser Logged Outare custom Data Model Objects and are NOT needed for this demo. They are here as an example if you want to track these custom events
Please note that if you don't want to use custom events, just use the
Product Browse Engagementin your real-time Data Graph
SELECT ssot__GoodsProduct__dlm.ssot__Id__c AS goodsProductsId__c, ssot__GoodsProduct__dlm.ssot__Name__c AS productName__c, COUNT(ssot__GoodsProduct__dlm.ssot__Id__c) AS ProductGeneral__c FROM ssot__GoodsProduct__dlm GROUP BY goodsProductsId__c,productName__c
Create two flows, one for the Agentforce chat and one for fetching product categories