Skip to content

Salesforce Inbound Endpoint Example

The Salesforce streaming Inbound Endpoint allows you to perform various operations on Salesforce streaming data via WSO2 EI.

The Salesforce streaming API receives notifications based on the changes that happen to Salesforce data with respect to an SQQL (Salesforce Object Query Language) query you define, in a secured and scalable way. For more information, navigate to Salesforce streaming documentation.

What you'll build

The Salesforce inbound endpoint supported via the WSO2 EI is a listening inbound endpoint that can consume messages from Salesforce. This injects messages to a sequence in WSO2 EI. However, for simplicity of this example, we will just log the message. You can extend the sample as required using WSO2 EI mediators.

In this exmple we can trigger the notifications to the Salesforce Inbound Endpoint via creating the Platform events or PushTopic methods. Please note that our example configurations are based on creating the PushTopic method. You can use the instructions given in the sf-rest inbound endpoint configuration documentation.

The following diagram illustrates all the required functionality of the Salesforce inbound operations that you are going to build.

For example, we are building an integrated example driven through the Salesforce connector and Salesforce Inbound Endpoint. The user calls the Salesforce REST API. It invokes the create sequence and creates a new account in Salesforce. Then, through the retrieve sequence, it displays all the existing account details to the user.

Now that you have configured the Salesforce Inbound Endpoint, use the following Inbound Endpoint configuration to retrieve account details from your Salesforce account. The Salesforce inbound endpoint of WSO2 EI acts as a message receiver. You can inject that message into the mediation flow for getting the required output.

Salesforce Inbound Endpoint

Configure inbound endpoint using WSO2 Integration Studio

  1. Download WSO2 Integration Studio. Create an Integration Project as below. Creating a new Integration Project

  2. Right click on Created Integration Project -> New -> Inbound Endpoint -> Create A New Inbound Endpoint -> Inbound Endpoint Creation Type**and select as **custom -> Click Next. Creating inbound endpoint

  3. Click on Inbound Endpoint in design view and under properties tab, update class name to org.wso2.carbon.inbound.salesforce.poll.SalesforceStreamData.

  4. Navigate to the source view and update it with the following configuration as required.

<?xml version="1.0" encoding="UTF-8"?>
<inboundEndpoint xmlns=""
      <parameter name="inbound.behavior">polling</parameter>
      <parameter name="interval">100</parameter>
      <parameter name="sequential">true</parameter>
      <parameter name="coordination">true</parameter>
      <parameter name="connection.salesforce.replay">false</parameter>
      <parameter name="connection.salesforce.EventIDStoredFilePath">/home/kasun/Documents/SalesForceConnector/a.txt</parameter>
      <parameter name="connection.salesforce.packageVersion">37.0</parameter>
      <parameter name="connection.salesforce.salesforceObject">/topic/Account</parameter>
      <parameter name="connection.salesforce.loginEndpoint"></parameter>
      <parameter name="connection.salesforce.userName">Username</parameter>
      <parameter name="connection.salesforce.password">test123XXXXXXXXXX</parameter>
      <parameter name="connection.salesforce.waitTime">5000</parameter>
      <parameter name="connection.salesforce.connectionTimeout">20000</parameter>
      <parameter name="connection.salesforce.soapApiVersion">22.0</parameter>
Sequence to process the message.

In this example for simplicity we will just log the message, but in a real world use case, this can be any type of message mediation.

<?xml version="1.0" encoding="UTF-8"?>
<sequence name="test" onError="fault" xmlns="">
    <log level="full"/>

Note: To configure the connection.salesforce.password parameter value, please use the steps given under the topic Reset Security Token in the Salesforce inbound endpoint configuration document.

Exporting Integration Logic as a CApp

CApp (Carbon Application) is the deployable artefact on the Enterprise Integrator runtime. Let us see how we can export integration logic we developed into a CApp. To export the Solution Project as a CApp, a Composite Application Project needs to be created. Usually, when a solution project is created, this project is automatically created by Integration Studio. If not, you can specifically create it by navigating to File -> New -> Other -> WSO2 -> Distribution -> Composite Application Project.

  1. Right click on Composite Application Project and click on Export Composite Application Project.
    Export as a Carbon Application

  2. Select an Export Destination where you want to save the .car file.

  3. In the next Create a deployable CAR file screen, select inbound endpoint and sequence artifacts and click Finish. The CApp will get created at the specified location provided in the previous step.


  1. Navigate to Salesforce V2.1.0 in the connector store. Download the .jar file by clicking Download Inbound Endpoint as shown below. Copy this .jar file to the /lib folder.

Download inbound endpoint

  1. Copy the exported carbon application to the /repository/deployment/server/carbonapps folder.

  2. Start the WSO2 EI server.


Note: If you want to test this scenario by inserting data manually into the created object records, please follow the steps given under topic Testing the PushTopic Channel in the Salesforce inbound endpoint configuration document.

Please use the Salesforce REST Connector example testing steps to test this Inbound Endpoint scenario;

Save a file called data.json with the following payload (change the value of Name field as Manager).

 "fieldAndValue": {
    "name": "Manager",
    "description":"This Account belongs to WSO2"
Invoke the API as shown below using the curl command. Curl application can be downloaded from here.

curl -X POST -d @data.json http://localhost:8280/salesforcerest --header "Content-Type:application/json"
You will get a set of account names and the respective IDs as the output. At the same time, in the WSO2 EI console you can see the following message.

Expected respons

To: , MessageID: urn:uuid:2D8F9AFA30E66278831587368713372, Direction: request, Payload: {"event":{"createdDate":"2020-04-20T07:45:12.686Z","replayId":4,"type":"created"},"sobject":{"Id":"0012x0000048j9mAAA","Name":"Manager"}}

What's next