Overview
The integration between Salesforce and Lusha's Person API enables efficient contact data enrichment by pulling accurate and detailed information directly into Salesforce.
Use case
This feature is particularly valuable for enhancing CRM data with verified details such as job titles, phone numbers, and emails, ensuring sales and outreach teams have the most up-to-date information.
By automating the process through workflows and API calls, users can save time, reduce manual data entry errors, and boost productivity. Ideal for organizations on Lusha's Scale plans, this integration streamlines data enrichment, improves targeting accuracy, and equips teams with the insights needed for personalized and effective engagement.
Requirements
This workflow requires an active Salesforce subscription with the necessary Flow function enabled, along with the inclusion of Lusha resources (such as an API token for the account and available bulk credits).
A credit will be consumed only when a match is successfully found.
Lusha’s API key can be found here (visible only by Lusha admins or managers).
How it works?
Step 1: Create a Named Credential
Navigate to Named Credentials: From the Salesforce Setup, go to the Named Credentials section.
Create an External Credential: Set up an external credential with no authentication needed.
Use Lusha’s Person v2 API: Input the Person V2 API URL from Lusha’s documentation while creating the named credential.
Add Headers:
Add a header named api_key with your actual Lusha API key as the value.
Add a second header named Accept with the value set as */*.
Step 2: Build the Flow for Contact Enrichment
Start a New Workflow: In Salesforce, create a new screen flow with a Free Form layout.
Under the Toolbox Manager, create the following Variables and choose the Text Data Type for all:
Choose the Get Records element and drag it to your layout. In the Get Records element, choose the Contact object.
Under the Filter Contact Records, make sure you choose the All Conditions Are Met requirement, then choose the ID field on your Contact object > Equals operator > recordId variable that we created.
5. Next, drag an Action element onto the layout. Give the Action a name you will remember (LushaContactAPI for example), and connect the Named Credential we created in Step 1, with the Persom v2 API URL.
6. Under the Query Parameter Values, choose Contact from get_related_contact and then choose the field that stores the relevant contact details - First Name, Last Name, and Company Name/Domain (or email /+ LinkedIn URL for higher match accuracy).
Step 3: Create Formulas for Data Points
For each API field you wish to populate (e.g., job title), create a formula to extract the data from the API response (not including phone or email):
Create a Formula for Each Data Point:
In Toolbox > New Resource > Formula, select the corresponding data from the API response (e.g., [Output]>2xx>Data>jobTitle).
Set the correct data type (e.g., Text for job_title).
Continue to create Formulas this way for each data point that you will want to use in your Update Records stage.
Detailed Logic for Email Field (Work vs Personal)
This Decision checks if the email array (emailAddresses) is not null. Based on that, we take one of two paths: retrieve emails or skip to the phone array if empty -
Drag a Decision element and label it Has Email Addresses?
Add two outcomes:
Has Emails
Condition: emailAddresses Is Null Equals False
o This means the list contains at least one email.
No Emails
Condition: emailAddresses Is Null Equals True
o This means the API returned no emails, and we can exit or branch accordingly.
Loop: emailAddresses
If emails do exist, The Loop takes the email array and lets us process each email address individually -
Drag in a Loop element and label it emailAddresses
Set the Collection Variable to the API’s email array (e.g., [Output]>2xx>Data>emailAddresses)
Decision: Is Primary or Secondary Email Empty?
This Decision checks if primaryEmail or secondaryEmail variables are already populated. The logic is:
If primaryEmail is not set, assign the current email as primary.
o If primaryEmail is set, but secondaryEmail is still empty, assign the current email as secondary.
o If both are filled, do nothing for the rest of the loop.
Drag a Decision element and name it Is Primary or Secondary Empty?
Add two outcomes:
Primary Not Set
o Condition: primaryEmail Is Null Equals True
o This is triggered only if primaryEmail is still empty.
Assign Secondary Email
Condition 1: primaryEmail Is Null Equals False
AND
Condition 2: secondaryEmail Is Null Equals True
o This ensures the current email is the second one being processed.
Assignment – Storing Primary and Secondary Emails
Once we know whether to treat the current item as a primary or secondary email, we use Assignment elements to store the values into dedicated variables.
Assigning the Primary Email
This happens only if the primaryEmail variable is still empty, decided in the “Is Primary or Secondary Empty?” step.
Label: Assign Primary Email
Variable: primaryEmail
Operator: Equals
Value:
o Use the loop variable created by the Loop element.
Assigning the Secondary Email
If primaryEmail is already filled but secondaryEmail is still empty, we assign the current loop item as secondary.
Label: Assign Secondary Email (2)
Variables and Values:
o secondaryEmail = {!emailAddresses.email}
o secondaryEmailType = {!emailAddresses.emailType}
Detailed Logic for Phone Field
This Decision checks if the email array (emailAddresses) is not null. Based on that, we take one of two paths: retrieve phones or skip to the Update Records stage -
Drag a Decision element and lable it Has Phone Numbers?
Add two outcomes:
Has Phones
Condition: phoneNumbers Is Null Equals False
o This means the list contains at least one phone
No Phones
Condition: phoneNumbers Is Null Equals True
o The flow skips further phone logic if no data is returned
Loop: phoneNumbers
If phones do exist, The Loop takes the phone array and lets us process each phone number individually -
Drag in a Loop element and label it phoneNumbers
Set the Collection Variable to the API’s phone arra (e.g., [Output]>2xx>Data>phoneNumbers)
Decision: Is Primary or Secondary Phone Empty?
This Decision checks if phoneNumber1 (primary) or phoneNumber2 (secondary) are unassigned. The logic is:
Drag a Decision element and name it Is Primary or Secondary Empty?
Add two outcomes:
Primary Phone Not Set
o Condition: phoneNumber1 Is Null Equals True
o If no primary number has been assigned yet, assign this one.
Assign Secondary Phone
Condition 1: phoneNumber1 Is Null Equals False
AND
Condition 2: phoneNumber2 Is Null Equals True
o This ensures the secondary number is the second one being processed.
Assignment – Storing Primary and Secondary Phone Numbers
After we’ve determined whether a phone number should be primary or secondary, we store it in the correct variable using Assignment elements.
Assigning the Primary Phone
This happens only if the phoneNumber1 variable is still empty, as determined in the prior decision step.
Label: Assign Primary Phone
Variables and Values:
o phoneNumber1 = {!phoneNumbers.phoneNumber}
o phoneType1 = {!phoneNumbers.phoneType}
Assigning the Secondary Phone
If phoneNumber1 is already filled but phoneNumber2 is still null, we assign the current loop item as secondary.
Label: Assign Secondary Phone (2)
Variables and Values:
o phoneNumber2 = {!phoneNumbers.phoneNumber}
6. Update Contact Records:
Use the Update Records element to specify which Contact fields to update.
Under How to Find Records to Update choose the Specify conditions option, and then choose the Contact object.
Choose the All Conditions Are Met (AND) option, then choose your Contact ID field > Operator Equals > under the value select the recordId variable we created in part 2.Map each contact field to the respective formula created from the API response (e.g., map the Job Title formula to the Contact’s Job Title field).
7. Save and Debug: After assigning the Update Contact element, save your flow and run a debug using a Contact ID to test the API call and see the response.
The end result should look similar to this:
Add a Button to Trigger the Flow
1. Go to Setup > Object Manager > Contact > Buttons, Links, and Actions.
2. Create a new action that triggers the flow created earlier.
3. Under the Contact Page Layout, you can choose where to position the button on the Contact page so that the users can have access to enrich the Contact with the person data from Lusha.
Monitor Workflow Activity (Adjust and Optimize as Needed)
1. After deploying the workflow, monitor its performance through workflow history and error logs.
2. Make adjustments as needed to optimize performance and fix any issues.
The flow is now finished 🔥
💡 Note: This feature is only available on our Premium and Scale plans.
If you have any questions on the above feel free to reach out the support team via live chat from the Lusha website, your Lusha Dashboard, or via email- [email protected].