A Salesforce integration is not complete when the first successful API request appears in a development log. Production quality depends on what happens when a request is duplicated, an access token expires, the receiving system slows down or a partial update leaves two systems with different state.

The right architecture depends on volume, latency, ownership and the role each system plays. The following design principles apply whether Salesforce calls an external REST API directly or communicates through middleware.

Start with system ownership

Define which system owns each business entity and field. If Salesforce owns customer service status while an ERP owns invoice balances, the integration should preserve those boundaries. Without explicit ownership, two systems can overwrite each other and turn synchronization into a contest based on whichever update arrives last.

Document the direction, trigger, expected latency and conflict policy for every important data flow before choosing endpoints or middleware.

Choose synchronous communication deliberately

A synchronous callout is appropriate when a user needs an immediate response and the external operation is fast and dependable. It also couples the Salesforce transaction to the availability of another system.

Use asynchronous processing when the user does not require an immediate final result, traffic can spike, or the external service needs controlled retries. Platform Events, Queueable Apex and middleware queues can separate the initiating transaction from downstream delivery.

Make every write idempotent

Networks time out in ambiguous ways. A sender may not know whether the receiver completed an operation before the connection failed. Retrying without an idempotency strategy can create duplicate payments, cases or orders.

Salesforce external ID fields and upsert operations are useful, but idempotency should be designed around the business operation rather than assumed from an HTTP method.

Use retries only for recoverable failures

A timeout, temporary rate limit or unavailable service may succeed later. Invalid data and authorization failures usually require intervention. Retrying every error wastes capacity and hides the actual problem.

Treat authentication as an operational dependency

OAuth credentials, certificates and secrets need owners, rotation procedures and expiry monitoring. Use a dedicated integration identity with the minimum required permissions. Avoid credentials belonging to an individual employee.

Salesforce Named Credentials can simplify outbound authentication. Middleware secrets should live in an appropriate secret manager rather than source code or unprotected environment files.

Design an observable integration

A successful HTTP status is not enough. Operations teams need to connect a Salesforce event to the corresponding request, external result and any retry.

Version contracts and tolerate change

Integrations often outlive the teams that first built them. Define request and response contracts, required fields and compatibility expectations. Receivers should usually tolerate additional fields, while senders should not assume undocumented response properties.

Contract tests and representative sandbox data reduce the chance that a deployment breaks an external workflow.

Direct integration or middleware?

Direct Salesforce callouts work well for a small number of bounded integrations with manageable transformations. Middleware becomes valuable when several systems share orchestration, transformations are complex, traffic requires buffering or operational ownership sits outside the Salesforce team.

Middleware should solve an actual coordination problem. Adding it automatically can create another platform to deploy, monitor and support.

Production readiness checklist

  1. System and field ownership are documented.
  2. Authentication uses a dedicated least-privilege identity.
  3. Duplicate delivery is safe.
  4. Timeout and retry behavior is explicit.
  5. Permanent failures are visible and replayable.
  6. Logs include a cross-system correlation ID.
  7. Rate limits and realistic volumes have been tested.
  8. Secrets and personal data are protected.
  9. Deployment and rollback responsibilities are known.

Related services

CodeCrush designs Salesforce integrations across APIs, middleware and operational systems. For workflows that coordinate Salesforce with background services and human approvals, explore our business automation services.