Salesforce is a native workflow integration. You connect the org once, then reuse it on every Salesforce node. Create or update leads, contacts, accounts, and opportunities from Keen, create a Keen lead when a Salesforce record is created, or start a workflow when those records change in Salesforce.
Connect Salesforce
Keen uses OAuth. In a Salesforce node, click Connect, sign in to Salesforce, and approve access. You do not paste API keys into Keen.
To connect Salesforce:
- 1
Open Workflows and add a Salesforce trigger or action.
- 2
Click Connect. Keen opens Salesforce in a popup.
- 3
Sign in and approve access.
- 4
Set Salesforce environment on the node to production or sandbox.
Production and sandbox
Production and sandbox are two separate connections. Connect each org you want to use, then set Salesforce environment on every Salesforce trigger and action so that node talks to the right org.
Add the Keen ID
Keen and Salesforce each have their own IDs. The Keen ID is the shared key between them. Status updates only work if that ID is stored on the Salesforce record, no matter which system created the lead.
To add the Keen ID:
- 1
In Salesforce, create a custom text field on each Lead, Contact, Account, or Opportunity object you will sync. Name it something your team will recognize, such as Keen ID. The API name is often Keen_ID__c.
- 2
If Keen creates the Salesforce record, map the Keen lead ID onto that field on the create action.
- 3
If the record starts in Salesforce, create the Keen lead first, then use Update Salesforce Lead, Contact, Account, or Opportunity to write the new Keen lead ID back onto that field.
Later, when an opportunity stage or lead status changes, the workflow reads that field and uses it in Update lead status. Without it, Keen cannot tell which lead to update, partners lose visibility, and rewards cannot fire automatically on Won.
Ways to use Salesforce in workflows
After connecting Salesforce, choose the direction that matches where the work starts:
- Start in Keen when a partner lead should create or update a Salesforce record.
- Start in Salesforce when a new Salesforce lead, contact, or opportunity should become a Keen lead.
- Start in Salesforce when a stage or status change should update Keen.
Send a Keen lead into Salesforce
To send a Keen lead into Salesforce:
- 1
Trigger: New lead in Keen, scoped to the partner channel you care about.
- 2
Action: Create Salesforce Account, and map the company name.
- 3
Action: Create Salesforce Contact, and map name, email, phone, and AccountId from the account you just created.
- 4
Action: Create Salesforce Opportunity if your team works deals. Map AccountId, a name, StageName, CloseDate, and the Keen ID.
- 5
Save and turn the workflow on. The next partner lead lands in Salesforce with the Keen ID already stored.
Receive a Salesforce lead in Keen
Use this when the lead is created in Salesforce and should appear in Keen. There is no Salesforce action that creates a Keen lead. After a Salesforce trigger fires, add the Keen action Create lead, then write the new Keen ID back to Salesforce.
To receive a Salesforce lead in Keen:
- 1
Trigger: New Salesforce Lead. Use New Salesforce Contact or New Salesforce Opportunity if that is where the record starts.
- 2
Choose the Salesforce environment and, if needed, a record type.
- 3
Action: Create lead. This is a Keen action, not a Salesforce action. Map name, email, company, and any other fields from the Salesforce trigger.
- 4
Action: Update Salesforce Lead, Contact, Account, or Opportunity. Set the custom Keen ID field to the Keen lead ID from the create step.
- 5
Save and turn the workflow on. The next Salesforce record creates a Keen lead, with the Keen ID stored back on Salesforce.
Update Keen from Salesforce
To update Keen from Salesforce:
- 1
Trigger: Opportunity Stage Changed, or Opportunity Closed Won/Lost if you only care about the close.
- 2
Choose the Salesforce environment and, if needed, a record type or stage.
- 3
Action: Update lead status. This is a Keen action, not a Salesforce action.
- 4
Set the Keen lead ID to the Keen ID field on the Salesforce record.
- 5
Use mapping mode to match Salesforce stages, or closed won and closed lost, to Keen statuses such as Meeting, Won, or Lost.
- 6
Turn the workflow on. When Salesforce moves, Keen updates the same lead so partners and rewards stay in sync.
Salesforce triggers
Use a Salesforce trigger when work starts in Salesforce and Keen should react. New Lead, New Contact, and New Opportunity are how Salesforce records enter Keen. There are 11 triggers across Opportunity, Lead, Contact, and Account.
Opportunity
New Salesforce Opportunity
Fires when an opportunity is created in Salesforce.
Filters: Optional record type filter.
Updated Salesforce Opportunity
Fires when an opportunity is updated.
Filters: Optional record type filter.
Opportunity Stage Changed
Fires when an opportunity moves to a new stage.
Filters: Optional record type and stage filters.
Opportunity Closed Won/Lost
Fires when an opportunity is closed.
Filters: Filter by closed won, closed lost, or any closed status.
Lead
New Salesforce Lead
Fires when a lead is created in Salesforce.
Filters: Optional record type filter.
Updated Salesforce Lead
Fires when a Salesforce lead is updated.
Filters: Optional record type filter.
Lead Status Changed
Fires when a Salesforce lead status changes.
Filters: Optional record type and lead status filters.
Contact
New Salesforce Contact
Fires when a contact is created in Salesforce.
Updated Salesforce Contact
Fires when a Salesforce contact is updated.
Account
New Salesforce Account
Fires when an account is created in Salesforce.
Updated Salesforce Account
Fires when a Salesforce account is updated.
Salesforce actions
Use a Salesforce action when Keen should create or update a record. There are eight actions: create and update for each of the four objects.
Lead
Create Salesforce Lead
Create a lead in Salesforce from the Keen lead or an earlier step.
Inputs: At least one mapped field. Include the Keen ID.
Update Salesforce Lead
Update an existing Salesforce lead.
Inputs: Salesforce Lead ID, plus the fields to change.
Contact
Create Salesforce Contact
Create a contact in Salesforce from the Keen lead or an earlier step.
Inputs: At least one mapped field.
Update Salesforce Contact
Update an existing Salesforce contact.
Inputs: Salesforce Contact ID, plus the fields to change.
Account
Create Salesforce Account
Create an account in Salesforce when the partner lead has a company.
Inputs: At least one mapped field.
Update Salesforce Account
Update an existing Salesforce account.
Inputs: Salesforce Account ID, plus the fields to change.
Opportunity
Create Salesforce Opportunity
Create an opportunity and, if needed, link it to an account.
Inputs: At least one mapped field. Map AccountId from an earlier create step to link the account. Include the Keen ID.
Update Salesforce Opportunity
Update an existing Salesforce opportunity.
Inputs: Salesforce Opportunity ID, plus the fields to change.
Field mappings
Map fields in both directions. Keen to Salesforce uses Salesforce API field names. Salesforce to Keen maps trigger fields onto a Keen action such as Create lead.
- When creating or updating a Salesforce record, use API field names as the destination, such as FirstName, LastName, Company, StageName, and CloseDate.
- When creating a Keen lead from Salesforce, map trigger fields such as FirstName, LastName, email, and company onto Create lead.
- Salesforce create actions need at least one mapped field. Salesforce update actions also need the Salesforce record ID.
- To link Salesforce records, map IDs from earlier steps. For example, map AccountId on an opportunity from the account you just created.
- Custom Salesforce fields used later as variables, including the Keen ID, are included in the trigger payload. Write the Keen ID when Keen creates the Salesforce record, or write it back after Create lead if the record started in Salesforce.
Send status back to Keen
There is no Salesforce action for updating Keen. After a Salesforce trigger fires, add the Keen action Update lead status.
To send status back:
- 1
Start from a Salesforce trigger such as Opportunity Stage Changed, Lead Status Changed, or Opportunity Closed Won/Lost.
- 2
Add Update lead status.
- 3
Set the Keen lead ID to the custom Keen ID field on the Salesforce record.
- 4
Either pick one Keen status, or map Salesforce stages and statuses onto Keen statuses.