Salesforce is a great CRM that is wildly popular for its effectiveness. If used correctly it can be very powerful for your organizations workflow across most departments. Companies that use Salesforce are blown away with how customizable it is. While being extremely customizable and flexible, on the other hand, to a new comer, it is extremely complicated to understand.
Our initial goal with integrating with Salesforce was to push leads into our system (Teledrip), based on a custom field that we have added to the Salesforce Lead (SObject, in Salesforce) called TeledripCampaign. When a lead is inserted, or updated, with a valid Teledrip Campaign ID, it would then be posted into a Teledrip campaign, so that everything is fully automated. In the same way, we could even add a DNC checkbox, that when checked, also posts to Teledrip’s API sending a DNC request, so that all communication stops in the Teledrip platform across all campaigns.
Step 1: Add a custom field to the Lead SObject called “TeledripCampaign”
In the upper right hand corner of your Salesforce home page, click on the Gear icon, then click “Setup”.
Navigate to “Objects & Fields”>”Object Manager” > “Lead” (Click Lead)
Navigate to the Lead, and click “Fields and Relationships”
Add a Text field that will contain the TeledripCampaign ID that you want leads inserted to, when a lead is inserted with a Teledrip campaign, or updated with a Teledrip campaign.
Step 2: Add Teledrip API URL to your Remote Site safe list in Salesforce
The next step is to add the Teledrip API url to your Security white list. You can do this by going to:
Setup->Security->Remote Site Settings
Click the “New Remote Site” button:
Fill out the form as follows:
Step 3: Step Apex Trigger for New Leads, and Lead Changes
Go back to the Object Manager in your Setup, go back to the Lead object, and click Triggers…
Add a new trigger to lead, and this is the code to do what we want to accomplish.
Step 4: Step Apex Class to Send External HTTPS Post to Teledrip API using JSON
Reach out to firstname.lastname@example.org to get a custom Apex class for your Salesforce Developer Console. By setting up this Apex class with an Apex trigger, you can easily post to TeleDrip.