To connect n8n to Salesforce you create an external client app in Salesforce, authorise it from an n8n credential with OAuth2 or JWT, and then use the Salesforce node to read and write records. That part is quick. An n8n Salesforce integration that survives production also needs a dedicated user, upserts on an external ID, respect for API limits and a plan for failures.
Step 1: create the app and the credential
n8n supports two authentication methods for Salesforce: OAuth2 and JWT. Both need an app on the Salesforce side.
The n8n documentation notes that Salesforce is deprecating connected apps in favour of external client apps. Existing connected apps keep working, but a new integration should use an external client app. The outline, following n8n's instructions:
- In Salesforce Setup, open App Manager and choose New External Client App.
- Enable OAuth and add the callback URL that n8n's instructions give for your method.
- Select the scopes n8n asks for: full access, and "perform requests at any time" (the refresh token).
- For JWT, enable the JWT Bearer Flow and upload a certificate. For OAuth2, keep the consumer key and secret.
- In n8n, pick the Environment Type (Production or Sandbox), paste the consumer key as the Client ID, and finish the sign-in or add the private key.
OAuth2 is quicker: you sign in once in a browser. JWT has no interactive sign-in, which suits a server-to-server integration. In our view JWT is the better choice for anything long-lived.
Use a dedicated integration user
n8n acts in Salesforce as the user who authorised the connection. If that is a salesperson's or an admin's own login, the integration inherits everything that person can do, and it breaks the day the account is deactivated.
We would create a separate integration user with a permission set that grants only the objects and fields the workflows need. The app asks for a broad OAuth scope, so the user's permissions are where you draw the real boundary.
Step 2: the Salesforce node
The Salesforce node covers accounts, contacts, leads, opportunities, cases, tasks, attachments, documents, users and custom objects. It can run a SOQL query and invoke a Flow. Custom fields are added under Additional Fields.
For anything the node does not support, n8n's documentation points to the HTTP Request node with the same Salesforce credential.
Step 3: choose how workflows are triggered
| Option | How it works | Good for | Watch out for |
|---|---|---|---|
| Salesforce Trigger node | n8n polls Salesforce on an interval | Simple "record created or updated" flows | Not instant, and each poll uses API calls |
| Flow calling an n8n webhook | A Salesforce Flow sends the event out with HTTP Callout | Near real-time reactions, precise conditions | Needs a Flow and a named credential in Salesforce |
| Scheduled query | n8n runs a SOQL query on a schedule | Nightly syncs and reports | Tracking what was already processed |
The Salesforce Trigger node offers created and updated events for accounts, contacts, leads, opportunities, cases, tasks, attachments, users and custom objects. It is a polling trigger: the node's source describes it as fetching data "on specified polling intervals".
When you need a faster reaction, let Salesforce push. A Flow can call an external service with HTTP Callout, and the n8n Webhook node starts a workflow when it receives that call. The entry conditions then live in the Flow, where your admin can see them.
Step 4: upsert with an external ID
A plain "create" is a common cause of duplicates. If a workflow runs twice, or a retry fires after a timeout, you get two records.
An upsert fixes that. You add a custom field marked as an external ID, fill it with the ID from the source system, and let Salesforce decide. The REST API documentation states the rule plainly:
- no match on the external ID: a new record is created
- one match: that record is updated
- several matches: an error is returned and nothing is written
The n8n node has a "create or update" operation for accounts, contacts, leads, opportunities and custom objects. Use it wherever the source system has a stable ID. The third rule is also a warning: keep the external ID field unique, or the upsert will start failing.
Step 5: stay inside the API limits
Salesforce gives every org a total number of API requests per 24 hours. For Enterprise Edition, the documented formula is 100,000 plus 1,000 per Salesforce licence, plus any purchased add-ons. The limit is shared across the whole org, not counted per user, so your n8n workflows draw from the same pool as every other integration.
Three habits keep usage low:
- Batch writes. With sObject Collections a request that acts on multiple records counts as a single call. The node's operations act on one record per item, so batching means the HTTP Request node.
- Use Bulk API 2.0 for big jobs. Salesforce recommends it for operations over 2,000 records.
- Poll less often. A trigger that checks every minute spends calls all day, including nights and weekends.
Salesforce can email a named user when API usage passes a threshold you set. Turn that on before launch.
Step 6: error handling and retries
A Salesforce write can fail for reasons that have nothing to do with n8n: a validation rule, a required field, a record locked by another process.
n8n gives you two tools. Each node has a Retry On Fail setting, which the documentation limits to five tries and five seconds between them. That handles a brief network problem. It does not handle a validation rule, because the tenth attempt fails the same way as the first.
For everything else, set an error workflow. It runs whenever an execution fails and receives the workflow name and the failing node. A good error workflow does three things: saves the failed item somewhere it can be replayed, tells a named person, and records the Salesforce error message as it came back. We would log failures to a custom object in Salesforce, so the people who own the data see the problem in the tool they already use.
The five mistakes that break in production
- Connecting with a person's login. The integration stops when that person leaves or their permissions change. Use an integration user.
- Creating where you should upsert. Every retry becomes a duplicate. Add an external ID from the start.
- Hardcoding IDs. Record type, owner and queue IDs differ between a sandbox and production. A workflow tested in the sandbox then fails, or writes to the wrong owner, on day one. Look IDs up by name, and keep separate credentials for each environment.
- Building an update loop. n8n updates a record, the "record updated" trigger fires, n8n updates it again. Filter on a specific field change, or have the integration user's own edits ignored.
- Failing silently. No error workflow, no alert, and nobody notices until a salesperson asks where the leads went.
When not to use n8n
If the logic touches only Salesforce data, such as updating a field when a stage changes, a Flow is the right place for it. It runs inside the platform, uses no API calls and your admin can maintain it. n8n earns its place when the process crosses into other systems. Our Salesforce and n8n integration page shows the typical flows.
FAQ
How do I connect n8n to Salesforce?
Create an external client app in Salesforce Setup, enable OAuth, and copy its consumer key into a Salesforce credential in n8n. Choose OAuth2 or JWT, select Production or Sandbox, and authorise. Then add a Salesforce node to a workflow and test with a single record.
Does the n8n Salesforce integration work with custom objects and fields?
Yes. The Salesforce node has operations for custom objects, including upsert, and custom fields can be added to standard objects under Additional Fields. For API features the node does not cover, the HTTP Request node can use the same credential.
Does n8n count against Salesforce API limits?
Yes. Every read, write and poll is an API request against the org's 24-hour allocation, which all integrations share. Batch your writes, use the Bulk API for large jobs and avoid very short polling intervals.
Can n8n react to Salesforce changes in real time?
Not with the trigger node alone, because it polls on an interval. For near real-time, have a Salesforce Flow call an n8n webhook when the record changes.
How much does an n8n Salesforce integration cost?
It depends on the number of flows, the objects and systems involved, data volume and how much error handling is required. We scope first and agree a fixed project price before the build. n8n hosting and any Salesforce add-ons are separate and stay on your accounts.
Need this built and tested for your org? See our Salesforce services or book a free 30-minute call.