SalesforceWizard

Salesforce integration tutorial: APIs, authentication and patterns

On this page (6 sections)Lesson 1: Inbound and outboundLesson 2: AuthenticationLesson 3: Integration patternsLesson 4: Reliability and limitsPractise this topicCommon questions

Most companies connect Salesforce to other systems: ERP, websites, payment systems and data platforms. Integration covers how data moves in and out of Salesforce, how systems authenticate, and which pattern fits each need.

In this topic: Lesson 1: Inbound and outbound · Lesson 2: Authentication · Lesson 3: Integration patterns · Lesson 4: Reliability and limits

Lesson 1: Inbound and outbound

Inbound: another system calls Salesforce, for example a website creating leads through the REST API. Outbound: Salesforce calls another system, for example Apex calling a payment API when an order is placed.

APIUse it for
REST APIMost real-time reads and writes; simple JSON over HTTPS
Bulk API 2.0Loading or extracting large volumes asynchronously
Composite APISeveral operations in one request, to save API calls
Pub/Sub APIPublishing and subscribing to Platform Events and Change Data Capture
SOAP APIOlder systems that need strict, typed contracts
Apex REST / SOAPYour own custom endpoints with custom logic

Lesson 2: Authentication

  • External systems connect through a connected app or the newer External Client App, using OAuth 2.0.
  • Server-to-server integrations commonly use the JWT bearer flow or client credentials flow, running as a dedicated integration user with minimal permissions.
  • For outbound calls, Named Credentials store the endpoint and External Credentials store how to authenticate, so no secrets are in code.
HttpRequest req = new HttpRequest();
req.setEndpoint('callout:Payment_API/charges');
req.setMethod('POST');
req.setBody(JSON.serialize(payload));
HttpResponse res = new Http().send(req);

Lesson 3: Integration patterns

PatternWhen to useSalesforce tools
Request and replyThe user needs the answer nowApex callouts, External Services, Salesforce Connect
Fire and forgetSend a message and continuePlatform Events, outbound messages, Queueable callouts
Batch data syncLarge volumes on a scheduleBulk API 2.0, ETL or MuleSoft
Event-drivenMany systems react to changesChange Data Capture, Platform Events, Pub/Sub API
Data virtualisationShow external data without copying itSalesforce Connect (external objects), Data 360 zero copy

Lesson 4: Reliability and limits

  • Use upsert with an external ID so a repeated message updates the same record instead of creating a duplicate.
  • Handle timeouts and errors with retries, and log failures to an object or platform event so someone can fix them.
  • Watch daily API limits in System Overview and choose Bulk API for large volumes.
  • Use middleware such as MuleSoft when many systems share data and you need central monitoring and transformation.
Tip: In interviews, describe one integration you built: the systems, direction, volume, authentication, error handling and how you monitored it.

Practise this topic

Common questions

01

What is a Named Credential?

A setup record that stores an external endpoint URL and links to how to authenticate, so Apex can call it with callout:Name and never handle secrets directly.

02

What is the difference between Platform Events and Change Data Capture?

Platform Events carry custom messages you define and publish. Change Data Capture automatically publishes events when Salesforce records are created, updated, deleted or undeleted.

03

When should I use MuleSoft?

When many systems exchange data, the same data serves several consumers, or you need central API management, transformation and monitoring. For one simple connection, Named Credentials and Apex are often enough.

Chat on WhatsApp