Connecting leads to Salesforce
Salesforce is a huge CRM with multiple options available to post leads to LeadByte.
This article will focus on the 2 most common methods we see from clients -
Web2form and Authentication + JSON Post.
Web2form
Web2form this is the simplest method of posting to Salesforce and uses a common URL.
It will look something like this -
https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8
There are many variations of this URL, so check with your buyer for the correct version.
You'll use the Action > Direct Post and the Remote System > Generic Form Post.
Finally, it's simply a case of mapping your fields using the usual method -
Make sure you map the output field to what your Buyer requires.
Authentication + JSON Post
This is a more complicated but more commonly used option. It uses 2 requests, the 1st to gather a unique token from Salesforce and the 2nd to send lead data (authenticated with the token) to Salesforce.
1st Request
We start out by making the call for an access token. This request uses a common URL and looks something like this -
https://XXXXX.salesforce.com/services/oauth2/token
There are many variations of this URL, so check with your buyer for the correct version.
You'll be making a FORM POST request to this endpoint, and you'll be providing a variety of authentication credentials that your buyer has already sent you. Your request will look something like this -
grant_type=password&client_id=987654ZYXWUTS987654ZYXWUTS&client_secret=ABCDEFG123456789ABCDEFG123456&username=example@leadbyte.co.uk&password=keithchegwinismyhero
Assuming the authentication request was successful, Salesforce would respond with something like this -
{
"access_token": "ABC123EDF456HIJ789",
"instance_url": "https://XXXXXX.my.salesforce.com",
"id": "https://login.salesforce.com/id/123456789/123456789",
"token_type": "Bearer",
"issued_at": "1663849087513",
"signature": "KJBGKFBFD43983TRlkjdnsfdkvjnfd8349"
}
Next, we need to tell LeadByte what to capture in the response back from Salesforce.
We can see the response is in JSON, and we're looking to capture the access_token value.
As a result, we'd instruct LeadByte to look for JSON and wrap the token name in square brackets.
Your entire first request will look a little like this -
The above is simply an example of how the 1st request would commonly look, however there are many more authentication methods. Seek confirmation from your Buyer before starting your delivery.
2nd Request
The next step is to send your buyer the lead data. This will be to a common URL which looks something like this -
https://XXXXXXX.salesforce.com/services/data/v123.0/sobjects/Lead
There are many variations of this URL, so check with your buyer for the correct version.
You'll be making a JSON Post, so ensure you've got the correct mappings from you Buyer before starting this section.
In order to authenticate this lead data delivery, you'll need to include the token you captured in the 1st request. Use the tag [AUTHTOKEN] in order to use the previously captured value.
This goes in a Header as a Bearer token like this -
Assuming the above lead delivery was successful, Salesforce will respond to this 2nd request with something similar to this -
{
"id": "00AB1230000123AB",
"success": true,
"errors": []
}
As always, please raise a support ticket with any questions or concerns, but we request that you check you have all the correct delivery details first.
Comments