In this post, we will about is Salesforce Integration and different way to integrate Salesforce System with external systems. This Salesforce integration guide will help you to understand Salesforce integration Patterns and Integration Best Practices. Let’s understand What is Salesforce Integration? and start our Salesforce Integration Crash course.
Let start our Salesforce Integration Tutorial to cover all fundamental of Salesforce Integration.
- What is Salesforce Integration?
- Why Integration
- Basic Integration Architecture
- Salesforce Integration Direction
- Salesforce Integration Levels
- Time-Based Integration Processes
- The Inception of API
- Difference between SOAP vs REST
- What all Integration options are available in Salesforce?
- #1. What is REST API?
- #2. Apex REST API
- #3. SOAP API
- #4. Apex SOAP API
- #5. Connect REST API
- #6. Analytics REST API
- #7. User Interface API
- #8. Tooling API
- #9. Bulk API
- #10. Metadata API
- #11. Streaming API
- Ways to Fetch data from SFDC
- Data Integration with Salesforce
- Salesforce Integration Patterns
- Enterprise Salesforce integration
- Why Middleware in Enterprise Context
- Related Post
What is Salesforce Integration?
Salesforce Integration is a process of connecting two or more applications. Enterprise system uses many applications, many or most of which are not designed to work with one another out of the box. Each application can have data, business logic, presentation, and security layers, all of which are possible targets for integration.
Salesforce can’t be the source of everything. It can be CRM or any Custom application. However, SAP can own Order Management or Inventory, an External system for sending email, Other System for Payment, and External Fleet Management, And possibilities are high that Salesforce would need to exchange data with these systems.
Basic Integration Architecture
Let’s understand the Integration Architecture first. While doing integration we have a different way to integrate the system using point-to-point, hub & spoke, and ESB. All of them have their own benefit. Let’s understand it in detail.
1. Point to Point
Each system is connected to every other system through direct integration.
Easy to implement with only a few systems.
Difficult to scale
2. Hub and Spoke
- Every system connects to the Hub.
- All data transfer is done through the hub.
- Easy to design and implement.
- Architectures are proprietary in nature.
- Single point of failure.
- Inability to support large transaction volumes
3. Enterprise Service Bus (ESB)
- Distributed services architecture.
- Employs distributed adapters.
- Highly scalable.
Salesforce Integration Direction
Integration can be two direction inbound integration or outbound Integration.
- Inbound Integration: Inbound: An external system initiates contact with Salesforce.
- Outbound Integration: Outbound: Salesforce initiates contact with an external system.
Salesforce Integration Levels
- Unser Interface: Display information from external system in Salesforce Application.
- Application Logic: Leverage interfaces, such as APIs ,to allow interaction with external data and business processes.
- Data: Extract, Transform and Load data between data stores.
What is DMZ network in Integration Levels
A DMZ Network is a perimeter network that protects and adds an extra layer of security to an organization’s internal local-area network from untrusted traffic. A common DMZ is a subnetwork that sits between the public internet and private networks.
Time-Based Integration Processes
Salesforce integration can be Synchronous, Asynchronous, and a Batch process. Let see when to use which time-based Salesforce Integration processes.
1. Synchronous Process
A user action creates a request, and the user is blocked from continuing until the response is returned. A very near real-time response is expected and needed.
- Tools/Technique : REST or SOAP API
Scenario: When a Salesforce account is created, a lookup must happen in the existing legacy system to check whether the Salesforce account already exists or not before the Save is completed.
2. Asynchronous Process
A user action creates a request, and the system does not wait for the response before letting the user move to the next task. Analogous to near real-time process
- Tools/Technique : MQ ,Kafka
Scenario: When the user changes an account record, the process of replicating the change to external systems begins immediately. However, the process of replication does not block the user from continuing the work.
3. Batch Process
Large data volumes are broken into chunks and processed in queues based on available resources. Can be implemented through Bulk API,SOAP/REST API. Often associated with a scheduled process.
- Tools/Technique: Bulk API/ETL/File Transfer
Scenario: When we need to update account information once in a day to a back-end system.
The Inception of API
API stands for Application Programming Interface. It is a set of definitions and protocols for building and integrating application software. API enables integration with heterogeneous systems and data to bring new business models, products, and services to the forefront.
The Evolution of API
Simple Object Access Protocol (SOAP) is a protocol for exchanging information encoded in Extensible Markup Language (XML) between a client and a procedure or service that resides on the Internet.
REST is an acronym for Representational State Transfer. The basic premise is that developers use the standard HTTP methods, GET, POST, PUT and DELETE, to query and mutate resources represented by URIs on the Internet. REST APIs are designed to make server-side data readily available by representing it in simple formats such as JSON and XML.
GraphQL was developed in response to REST APIs, with the idea that you could execute precise syntax that retrieves only what is needed, lightening the payload and simplifying the process significantly. The API can accept specific requests and return a result that matches exactly what the user is looking for.
In gRPC, RPC stands for Remote Procedure Call and refers to something that can execute a function housed elsewhere but in a different context. A user on one side will select a remote procedure to execute, serialize the necessary parameters and then append any additional information into the message. This will then be sent to the server, which interacts with the other application, decoding the message and executing the operation. A result then comes back to the initial user.
Difference between SOAP vs REST
|Web Services API / SOAP||REST|
|Meaning/Uses||Simple Object Access Protocol, uses WSDL||Representational State Transfer, native use of all HTTP methods|
|Design||Standardized protocol with pre-defined rules to follow.||Architectural style with loose guidelines and recommendations.|
|Approach||Function-driven (data available as services, e.g.: “getUser”)||Data-driven (data available as resources, e.g. “user”).|
|Statefulness||Stateless by default, but it’s possible to make a SOAP API stateful.||Stateless (no server-side sessions)|
|Caching||API calls cannot be cached.||API calls can be cached.|
|Security||WS-Security with SSL support. Built-in ACID compliance.||Supports HTTPS and SSL|
|Performance||Requires more bandwidth and computing power.||Requires fewer resources.|
|Message format||Only XML.||Plain text, HTML, XML, JSON, YAML, and others.|
|Transfer protocol(s)||HTTP, SMTP, UDP, and others.||Only HTTP|
|Recommended for||Enterprise apps, high-security apps, distributed environment, financial services, payment gateways, telecommunication services.||Public APIs for web services, mobile services, social networks.|
|Advantages||High security, standardized, extensibility.||Scalability, better performance, browser-friendliness, flexibility.|
|Disadvantages||Poorer performance, more complexity, less flexibility.||Less security, not suitable for distributed environments.|
|Error Handling||SOAP response will contain error information.||Custom since there is no built-in.|
What all Integration options are available in Salesforce?
There are lots of Integration options available in Salesforce. Here is Salesforce Integration Cheatsheet.
|S.No||API Name||Protocol||Data Format||Communication|
|1||REST API||REST||JSON, XML||Synchronous|
|2||Apex REST API||REST||JSON, XML, Custom||Synchronous|
|3||SOAP API||SOAP (WSDL)||XML||Synchronous|
|4||Apex SOAP API||SOAP (WSDL)||XML||Synchronous|
|5||Chatter REST API||REST||JSON, XML||Synchronous (photos are processed asynchronously)|
|6||Analytics REST API||REST||JSON, XML||Synchronous|
|7||User Interface API||REST||JSON||Synchronous|
|8||Tooling API||REST or SOAP (WSDL)||JSON, XML, Custom||Synchronous|
|10||Metadata API||SOAP (WSDL)||XML||Asynchronous. Retrieve, deploy, and modify metadata|
|11||Streaming API||Bayeux||JSON||Asynchronous. Push notifications from Salesforce to|
Let see different option available in Salesforce and when to use which Salesforce API for Integration.
#1. What is REST API?
The Salesforce REST API lets you integrate with Salesforce applications using simple HTTP methods, in either JSON or XML formats, making this an ideal API for developing mobile applications or external clients. Salesforce also supports Apex REST, which lets you create Web services on Force.com using Apex.
- Representational State Transfer is a style of software architecture for distributed hypermedia systems.
- REST API has a lightweight request and response framework
- Simple, easy to use and powerful web service based on RESTful principles.
- Expose functionality via REST resources and HTTP methods.
- (CRUD) records, search or query your data, retrieve object metadata, and access information about limits in your org.
- REST API supports both XML and JSON.
- Mobile and Web apps
- Rest resource is referenced using URI, abstraction of information, access using HTTP methods
1.1. Learn the basic of REST API
1.2. Key points to consider for the REST APIs
- Authentication And Authorization
- Caching Behvior
- Cross-Origin Resource Sharing
- Composite Resources
- Multipart Message for Blog data
- Status Codes and Error Response.
#2. Apex REST API
You can use Apex REST API when out of the box REST API will not be able to fulfill your business requirement. For that, you can create your Apex REST API and expose it to an external system.
Here is some key consideration for APEX REST API.
Note : Use the Continuation class in Apex to make a long-running request to an external Web service or Chaining Asynchronous Callouts
#3. SOAP API
- Application layer protocol used to exchange structured information between systems
- It uses a Web Services Description Language (WSDL) file to rigorously define the parameters for accessing data through the API.
- SOAP API supports XML only.
- Because SOAP API uses the WSDL file as a formal contract between the API and consumer, it’s great for writing server-to-server integrations.
- Access to Salesforce data and business logic
- Handles medium data volumes
- Updates multiple records with single
3.1. What is the difference between SOAP and REST?
Here is the difference between SOAP and REST API.
|SOAP API||REST API|
|Relies on SOAP protocol||Relies on REST architecture using HTTP|
|Transports data in XML||Transports data in JSON or XML|
|Highly structured/ typed||Less structured? Less bulky data|
|Designed with large enterprise application in mind||Designed with mobile devices in mind|
3.2. What is WSDL?
WSDL (Web Services Description Language) is an XML document that describes a web service. There are two types of WSDL in Salesforce:
- Enterprise WSDL
- Partner WSDL
3.3. What is the difference between Enterprise WSDL and Partner WSDL?
Here is difference between Enterprise WDSL and Partner WDSL.
|Enterprise WDSL||Partner WSDL|
|Strongly Typed||Loosely Typed|
|Tied to a specific configuration of Salesforce||Useful for any configuration of Salesforce|
|Changes if custom field or custom objects are added to your organization||Does not changes if custom field or custom objects are added to an organization’ Salesforce configuration|
#4. Apex SOAP API
Same as Apex REST API. You can Expose APEX SOAP API to an external system. Apex SOAP API supports both authentication OAuth 2.0 and Session ID.
#5. Connect REST API
Connect REST API provides programmatic access to B2B Commerce, CMS managed content, Experience Cloud sites, files, notifications, topics, and more. Use Connect REST API to display Chatter feeds, users, and groups, especially in mobile applications.
#6. Analytics REST API
You can access CRM Analytics features such as datasets, dashboards, and lenses programmatically using the CRM Analytics REST API.
#7. User Interface API
Build Salesforce UI for native mobile apps and custom web apps using the same API that Salesforce uses to build for the web and Salesforce for Android, iOS, and mobile web. Build user interfaces that let users work with records, list views, actions, favorites, and more.
#8. Tooling API
Tooling API exposes metadata used in developer tooling that you can access through REST or SOAP. You can use Tooling API to build custom development tools or apps for Platform applications.
#9. Bulk API
Bulk API is a specialized RESTful API for loading and querying lots of data at once. By lots, we mean 50,000 records or more. Bulk API is asynchronous, meaning that you can submit a request and come back later for the results. This approach is the preferred one when dealing with large amounts of data. There are two versions of Bulk API (1.0 and 2.0). Both versions handle large amounts of data, but we use Bulk API 2.0 in this module because it’s a bit easier to use
#10. Metadata API
The main purpose of Metadata API is to move metadata between Salesforce orgs during the development process. Use Metadata API to deploy, retrieve, create, update, or delete customization information, such as custom object definitions and page layouts.
#11. Streaming API
It enables the transmission of real-time data from the Salesforce Platform. Data is transmitted using Push Technology. Push Technology transfers information that is initiated from a server to the client. You can use one of the subscription mechanisms such as CometD, and Subscription API in node js or in Mulesoft. Push Technology is also called the publish/subscribe Model
- Push Topic: Stream Salesforce changes based on SOQL
- Generic Streaming Events: publish Arbitrary String value
- Change Data Capture: New Version of Push Topic. No to SOQL
- Platform Event: new Version of Generic Streaming.
11.1. Tools for Event-Driven Architecture with Salesforce
11.1.1 Push Topic
Push Topic enables to stream Salesforce record changes to clients based on criteria you define in
a SOQL query in a PushTopic record
Learn more about PushTopic Events in Salesforce.
11.1.2 Generic Streaming Events
Generic Streaming events enable you to publish event messages with an arbitrary string value that the client receives.
11.1.3 Change Data Capture
Change Data Capture is a streaming product on the Lightning Platform that enables you to efficiently integrate your Salesforce data with external systems. Change data capture is also called CDC. With Change Data Capture, you can receive changes in Salesforce records in real time and synchronize corresponding records in an external data store.
Check when and how to use change data Capture here.
11.1.4 Platform Event
Platform Event is based on Event-Driven Architecture which enables apps to communicate inside and outside of Salesforce. Platform events are based on the publish/subscribe model and work directly with a message bus that handles the queue of incoming events and processes listening for them. This is built in real-time integration patterns in the Salesforce Platform which helps to reduce point-to-point integration.
Learn more about Platform Events in Salesforce.
Ways to Fetch data from SFDC
There are different way to fetch data from Salesforce.
- Change Data Capture
- Outbound Messaging
- Apex Custom Code
- Data Export
- Salesforce Connector
- Heroku Connect
Data Integration with Salesforce
There are different way and option are available for Data Integration with Salesforce.
- Salesforce to External Systems
- External Systems to Salesforce
- Salesforce to Salesforce
Salesforce Integration Patterns
There are different Integration patters like request and reply/response, Fire and forget, Batch Data Synchronization, Remote Call In, and Data Virtualization.
In Salesforce we have below Integration patterns.
- “Remote Process Invocation—Request and Reply “: Salesforce invokes a process on a remote system, waits for the completion of that process, and then tracks the state based on the response from the remote system.
- “Remote Process Invocation—Fire and Forget “: Salesforce invokes a process in a remote system but doesn’t wait for the completion of the process. Instead, the remote process receives and acknowledges the request and then hands off control back to Salesforce.
- “Batch Data Synchronization “: Data stored in Lightning Platform is created or refreshed to reflect updates from an external system, and when changes from Lightning Platform are sent to an external system. Updates in either direction are done in a batch manner.
- “Remote Call-In “: Data stored in Lightning Platform is created, retrieved, updated, or deleted by a remote system.
- “UI Update Based on Data Changes “: The Salesforce user interface must be automatically updated as a result of changes to Salesforce data.
- “Data Virtualization “: Salesforce accesses external data in real-time. This removes the need to persist data in Salesforce and then reconcile the data between Salesforce and the external system
Learn about Salesforce integration Patterns and Integration Best Practices.
Enterprise Salesforce integration
Why Middleware in Enterprise Context
Here are 6 Fundamental Principles for Middleware in Enterprise Context:
- Transnationality: While Salesforce is transactional within itself, it’s not able to participate in distributed transactions or transactions initiated outside of Salesforce.
- Event handling: Event handling In Salesforce integrations using middleware, the control of event handling is assumed by the middleware layer.
- Queuing and buffering: Queuing and buffering generally rely on asynchronous message passing, as opposed to a request-response architecture.
- Extract, transform, and load: Extracting data from the source systems. This typically involves data from several source systems, and both relational and non-relational structures.
- Translation and transformation: Transformation is the ability to map one data format to another to ensure interoperability between the various systems being integrated. Typically, this entails reformatting messages enroute to match the requirements of the sender or recipient.
- Mediation routing: Many middleware-based solutions depend on a message queue system. While some implementations permit routing logic to be provided by the messaging layer itself, others depend on client applications to provide routing information or allow for a mix of both paradigms.
Learn more about Enterprise Integration.
Check our below post for Salesforce Integration tutorial.
Before integrating anything with Salesforce, as per Architect, it is necessary which system components are important for security and may impact with integration pattern to be used. I hope this Salesforce integration guide helped you to understand the Salesforce Integration Options. Thank you so much Mrutyunjay Palai for such a great content