Simple, Lightweight Integration
Integrations allow Salesforce to communicate with external systems using APIs, events, and secure connections.
1) REST API (Simple, Lightweight Integration)
✔ Explanation
REST API is used when systems communicate using JSON over HTTP.
Best for mobile apps, web apps, lightweight services.
✔ Common REST Methods
| MethodPurposeExample | ||
| GET | Fetch data | Get Account details |
| POST | Create data | Create Contact |
| PATCH | Update data | Update Opportunity |
| DELETE | Delete data | Delete record |
✔ Example REST Call (Fetch Account)
Endpoint:
Response (JSON):
✔ When to Use
- Mobile apps
- Web applications
- Lightweight data exchange
2) SOAP API (XML-based Integration)
✔ Explanation
SOAP API uses XML messages.
Used in large enterprises requiring strict security and WSDL contracts.
✔ Key Features
- Strongly typed
- WSDL dependent
- Heavy payload
✔ SOAP Example (XML Request)
✔ When to Use
- Legacy systems (banks, insurance, healthcare)
- WSDL-based integrations
3) Apex Callouts (Salesforce → External System)
✔ Explanation
Apex can make REST/SOAP calls to external services.
✔ Simple REST Callout Example
✔ Key Rule
Apex callouts must run in:
- Future methods
- Queueable
- Batch
- @AuraEnabled (async)
4) Named Credentials (Secure External Connections)
✔ Explanation
Named Credentials store:
- Endpoint URL
- Authentication (OAuth, Basic, API Key)
No need to hardcode authentication inside Apex.
✔ Example Usage in Apex
Salesforce automatically adds authentication.
✔ Benefits
- Secure
- No hardcoded secrets
- Easy to maintain
5) External Services (Low-Code Integrations)
✔ Explanation
External Services allows declarative integrations (no Apex).
You register:
- Swagger/OpenAPI specs
- Then use them directly in Flows.
✔ Example Use Case
Integrate:
✔ Payment Gateway
✔ Shipping API
✔ GST Validation API
Used directly inside Flow Builder.
6) Platform Events (Event-Driven Integrations)
✔ Explanation
Platform Events send real-time notifications between systems.
They follow a publish–subscribe model.
✔ Use Cases
- Send Order updates to ERP
- Notify external apps on Opportunity Closed
- Real-time IoT tracking
✔ Example (Publish Event in Apex)
7) Change Data Capture (CDC)
✔ Explanation
CDC sends real-time “record change” notifications for standard and custom objects.
✔ Example Notifications
- Account created
- Contact updated
- Opportunity stage changed
✔ Subscriber Systems
- Kafka
- AWS
- MuleSoft
- Integration middleware
✔ When to Use
For real-time data sync between Salesforce → External Systems.
8) Webhooks (External System → Salesforce)
✔ Explanation
External system sends real-time data to Salesforce via REST API.
✔ Example Use Case
- Payment success callback
- SMS delivery status
- WhatsApp message reply
✔ Webhook Flow
External System → Salesforce REST Endpoint → Insert/Update record
✔ Best Practice
Create an Apex REST service to receive webhook.
9) Integration Patterns & Best Practices
✔ Core Patterns
- Request & Response
- Used for REST, SOAP
- Real-time response
- Fire & Forget
- Platform Events
- CDC
- No response required
- Batch Data Sync
- Nightly integrations
- Bulk API / Data Loader
- Remote Call-In
- External systems → Salesforce (REST/SOAP)
- UI Integration
- Salesforce Screen + External UI via iframe
✔ Best Practices
🔹 Security
- Always use Named Credentials
- Never hardcode passwords / endpoints
- Use OAuth 2.0 where possible
🔹 Governor Limits
- Use Future, Queueable, Batch apex
- Use continuation in LWC for long-running requests
🔹 Error Handling
- Retry mechanisms
- Log failures
- Use Platform Events for async retry
🔹 Performance
- Use Bulk API for large data
- Use Cacheable=true for GET calls