Salesforce is the CRM most companies grow into, and it’s also where a lot of manual work hides: copying form leads in by hand, chasing deal updates, building the same weekly report every Monday. In this tutorial you’ll connect n8n to Salesforce and build four practical automations, including one that scores leads with AI.
What you can automate
n8n has a built-in Salesforce node and a Salesforce Trigger node. Together they cover most day-to-day CRM work:
- Leads, Contacts, Accounts and Opportunities: create, update, upsert, get, delete, add notes, add to a campaign
- Cases and Tasks: create support cases, add comments, create follow-up tasks
- Custom Objects: full create, read, update and delete
- Search: run any SOQL query
- Flow: list and invoke Salesforce Flows
- Triggers: start a workflow when a Lead, Contact, Account, Opportunity, Case, Task, User or Custom Object is created or updated
Anything the node doesn’t cover, you can still reach with the HTTP Request node using the same Salesforce credential.
Step 1: Connect Salesforce to n8n
n8n supports two sign-in methods: OAuth2 (easiest) and JWT (best for server-to-server). Salesforce is phasing out the old “Connected Apps”, so create an External Client App for new setups.
OAuth2 setup
- In Salesforce, go to Setup → App Manager → New External Client App and fill in a name and contact email.
- Turn on Enable OAuth.
- Set the Callback URL:
- Self-hosted:
https://your-n8n-domain.com/rest/oauth2-credential/callback - n8n Cloud:
https://oauth.n8n.cloud/oauth2/callback
- Self-hosted:
- Add the scopes Full access (full) and Perform requests at any time (refresh_token, offline_access).
- Under Flow Enablement, enable the Authorization Code and Credentials Flow.
- Save, then copy the Consumer Key and Consumer Secret.
- In n8n, create a Salesforce OAuth2 credential. Paste the key as Client ID and the secret as Client Secret, choose Production or Sandbox, and click Connect.
Tip: build and test against a Sandbox first, then switch the credential to Production.
Workflow 1: Website form → Salesforce lead
Webhook / Form Trigger (website contact form)
↓
Salesforce: Lead → Create
↓
Slack: "New lead: {{name}} from {{company}}"
- Add a Webhook or n8n Form Trigger node and point your website form at it.
- Add a Salesforce node: Resource Lead, Operation Create.
- Map the fields. Salesforce requires Last Name and Company on every lead:
- Last Name:
{{ $json.last_name }} - Company:
{{ $json.company || 'Unknown' }} - Additional Fields → Email:
{{ $json.email }} - Additional Fields → Lead Source:
Web
- Last Name:
- Add a Slack node to post the new lead to your sales channel.
Avoid duplicates: use the Upsert operation instead of Create. Upsert needs an External ID field, and Email isn’t one by default, so create a custom External ID field on the Lead object (for example Web_Email__c) and upsert on that.
Workflow 2: AI lead scoring
Let AI read each new lead and tell your team who to call first.
Salesforce Trigger (On Lead Created)
↓
OpenAI / Gemini: score 1-10 + one-line reason
↓
Salesforce: Lead → Update (Rating + Description)
↓
IF score ≥ 8 → Slack alert to sales
- Add a Salesforce Trigger node with the event On Lead Created.
- Add an OpenAI (or Gemini) node with a prompt like:
Score this B2B lead from 1-10 for fit with an automation agency. Reply as JSON: {"score": number, "reason": string}. Lead: {{ JSON.stringify($json) }} - Add a Salesforce node: Lead → Update, using the Lead ID from the trigger. Set Rating to Hot / Warm / Cold based on the score, and save the reason to Description or a custom field.
- Add an IF node: if score is 8 or more, send a Slack or Teams message to the sales rep.
Workflow 3: Deal-won alerts
Salesforce Trigger (On Opportunity Updated)
↓
IF StageName = "Closed Won"
↓
Slack / Microsoft Teams: "🎉 {{Name}} closed for {{Amount}}"
↓
Salesforce: Task → Create ("Send onboarding kit")
This one keeps the whole team in the loop and makes sure onboarding starts the same day the deal closes. Swap Slack for Teams, email or a WhatsApp message if that’s where your team lives.
Workflow 4: Weekly pipeline report to Google Sheets
Schedule Trigger (Monday 8:00 AM)
↓
Salesforce: Search (SOQL)
↓
Google Sheets: clear + append rows
↓
Gmail: "This week's pipeline is ready"
In the Salesforce node choose Resource Search and paste a SOQL query like:
SELECT Name, StageName, Amount, CloseDate, Owner.Name
FROM Opportunity
WHERE IsClosed = false AND CloseDate = NEXT_N_DAYS:30
ORDER BY CloseDate ASC
Each result becomes one row in your sheet. Your manager gets a fresh pipeline view every Monday with zero copy-paste.
Bonus: a Salesforce AI agent
Connect the Salesforce node as a tool to n8n’s AI Agent node, then chat with your CRM from Slack or Telegram: “Which deals over $10k close this month?” or “Add a note to Acme Corp: called, follow up Friday.” Start with read-only operations (Get, Get All, Search), and only add Create or Update tools once you trust it.
Common errors
❌ OAuth fails on n8n Cloud: turn on “Approve Connected Apps for Non-Admins” in the user’s profile (it’s off by default, even for admins)
❌ redirect_uri_mismatch: the Callback URL in Salesforce must match n8n exactly
❌ Upsert fails: the field you upsert on must be marked as an External ID
❌ Custom field not showing: use Additional Fields → Custom Fields, and use the API name ending in
__c
Pro tips
- Always build in a Sandbox first. One bad loop can update thousands of records.
- Watch your API limits. Batch work with SOQL and Get All instead of looping single Gets.
- Use a dedicated integration user in Salesforce so you can see exactly what n8n changed.
- Add an Error Trigger workflow that posts failures to Slack so nothing fails silently.
🎥 Watch the build on YouTube
Real n8n workflows, AI agents and hardware builds on Node & Volt.
FAQ
Does n8n have a native Salesforce integration?
Yes. It has a Salesforce node for actions and a Salesforce Trigger node for create and update events.
Can I use n8n with a Salesforce Sandbox?
Yes. Choose Sandbox as the Environment Type in the credential.
OAuth2 or JWT?
OAuth2 is quicker to set up. JWT is better for unattended server-to-server integrations because it doesn’t depend on a user clicking Connect.
Can n8n run SOQL queries?
Yes, with the Search resource of the Salesforce node.
Is n8n cheaper than Salesforce’s own automation tools?
For many teams, yes. Self-hosted n8n has no per-execution fees, and it connects Salesforce to hundreds of other apps in the same workflow.


