Salesforce Connector
Manage leads, contacts, opportunities, and accounts in Salesforce
Salesforce Connector
Connect your workflows to Salesforce and automate your entire CRM pipeline. Create leads, manage contacts, track opportunities, update accounts, and run complex queries—all without leaving DeepChain.
Overview
The Salesforce connector provides 9 powerful operations for managing your CRM data. Whether you're automating lead creation from web forms, syncing customer data, or orchestrating complex sales workflows, this connector makes it seamless.
Authentication
Salesforce supports two authentication methods. Choose the one that fits your use case:
Option 1: OAuth 2.0 (Recommended)
Use OAuth for a secure, user-authorized connection. Best for production:
auth_type: oauth2
client_id: "your_connected_app_client_id"
client_secret: "your_connected_app_secret"
instance_url: "https://your-instance.salesforce.com"
How to set it up:
- In Salesforce, go to Setup > Apps > App Manager
- Create a New Connected App
- Fill in Basic Information (name, contact email, etc.)
- Enable OAuth Settings
- Add required scopes (usually
full,refresh_token,offline_access) - Copy your Client ID and create a Client Secret
- Set the redirect URI to
https://yourapp.deepchain.dev/oauth/callback
Option 2: Username-Password Flow
For testing or simple integrations where OAuth isn't available:
auth_type: password
username: "user@company.com"
password: "password"
security_token: "your_security_token"
Warning: This method is less secure. Only use it for development or sandboxes. Always use OAuth for production.
Available Operations
Here's what you can do with your Salesforce data:
Accounts (Companies)
| Operation | What It Does |
|---|---|
getAccount |
Fetch an account by ID |
createAccount |
Create a new account (company) |
updateAccount |
Update account details |
deleteAccount |
Delete an account |
Contacts (People)
| Operation | What It Does |
|---|---|
getContact |
Fetch a contact by ID |
createContact |
Create a new contact |
updateContact |
Update contact information |
Leads (Prospects)
| Operation | What It Does |
|---|---|
getLead |
Fetch a lead by ID |
createLead |
Create a new lead |
convertLead |
Convert a lead to a contact/opportunity |
Opportunities (Deals)
| Operation | What It Does |
|---|---|
getOpportunity |
Fetch an opportunity by ID |
createOpportunity |
Create a new opportunity |
updateOpportunity |
Update opportunity details |
Queries
| Operation | What It Does |
|---|---|
query |
Run a SOQL (Salesforce Object Query Language) query |
search |
Run a SOSL (Salesforce Object Search Language) search |
Practical Workflow Examples
Example 1: Auto-Create Lead from Web Form
Someone fills out your website form → automatically create a lead in Salesforce:
- id: create_lead
type: salesforce_connector
config:
operation: createLead
FirstName: "{{ input.first_name }}"
LastName: "{{ input.last_name }}"
Company: "{{ input.company_name }}"
Email: "{{ input.email }}"
Phone: "{{ input.phone }}"
Status: "Open"
LeadSource: "Web Form"
Description: "Submitted via: {{ input.form_page }}"
The response will include the new lead's ID, which you can use in next steps.
Example 2: Convert Lead to Opportunity
Once a lead is qualified, convert them and create an opportunity:
- id: qualify_lead
type: salesforce_connector
config:
operation: convertLead
leadId: "{{ input.lead_id }}"
convertedStatus: "Closed - Converted"
opportunityName: "{{ input.opportunity_name }}"
opportunityStageId: "Prospecting"
accountId: "{{ input.account_id }}" # Link to existing account
contactId: "" # Salesforce creates new contact
doNotCreateOpportunity: false
Example 3: Create a Contact and Link to Account
Add a new decision-maker to an existing account:
- id: add_contact
type: salesforce_connector
config:
operation: createContact
FirstName: "{{ input.contact_first_name }}"
LastName: "{{ input.contact_last_name }}"
Email: "{{ input.contact_email }}"
Phone: "{{ input.contact_phone }}"
Title: "{{ input.job_title }}"
Department: "{{ input.department }}"
AccountId: "{{ input.account_id }}" # Link to the account
Example 4: Update Opportunity Stage
Move an opportunity forward in your sales pipeline:
- id: advance_deal
type: salesforce_connector
config:
operation: updateOpportunity
Id: "{{ input.opportunity_id }}"
StageName: "Negotiation/Review"
Probability: 50
ExpectedRevenue: "{{ input.deal_value * 0.5 }}"
NextStep: "Send proposal"
CloseDate: "{{ input.expected_close_date }}"
Example 5: Query for Deals Closing This Month
Run a SOQL query to find all opportunities closing this month:
- id: find_closing_deals
type: salesforce_connector
config:
operation: query
soql: |
SELECT Id, Name, Amount, StageName, CloseDate, AccountId
FROM Opportunity
WHERE CloseDate >= THIS_MONTH
AND StageName NOT IN ('Closed - Won', 'Closed - Lost')
ORDER BY Amount DESC
LIMIT 100
Use this in a loop to send weekly summaries to your team:
- id: loop_deals
type: loop
config:
items: "{{ query_1.response }}"
- id: send_summary
type: slack_connector
config:
operation: postMessage
channel: "#sales"
text: "Deal: {{ loop_1.current.Name }} - ${{ loop_1.current.Amount }}, closes {{ loop_1.current.CloseDate }}"
Example 6: Search Across Multiple Objects
Find all records matching a search term:
- id: search_accounts
type: salesforce_connector
config:
operation: search
sosl: "FIND {{{ input.search_term }}} RETURNING Account(Id, Name, Industry), Contact(Id, Name, Email)"
This searches accounts and contacts at once—great for quick lookups.
Rate Limits
Salesforce enforces API limits based on your edition:
- Standard/Professional: 15,000 API calls per 24 hours
- Enterprise: 15,000 API calls per 24 hours
- Unlimited: 40,000 API calls per 24 hours
- Developer: 10,000 API calls per 24 hours
Tip: DeepChain automatically handles rate limiting with backoff and queueing, so you rarely need to worry about hitting these limits. Check your Usage Monitor in Salesforce to see your current consumption.
Error Handling
Common Salesforce Errors
| Error | What It Means | How to Fix |
|---|---|---|
INVALID_SESSION_ID |
OAuth token expired or revoked | Re-authenticate in Credentials |
MALFORMED_QUERY |
Invalid SOQL or SOSL syntax | Check your query—Salesforce SOQL is strict |
ENTITY_IS_DELETED |
Record was deleted | Verify the record still exists |
DUPLICATE_VALUE |
Unique field violation | Check for duplicates (email, account name, etc.) |
INVALID_FIELD |
Field doesn't exist on the object | Check Salesforce field names (they're case-sensitive!) |
REQUIRED_FIELD_MISSING |
You didn't provide a required field | Check the object's required fields in Salesforce |
INVALID_CROSS_REFERENCE_ID |
Invalid ID for a related record | Verify the account/contact/lead ID exists |
Debugging
Enable debug logging to see the exact request and response:
Node Configuration:
debug: true
logRequest: true
logResponse: true
Check your execution logs for detailed error messages from Salesforce.
Best Practices
1. Use Sandbox for Testing
Always test new workflows in a Salesforce sandbox before going live:
# Development
auth_type: oauth2
instance_url: "https://your-instance--sandbox.salesforce.com"
# Production
auth_type: oauth2
instance_url: "https://your-instance.salesforce.com"
2. Check for Duplicates Before Creating
Salesforce can have duplicate prevention rules. Check first:
- id: check_duplicate
type: salesforce_connector
config:
operation: query
soql: "SELECT Id FROM Lead WHERE Email = '{{ input.email }}' LIMIT 1"
- id: create_or_skip
type: conditional
config:
condition: "{{ check_duplicate_1.response.length > 0 }}"
true_path: "skip_creation"
false_path: "create_lead"
3. Map Custom Fields Correctly
Salesforce custom fields have a __c suffix. Use exact field names:
# Standard field
FirstName: "{{ input.name }}"
# Custom field
Custom_Field__c: "{{ input.custom_value }}"
Custom_Picklist__c: "Option A"
4. Handle Date Fields
Salesforce expects dates in ISO format (YYYY-MM-DD):
CloseDate: "{{ formatDate(input.date, 'yyyy-MM-dd') }}"
5. Build Workflows That Don't Spam Your CRM
Instead of creating/updating one record per API call, batch them:
# Bad: Creates one lead per call
- id: create_each_lead
type: loop
items: "{{ input.leads }}"
children:
- type: salesforce_connector
operation: createLead
# Good: One bulk operation (if your operation supports it)
- id: batch_create
type: salesforce_connector
config:
operation: createMultipleLeads
leads: "{{ input.leads }}"
Next Steps
- Connectors Overview — Explore all connectors
- HubSpot Connector — Alternative CRM
- Dynamics 365 Connector — Microsoft CRM
- Salesforce SOQL Documentation — Master SOQL queries
- Custom Objects in Salesforce — Work with custom objects