Salesforce - Lead & Opportunity
Objective
Fetch/Create/Update Lead from customer data
Create an Opportunity linked to the Lead
Build and send the relevant payload via EdgeTag
EdgeTag Salesforce Integration - Deployment & Salesforce Setup
This guide will help you set up and validate the EdgeTag integration with Salesforce and deploy it using EdgeTag's Webhook.
Salesforce Configuration
Create a Salesforce Connected App
Navigate to Setup:
Go to App Manager (under Setup).
Click New Connected App.
If not visible: Go to Apps -> External Client Apps -> Settings -> Connected Apps, then click New Connected App.
Configure Your App:
Name: EdgeTag Integration (API Name auto-fills).
Enable OAuth Settings.
Callback URL:
https://localhost:3000/callbackSelected OAuth Scopes:
Manage user data via APIs (
api)Perform requests on your behalf at any time (
refresh_token, offline_access)
Edit OAuth Policies:
Permitted Users: Admin approved users are pre-authorized.
IP Relaxation: Relax IP restrictions (if needed).
Uncheck Require Proof Key for Code Exchange (PKCE).
Save the
Connected App.Copy Credentials:
In the app detail page, click Manage Consumer Details and copy:
Consumer Key
Consumer Secret
Add a Custom Lookup Field to Opportunity
Go to: Setup -> Object Manager -> Opportunity -> Fields & Relationships-> New.
Choose: Data Type: Lookup Relationship, Related To: Lead Reference.
Enter:
Field Label: Lead Reference
Field Name: LeadReference__c
Complete: Follow the wizard steps, and add the field to your Opportunity Page Layout(s).
Generate a Salesforce Refresh Token via OAuth
Authorize in Browser:
Replace
CONSUMER_CLIENT_IDin the URL below and paste in your browser:Code SnippetCopy
Approve the App: After approval, you'll be redirected to a URL like:
Code SnippetCopy
Extract the
codeparameter from the URL.Exchange Code for Tokens:
Use Postman or cURL to send:
Code SnippetCopy
Example cURL:
Code SnippetCopy
Copy the
refresh_tokenfrom the response.
Gather Credentials
Save these values for later use in EdgeTag setup:
SF_CLIENT_ID = your Connected App Consumer Key SF_CLIENT_SECRET = your Connected App Consumer Secret SF_REFRESH_TOKEN = refresh token from OAuth process
EdgeTag Deployment
Access Your EdgeTag Project
Log in at app.edgetag.io.
Select your site (e.g.,
hgtmv.bvnk.com).To add the Salesforce webhook: Click Add Channel -> Webhook.
Configure Webhook Integration
Consent Categories: Ensure at least Strictly necessary is enabled.
Webhook Name: e.g., SF Lead & Opportunity.
Webhook URL: Leave blank (EdgeTag will auto-generate).
Starter Template: Choose Salesforce - Lead & Opportunity
Set Secrets
In the secrets, set:
SF_CLIENT_ID = your consumer key
SF_CLIENT_SECRET = your consumer secret
SF_REFRESH_TOKEN = your refresh token
Deploy
Click Save & Deploy (top right). EdgeTag will compile and activate the webhook.
Validation & Testing
Send a test lead: Use Shopify Order Created payload.
EdgeTag Logs: Make sure the script runs without exceptions.
In Salesforce:
Verify the Lead record is created or updated for the customer email.
Confirm an associated Opportunity named
Order <orderId>was created and is linked to the Lead.
If you observe errors, contact the EdgeTag team.
Result
The script will create or update the Lead in Salesforce and create an Opportunity with the Lead referenced (LeadReference__c).
Last updated
Was this helpful?

