The integration architecture decision
Every Salesforce implementation with >1 system needs an integration architecture. The three patterns — direct API (Salesforce Connect, Apex callouts), middleware (MuleSoft, Boomi, Zapier), and event-driven (Platform Events, Change Data Capture, Pub/Sub API) — each have distinct trade-offs in cost, complexity, latency, and maintainability. Choosing the wrong pattern is the #1 cause of integration technical debt.
Pattern 1: Direct API (Apex callouts + REST/SOAP)
Salesforce calls external APIs directly via Apex Http callouts, or external systems call Salesforce via REST/SOAP API. Best for: point-to-point integrations (1 Salesforce + 1 external system), low-frequency calls (<1000/day), and real-time requirements (user needs the response immediately). Pros: no middleware cost, simple to build, low latency. Cons: doesn't scale (>3 systems = spaghetti), no retry/queue logic, Salesforce governor limits (100 callouts per transaction, 24-hour limit).
Pattern 2: MuleSoft middleware
MuleSoft (Salesforce-owned) sits between Salesforce and all external systems, routing and transforming data. Best for: enterprise integrations (3+ systems), complex transformations (field mapping, format conversion), and high-throughput scenarios (>10k calls/day). Pros: centralized monitoring, retry logic, batch processing, pre-built connectors (SAP, Oracle, Workday). Cons: expensive (~$100k+/year license), requires MuleSoft developers, adds latency (1 extra hop).
Pattern 3: Event-driven (Platform Events + Change Data Capture)
Salesforce publishes events when records change (CDC) or when business events occur (Platform Events). External systems subscribe via the Pub/Sub API and react. Best for: decoupled architectures, near-real-time sync (sub-second), and fan-out scenarios (1 change → multiple subscribers). Pros: loose coupling, scalable, no polling. Cons: eventual consistency (not instant), complex to debug, requires event schema management.
Decision framework
Use direct API if: 1-2 systems, <1000 calls/day, real-time response needed. Use MuleSoft if: 3+ systems, complex transformations, enterprise budget, need centralized monitoring. Use event-driven if: near-real-time sync, multiple subscribers, decoupled architecture preferred. Most enterprises use a mix: direct API for simple point-to-point, MuleSoft for ERP/HRIS integrations, and events for cross-system data sync.
Common anti-patterns
Anti-pattern 1: Polling — external system polls Salesforce every 5 minutes via REST API. Use CDC instead (push, not pull). Anti-pattern 2: Synchronous Apex callouts in triggers — blocks the user, hits governor limits. Use Queueable Apex (async) or Platform Events. Anti-pattern 3: Middleware for 2 systems — over-engineering. Use direct API. Anti-pattern 4: No error handling — integration fails silently. Use platform events for error logging + retry queues.
"Choosing the wrong integration pattern is the #1 cause of integration technical debt. Most enterprises use a mix of all three."
Key Takeaway
Direct API for 1-2 systems (<1000 calls/day, real-time). MuleSoft for 3+ systems (complex transforms, enterprise budget). Event-driven for near-real-time fan-out. Avoid polling, sync callouts in triggers, middleware overkill, and silent failures.