Setup
Navigate to the Setup menu
Search for OAuth and OpenID Connect Settings
Then, Enable "Allow OAuth Username-Password Flows"
Create an eLead User
-
- Note: Use an email address you have access to as you need to verify the email and set a password.
- User License = Salesforce Integration
- Profile = Salesforce API Only System Integrations
- Go to Company Information -> Assign "Salesforce API Integration" permission set to the User you created
- Or, on User page, scroll down to 'Permission Set License Assignments' > click 'Edit' > select 'SalesforceAPI Integration'
- Create a Permission Set called "eLead"
- Leave Session Activation Required and License blank
- Add the following Permissions to Permission Set:
- Add all eLead Custom Metadata Types
-
- Add all eLead Apex Classes
-
Add the following System Permissions:
- Access Activities
- API Enabled
- Edit Tasks
- Modify All Data
- Password Never Expires
- View All Custom Settings
-
View All Data
- Object Permissions and Field Permissions - Add Read, Create, Edit, View All, Modify All Permissions for the following Objects. Add Read Access and Edit Access for all fields on the following Objects.
- Account
- Add both Customer and Vendor as Assigned Record Types
- Address
- Contact
- eLead
- Inquiry
- Lead Source
- Sales Opportunity
- Sales Appointment
- Sales Appointment Opportunities
- Staff
- Territory
- Account
- Assign the eLead Permission Set to the eLead User you created
Create External Client App
- In Setup, search for External Client App Manager
- Apps -> External Client Apps> External Client App Manager > New External Client App
- Fill out required fields in "Basic Information" section
- External Client App Name: eLead
- API Name: this will auto-populate
- Contact Email: your email
- Open the API section, enable the setting "Enable OAuth Settings"
- In the "Callback URL" field, enter https://login.salesforce.com/services/oauth2/callback
- In "Selected OAuth Scopes", select the following options
- "Manage user data via APIs (api)"
- "Perform requests at any time (refresh_token, offline_access)"
-
In Flow Enablement, check Enable Client Credentials Flow and click OK
-
- Click "Create"
- Click on the Policies tab, then click Edit
- Open OAuth Policies section
- Ensure the following settings in the OAuth Policies section, then "Save"
- Permitted Users: All users can self-authorize
- Enable Client Credentials Flow: True
- Run As (Username): this will be the eLead User's Username
- Go to setup > Users > copy Username
- Refresh Token Policy: Refresh token is valid until revoked
- IP Relaxation: Relax IP Restrictions
- Navigate back to the External Client App's Settings tab
- Open the OAuth Settings section and select Consumer Key and Secret
- A code will be sent to your User's email address to authenticate
- Open the OAuth Settings section and select Consumer Key and Secret
- Copy your Consumer Key and Secret
- store them somewhere safe as they will be required for testing and sending eLeads into your system
Testing eLeads - Use Postman
Use the Postman application to test the eLead Endpoint.
Copy and paste the End point into Postman and send your parameters to authorize a connection.
Authentication
POST to endpoint to get Bearer token:
- Building Endpoint
- Base endpoint
-
https://{replace}/services/oauth2/token
-
{replace} = org's domain from Setup > My Domain
- Example Domain: lightningtraining-maddie.my.salesforce.com
- Base Endpoint Example: https://lightningtraining-maddie.my.salesforce.com/services/oauth2/token
-
{replace} = org's domain from Setup > My Domain
-
https://{replace}/services/oauth2/token
- Set Params with Keys and Values below
- Base endpoint
| Key | Value |
|---|---|
| grant_type | Set to "client_credentials" |
| client_id | "Consumer Key" from External Client App |
| client_secret | "Consumer Secret" from External Client App |
Note: Params add to the base endpoint to build the request
You will receive a response.
Sample Response:
{
"access_token": "00DHp000001sR9v!ARUAQC6scqbS66QRIKVZTlj9urRzg__X6lNVgPh02rRY5TsZ1NbuZatNN_alPKbs7zEloJqw0v3Tl_IPzi1y27rQ91LBWg_N",
"signature": "sqcYMsNnofHNoWQf1n46H0Y6SbDfZx5RpdANUbLwoWI=",
"scope": "api",
"instance_url": "https://lightningtraining-maddie.my.salesforce.com",
"id": "https://login.salesforce.com/id/00DHp000001sR9vMAE/005Hp00000lYFfMIAW",
"token_type": "Bearer",
"issued_at": "1772641651439"
}
Copy the Access Token from the Response for the next step
Sending eLeads
Create another POST to send an eLead
- Building Endpoint
-
https://{replace}/services/apexrest/i360core/elead/create
-
{replace} = org's domain from Setup > My Domain
- Example Domain: lightningtraining-maddie.my.salesforce.com
- Endpoint Example: https://lightningtraining-maddie.my.salesforce.com/services/apexrest/i360core/elead/create
-
{replace} = org's domain from Setup > My Domain
-
https://{replace}/services/apexrest/i360core/elead/create
- Set Headers with Keys and Values below
| Key | Value |
|---|---|
| Content-Type | Set to "application/json" |
| Authorization | Set to "Bearer " + access_token from previous step |
Note: Bearer must be spelt with a capital "B" and have a space before the access_token
- Add eLead payload to Body tab (see Sample Payloads section)
Click Send to send the eLead to improveit 360.
You will receive a response message from Postman that the eLead was created.
Inside improveit 360, an eLead record will be created
Note: if there are any issues with eLead conversion, they will be displayed in the Import Errors section
Supported Fields
- JSON properties with an exact match to an eLead field (i360core__First_Name__c for example) will automatically populate eLead fields
- Anything other than an exact match will need to be configured in the org on the tab called "eLead Endpoint JSON Mapping"
| Parameter | Field Type | Description |
|---|---|---|
| i360core__First_Name__c | Text(80 Characters) | |
| i360core__Last_Name__c | Text(80 Characters) | |
| i360core__Street_Address__c | Text(255 Characters) | |
| i360core__City__c | Text(255 Characters) | |
| i360core__State_Province__c | Text(30 Characters) | |
| i360core__Zip_Postal_Code__c | Text(12 Characters) | |
| i360core__Phone__c | Phone | |
| i360core__Email__c | Email (Must follow email pattern) | |
| i360core__Lead_Source_Name__c | Text(80 Characters) | Used with i360core__Source__c field to search database for existing Lead Source during the conversion process. If a matching existing Lead Source is not found, a new Lead Source is then created. Note that while this field can actually be up to 255 characters long, a Lead Source record's name can only be 80 characters, so the value passed in via API request should also be limited to 80 characters |
| i360core__Source__c | Text(255 Characters) | Used with the i360core__Lead_Source_Name__c field to search the database for existing Lead Sources during the conversion process |
Endpoint (POST)
{{base_url}}/services/apexrest/i360core/elead/create
- go to Setup -> Sites to get the Base URL (domain name)
- ex: https://mycompany.my.salesforce-sites.com
Sample Header
| Key | Value |
|---|---|
| Content-Type | application/json |
| Authorization | Bearer {Access Token Value from previous step} |
Sample Payloads
{
"i360core__First_Name__c": "Jane",
"i360core__Last_Name__c": "Smith",
"i360core__Street_Address__c": "133 W Chestnut St",
"i360core__City__c": "Columbus",
"i360core__State_Province__c": "OH",
"i360core__Zip_Postal_Code__c": "43215",
"i360core__Phone__c": "(666) 666-5555",
"i360core__Email__c": "test2@test.com",
"i360core__Source__c": "Internet",
"i360core__Lead_Source_Name__c": "Company Website",
"i360core__Interested_In__c": "Windows"
}{
"i360core__First_Name__c": "Demo",
"last-name": "User3",
"ALLCAPSFIELD": "test value",
"address": {
"street_address": "130 E Chestnut",
"city": "Columbus",
"subAddress": {
"city": "Different City",
"zip_code": "43215"
}
},
"test-array": ["test1", "test2"],
"unmappedField": "unmapped value",
"demo_field": "demo value",
"marketingCampaign": "test campaign 123"
}You can also send eLeads in using Query Parameters (HTTP): https://i360lightning.zendesk.com/hc/en-us/articles/24805352166295-eLead-Creation-via-Query-Parameters
What the Lead Provider needs
- Provide the URL: Example: https://lightning-august2023-maddie.my.salesforce.com/services/apexrest/i360core/elead/create
- Client ID, Example: 3MVG9HB6vm3GZZR92ZYIH5tX6DDHjTiNPYi0R5sx7F6TtnfGGk0rMOQYpbc69OWH5wvVQ4HLFToRzkHIuBgKJ
- Client Secret, Example: F72F138A34C0D5C0F4A6B459A43AE5A33399E4064E820898B317B0447FA56A17
-
Product Category values exactly as listed in org
- Setup > Picklist Value Sets > Product Categories
-
Lead Source information - Provide the Lead Source Name and Source for the Lead Source record they should map to
- This is what is used to find the correct Lead Source record
Ensure Custom Settings are enabled
Navigate to Setup
Custom Settings > Trigger Settings > Manage
Be sure the eLead Automatic Conversion checkbox is set to True
If you also want Inquiry records to be created, check the Create Inquiry Records for eLeads also.
Comments
0 comments
Please sign in to leave a comment.