NOTE: This is a personal project. This component is not a productized Salesforce feature.
A Lightning Web Component (LWC) that lets you simulate Salesforce Personalization decision requests directly from within Salesforce. Drop it onto a Personalization Point record page and fire test calls against the POST /personalization/decisions API — no Postman or cURL required.
The Personalization Simulator builds and sends requests to the Salesforce Personalization Decisions API so you can quickly validate how a Personalization Point behaves for a given individual, data space, and set of context attributes.
Key capabilities:
- Auto-resolves the Personalization Point — When placed on a Personalization Point record page, the component automatically reads the record's API name and includes it in the request.
- Full context control — Set the Individual ID, Data Space, Locale, Anchor ID, Request URL, and any number of custom context attributes. Custom context attributes are usable in dynamic context filters
- Execution flags — Toggle
TestMode(no outputs recorded),EnableDiagnostics(diagnostic info in the response), andContextOnly(skip profile lookup) on or off. - Authenticated & standard endpoints — Switch between
POST /personalization/decisionsandPOST /personalization/authenticated/decisionswith a single toggle. (authenticated endpoint requires that you have configured a data cloud access token in the apex class of the component to process correctly) - Formatted JSON response — View the full API response with syntax highlighting, status badges, and one-click copy to clipboard.
- A Salesforce org with Salesforce Personalization enabled
- At least one Personalization Point configured
- Salesforce CLI (
sf) installed locally — Install Guide
git clone https://github.com/ebbmax/personalization-simulator.git
cd personalization-simulatorIf you haven't already authenticated with your target org:
sf org login web --alias my-org --set-defaultsf project deploy start --target-org my-orgThis deploys both components:
| Component | Type | Description |
|---|---|---|
PersonalizationSimulatorController |
Apex Class | Server-side controller that sends HTTP requests to the Personalization API |
personalizationSimulator |
Lightning Web Component | The UI that builds requests and displays responses |
Open PersonalizationSimulatorController.cls and update the getPersonalizationApiBaseUrl() method with your org's endpoint:
private static String getPersonalizationApiBaseUrl() {
return 'https://YOUR_TENANT.salesforce.com/services/data/v60.0';
}To find your orgs tenant endpoint, open up the data cloud setup page and scroll down until you see the "Your Home Org Details" section. In this section, copy the Tenant Endpoint. Open the standard setup page and search for Apex, click into Apex Classes and click edit on the PersonalizationSimulatorController. In the getPersonalizationApiBaseUrl method, paste in your tenant endpoint. It should replace everything after the https:// part in option 3.
If you plan to use the Authenticated Request toggle, update the getDataCloudAccessToken() method in the PersonalizationSimulatorController apex class with a valid Data Cloud access token:
private static String getDataCloudAccessToken() {
return 'YOUR_DATA_CLOUD_ACCESS_TOKEN';
}For guidance on generating a token, refer to the Data Cloud API Getting Started Guide.
NOTE: access tokens expire after 2hrs. You might need to generate a new access token and upate the apex class in order to perform authenticated personalization response simulations.
- Go to a Personalization Point record page in your org.
- Click the gear icon and select Edit Page to open Lightning App Builder.
- Drag the Personalization Simulator component onto the page layout.
- Save and activate the page.
Once on the record page:
- The Personalization Point name auto-populates from the record.
- Enter an Individual ID and adjust the Data Space, Locale, or other context fields as needed. (individual ID and data space are required)
- Add any Custom Context Attributes that your personalization logic depends on.
- Toggle Execution Flags —
TestModeandEnableDiagnosticsare on by default. - Click Send Request to fire the API call.
- Review the response JSON in the collapsible panel below. The status badge indicates success (green) or failure (red).
The LWC can be exposed on any page. The primary use case for this component revolves around adding it the personalizatiojn point related objects page.