Salesforce Integration
This guide explains how to send Salesforce CRM events as goal events to ABsmartly using Salesforce Flow HTTP Callouts. This allows you to track CRM activities — such as opportunity creation, case submission, or lead conversion — as metrics in your experiments.
Prerequisites
- ABsmartly account with access to the Web Console and a valid SDK API Key.
API Keys can be created under
Settings > API Keysin the ABsmartly Web Console. - Salesforce org with access to Flow Builder and the ability to create Named Credentials and External Services.
- A unit type (e.g.
user_idoremail) that is shared between your ABsmartly experiments and your Salesforce records so that events can be attributed to the correct user.
Step 1 — Create a Named Credential
Named Credentials store the ABsmartly endpoint and authentication details securely.
- In Salesforce Setup, search for Named Credentials.
- Click the dropdown on New and select New Legacy.
- Fill in the details:
- Label:
ABsmartly Collector - Name:
ABsmartly_Collector - URL: Your ABsmartly Collector endpoint. For example:
https://your-subdomain.absmartly.io/v1 - Identity Type:
Named Principal - Authentication Protocol:
No Authentication(authentication will be handled via custom headers in the Flow)
- Label:
- Click Save.
Step 2 — Create a Flow with an HTTP Callout
- In Salesforce Setup, go to Flows and click New Flow.
- Select Record-Triggered Flow and click Create.
- Configure the trigger:
- Object: Choose the object to track (e.g.
Casefor support cases). - Trigger the Flow When:
A record is created. - Condition Requirements: Configure any filters (optional).
- Object: Choose the object to track (e.g.
- Add an Action element and select Create External Service or HTTP Callout.
- Configure the HTTP Callout:
- External Service: Select the
ABsmartly_CollectorNamed Credential. - Method:
PUT - URL Path:
/context
- External Service: Select the
- Define the request body. Use a JSON template with values from the triggering record:
{
"publishedAt": "{!TEXT($Flow.CurrentDateTime)}",
"units": [
{
"type": "email",
"uid": "{!$Record.Contact.Email}"
}
],
"goals": [
{
"name": "salesforce_case_created",
"achievedAt": "{!TEXT($Flow.CurrentDateTime)}",
"properties": {
"case_id": "{!$Record.CaseNumber}",
"subject": "{!$Record.Subject}",
"priority": "{!$Record.Priority}",
"origin": "{!$Record.Origin}"
}
}
]
}
- Add the required headers in the callout configuration:
| Header | Value |
|---|---|
X-API-Key | Your ABsmartly SDK API Key |
X-Application | The application name matching your ABsmartly Web Console (e.g. www) |
X-Application-Version | 0 |
X-Environment | The environment name matching your ABsmartly Web Console (e.g. production) |
X-Agent | salesforce-flow |
Content-Type | application/json |
- Click Save and Activate the Flow.
info
The
X-Application and X-Environment values must match existing entries in your ABsmartly Web Console under Settings > Applicationsand Settings > Environments.tip
Adjust the
units type and value to match the unit type you use in your ABsmartly experiments. For example, if your experiments use a user_id unit, you may need to reference a custom Salesforce field that stores the user ID.Step 3 — Create the Goal in ABsmartly
- In the ABsmartly Web Console, go to Settings > Goals.
- Create a new goal with a name matching the
namein your Flow payload (e.g.salesforce_case_created). - You can now use this goal as a metric in any of your experiments.
Tracking Different CRM Events
You can create multiple Flows to track different Salesforce events as separate goals:
- Opportunity closed won — Trigger on
OpportunitywhereStageName = Closed Won, goal name:salesforce_opportunity_won. - Lead converted — Trigger on
LeadwhereIsConverted = true, goal name:salesforce_lead_converted. - Case closed — Trigger on
CasewhereStatus = Closed, goal name:salesforce_case_closed. - New account created — Trigger on
Accountcreation, goal name:salesforce_account_created.
Verifying the Integration
- Create a test record in Salesforce (e.g. a new Case) associated with a user whose identifier is also being tracked in an ABsmartly experiment.
- Check the ABsmartly Web Console under the experiment's goals to verify the event was received.
- In Salesforce, check the Flow's Debug Log or Paused and Failed Flow Interviews to confirm the HTTP callout was successful.
caution
Test your Flow in a Salesforce Sandbox environment before activating it in Production to avoid unexpected API calls.
If you have any issues setting up the Salesforce integration, please contact us at [email protected].