Search for answers or browse our knowledge base.
Salesforce and Engagez Registration Integration
Salesforce and Engagez Registration Integration
Engagez supports two-way integration of registration data with Salesforce:
EZ-to-SF:
When a user registers at the venue entrance or webinar landing page, the registrant’s data is used to determine if a matching contact or lead object already exists in Salesforce. If no match is found, a new record is created. The found or created record is then added to the specified campaign object in Salesforce as a member. When the registrant signs in for the first time, the attendance data is pushed from Engagez to Salesforce’s campaign member object’s status.
SF-to-EZ:
When a user registers through a third party integrated with Salesforce or using an add-on in Salesforce, the created lead or contact is added to a Salesforce campaign object. Using callbacks and triggers, this triggers a call to the Engagez Venue, creating a registration record in Engagez to support the user signing in on the day of the program. The first time the registrant signs in, the attendance data is pushed from Engagez to Salesforce’s campaign member object’s status.
EZ-to-SF Configuration
Salesforce Setup:
- Connected App Setup: Set up a Connected App in Salesforce. Refer to your Salesforce Connected App documentation to find the Client URL, Client ID, and Client Secret values. These settings are used by the API to access your Salesforce instance.
- In Salesforce Classic, on the left hand side select Apps > App Manager.
- Once in App Manager, select New Connected App in the upper right hand corner.
- Add the information for the Connected App Name, API Name, and Contact Email. You can name these whatever you like. Select the checkbox for Enable OAuth Settings, and in the Callback URL put https://www.engagez.net/callback/salesforce
- Select and Add the following OAuth Scopes
- Then ensure the following four boxes are checked, the rest should be unchecked. Then go ahead and press save.
- Now go back to the App Manager, and select Manage in the dropdown next to your new app.
- Then select Edit Policies, scroll down to Client Credentials Flow and input a user under Run As.
- This user MUST have the proper credentials for the Connected App to work properly. Please see the Creating and Configuring a Salesforce User for Engagez Connected App documentation.
- In Salesforce Classic, on the left hand side select Apps > App Manager.
- Campaign Object: Ensure a Campaign object is created in Salesforce to receive registrants data from Engagez.
Engagez Setup:
- Navigate to Integrations: In the Venue or Webinar’s Admin Panel, go to the Integrations page.
- Salesforce Campaign Integration: Find the Salesforce Campaign Integration section, select the option, and open the fields for completion.
- Client Information: Enter the Client URL, Client ID, Client Secret, and Campaign ID. Follow the Connected App documentation to locate this information. The Campaign ID is the numerical portion of the URL on the Campaign page.
- The Client URL can be found in Salesforce Classic, it is the first part of the URL in the browser starting with https:// and ending with salesforce.com
- The Client Secret and Client ID can be found by going to the App Manager, selecting View in the drop-down next to your App, then selecting Manage Consumer Details, this will bring up the Consumer Key (Client ID) and the Consumer Secret (Client Secret)
- The Client URL can be found in Salesforce Classic, it is the first part of the URL in the browser starting with https:// and ending with salesforce.com
- Go to the Salesforce Campaign you intend to connect, the Campaign ID is the highlighted part of the Campaign URL shown
- Validate Credentials: Validate the credentials and save the changes.
- Map Fields: Map the Salesforce lead fields and the registration form fields in Engagez. Ensure all required fields are listed and mapped.
- Update Uniqueness Criteria: Ensure the uniqueness criteria in Salesforce (usually email) is set correctly as Engagez will use this to identify existing objects in Salesforce.
Operations:
- Adding Campaign Member: When a new user registers, Engagez first attempts to find an existing contact in Salesforce matching the registrant’s info based on the uniqueness criteria. If there is no such contact, it then attempts to find a matching lead. If there is no lead, then it creates a new lead object. It then updates the mapped field of the found or created object and adds it as a member of the specified Campaign object.
- Automatic Sync: Any new registrant will automatically be sent to Salesforce and added to the Campaign object per logic above.
- Sync All Registrants Button: Use this button to synchronize all registrants in Engagez with the Salesforce campaign object.
- Sync Member Status Button: Update the Campaign object members’ status field to reflect attendance.
SF-to-EZ Configuration
Salesforce Setup:
- Connected App Setup: Set up a Connected App in Salesforce. Refer to your Salesforce Connected App documentation to find the Client URL, Client ID, and Client Secret values. These settings are used by the API to access your Salesforce instance.
- Campaign Object: Ensure a Campaign object is created in Salesforce to receive registrant data from Engagez.
- Salesforce Webhook and Callback Setup: Add Engagez to the Remote Site Settings in Salesforce.
- Apex Class Setup: Create an Apex class named CalloutClass and add the provided code snippet.
| public class CalloutClass { @future(callout=true) public static void makeCallout(String body) { HttpRequest request = new HttpRequest(); // Set the endpoint URL. //String endpoint = ‘https://webhook.site/d5954f01-e8a1-4d65-9791-69e5a821f8b1’; String endpoint = ‘https://www.engagez.net/service/salesforce/synccm?stg=1’; request.setEndPoint(endpoint); // Set the HTTP verb to GET. request.setMethod(‘POST’); request.setHeader(‘Content-Type’, ‘application/json’); request.setBody(body); // Send the HTTP request and get the response. HttpResponse response = new HTTP().send(request); }} |
- Apex Trigger Classes: Add three Apex trigger classes: EzLead, EzContact, and EzCampaignMember with the provided code definitions.
Create EzLead of sObject Type Lead and provide the following code definition:
| trigger EzLead on Lead (after insert, after update) { if (Trigger.isInsert) { for(Lead lead : Trigger.new) { CalloutClass.makeCallout(JSON.serialize(new Map<String, Object>{ ‘operator’ => ‘insert’, ‘type’ => ‘Lead’, ‘LeadId’ => lead.Id })); } } else if (Trigger.isUpdate) { for(Lead lead : Trigger.new) { CalloutClass.makeCallout(JSON.serialize(new Map<String, Object>{ ‘operator’ => ‘update’, ‘type’ => ‘Lead’, ‘LeadId’ => lead.Id })); } }} |
Create EzContact of sObject Type Contact and provide the following code definition:
| trigger EzContact on Contact (after insert, after update) { if (Trigger.isInsert) { for(Contact contact : Trigger.new) { CalloutClass.makeCallout(JSON.serialize(new Map<String, Object>{ ‘operator’ => ‘insert’, ‘type’ => ‘Contact’, ‘ContactId’ => contact.Id })); } } else if (Trigger.isUpdate) { for(Contact contact : Trigger.new) { CalloutClass.makeCallout(JSON.serialize(new Map<String, Object>{ ‘operator’ => ‘update’, ‘type’ => ‘Contact’, ‘ContactId’ => contact.Id })); } }} |
Make EzCampainMember of sObject Type CampaignMember and provide the following code definition:
| trigger EzCampaignMember on CampaignMember (after insert, before delete, before update) { if (Trigger.isInsert) { for(CampaignMember cm : Trigger.new) { CalloutClass.makeCallout(JSON.serialize(new Map<String, Object>{ ‘operator’ => ‘insert’, ‘type’ => ‘CampaignMember’, ‘CampaignMemberId’ => cm.Id, ‘CampaignMemberCampaignId’ => cm.CampaignId, ‘CampaignMemberLeadId’ => cm.LeadId, ‘CampaignMemberContactId’ => cm.ContactId })); } } else if (Trigger.isDelete) { for(CampaignMember cm : Trigger.old) { CalloutClass.makeCallout(JSON.serialize(new Map<String, Object>{ ‘operator’ => ‘delete’, ‘type’ => ‘CampaignMember’, ‘CampaignMemberId’ => cm.Id, ‘CampaignMemberCampaignId’ => cm.CampaignId, ‘CampaignMemberLeadId’ => cm.LeadId, ‘CampaignMemberContactId’ => cm.ContactId })); } } else if (Trigger.isUpdate) { for(CampaignMember cm : Trigger.new) { CalloutClass.makeCallout(JSON.serialize(new Map<String, Object>{ ‘operator’ => ‘update’, ‘type’ => ‘CampaignMember’, ‘CampaignMemberId’ => cm.Id, ‘CampaignMemberCampaignId’ => cm.CampaignId, ‘CampaignMemberLeadId’ => cm.LeadId, ‘CampaignMemberContactId’ => cm.ContactId })); } }} |
Engagez Setup:
- Follow the same setup steps as in EZ-to-SF, ensuring the sync option is checked.
Operations:
The two systems are now configured to allow Salesforce to pass the mapped information of a new registrant to Engagez. Salesforce will also pass on any changes to the registrants data as well as removal of the registrant from the Campaign to Engagez. Engagez will update its registrant’s record accordingly.
Still have questions? Visit the Engagez Support venue or email us at support@engagez.com. If you’ve purchased an implementation package, please contact your implementation representative through Skype or email.
