Creating Salesforce listeners
Know how to create Salesforce listeners.
Before you begin
Procedure
- Go to the project in which you want to create a listener.
- Click Events > Listeners.
- Click New Listener.
The Add Listener screen appears.
- Enter the following details in the Add Listener screen:
- Type of listener
- Select the name of the connector from the drop-down menu for which you want to create a listener.
- Select version
- Select the connector version for which you want to create a listener.
- Enter the following details in the Add Listener configuration
screen:
- Name
- Provide a display name for the listener. It can contain alphanumeric characters, underscores (_), and hyphens (-).
- Description
- Provide a description for the listener.
- Streaming API endpoint URL
- Specify the endpoint of the streaming provider. For configuring a Salesforce streaming endpoint, specify the URL in the following format: https://<Salesforce_Instance>/cometd/<Salesforce API version>, for example https://ap5.salesforce.com/cometd/44.0.
- Select replay option
- The listener for Salesforce can subscribe and listen to Salesforce events. This option allows
the listener to establish a persistent connection with Salesforce. This connection remains open
while transmitting the events until either side closes the connection. Through this established
connection, events are streamed to the listener. If the connection is lost due to a network failure
or any other reason, you can retrieve the standard-volume events that are within the 24-hour
retention window in Salesforce. You can retrieve Salesforce events only if you are using Salesforce
v37.0 or later versions.
Each Salesforce event is assigned a unique opaque ID for each event. This ID is contained in the replayId field of the event object. The replayId field value, which is populated by Salesforce when the event is delivered to subscribers, refers to the position of the event in the event stream. For consecutive events, the replayId values are not sequential. For example, an event with ID 110 can follow an event with ID 101.
To replay events, Salesforce provides a way to configure the replayId while subscribing to a particular channel. You can replay the events by specifying the replay option, and use it during resubscription to retrieve events that are within the retention window.
- Last Received
- Receive all events that occurred after the most recently saved replay ID. The webMethods Integration server by default saves the replay ID of your most recently received event. When you select this option, you will receive all events that occurred after the most recently saved replay ID each time the listener reconnects.
- New
- Receive new events that are broadcast after the client subscribes and replay only the new events from the time the listener is enabled.
- All
- Receive all events including past events that are within the retention window and the new events. Due to the possibility of exceeding daily streaming consumption limits, it is not recommended to use this option.
- Select Account
- Select an account to connect to the application. The streaming function uses the existing authentication, timeouts, truststore, keystore, and hostname verification configurations from the referenced account selected in the Select Account drop-down menu field.
- Select subscription
- Select a channel from the list of available subscription channels that you want the listener to
connect. Currently, the following subscription events are supported:
- Salesforce Push Topic Event
- Select this subscription event if you want to receive notifications for changes to Salesforce data that matches a SOQL query you define.
- Salesforce Platform Event
- Select this subscription event if you want to receive notifications about event messages published by publishers in real time.
- Salesforce Change Data Capture Event
- Select this subscription event if you want to receive notifications about the changes about the create, retrieve, update, and delete operations on Salesforce records.
- Salesforce Generic Event
- Select this subscription event if you want to receive notifications about events that are external to Salesforce.
Note: For more information about these events, see the Salesforce documentation. - Click Next.
You are redirected to the Parameters and Headers screen.
- Review and configure the Parameters.
- Review the pre-configured parameters such as name and description, the data type used to represent the information that the parameter can hold, and the parameterization type for the subscription request, for the selected subscription.
- Provide a value for the Default value parameter. The supported default value formats for each Salesforce subscription event are listed in the following table:
Salesforce Event Supported Default Value Formats Push Topic Event PushTopic name Platform Event API name Change Data Capture Event The following formats are supported: - ChangeEvent name
- ObjectNameChangeEvent
- CustomObjectName_ChangeEvent
Generic Event GenericStreamingChannel name - Click Add Header to add the necessary headers and provide the
following details:
- Header name
- Provide a valid header name.
- Header value
- Provide a default value for the header.
- Status
- Toggle the status switch to Active to include the header as a part of the subscription request.
- Actions
- Click Delete to delete the header.
- Click Next and specify the following details in the
Event screen:
- Select Flow service name
- Select the Flow service that you want to run when the subscribed event occurs.
- Select a user to run Flow service
- Select a project user that you want to use to run the selected Flow service. If the selected user does not have the necessary permissions to run the specified Flow service, the Flow service does not run when the subscribed event occurs.
- Select ErrorCallBackFlowService name
- Choose an existing Flow service to initiate when an error occurs that the listener cannot automatically recover and requires manual intervention. Flow services that are created with Error Callback Service Spec specification are only listed in the list.
Note:- You can also create a new Flow service by clicking the Add button and providing the name.
-
By default, the Error Callback Service Spec specification is selected for the Flow services that are created from this page. In case, while configuring the Flow service, if you have cleared the Error Callback Service Spec option, then the Flow service is not listed in the Select ErrorCallBackFlowService name field.
- Click Save.
The Summary tab appears.
- Review the listener summary. Note: You can click the Flow service name to view and configure the details about the Flow service. From this method, the Error Callback Service Spec option is selected and the Specification reference field is in the disabled state.
- Click Save.
The listener is created and is in a disabled state. To enable the listener, follow the instructions that are mentioned in Managing listeners.Note:
- Listeners that are created in one tenant cannot be published to another tenant.
- The Salesforce listener receives events in the same order in which Salesforce sends them. As the Salesforce listener processes the messages asynchronously, there is no guarantee of the order of event processing.