Create an EventBridge Rule and Connect it to the API Destination
The EventBridge rule routes events from the event bus to the API destination, which results in making a REST call to publish an event back to Salesforce.
Prerequisites
Create an API destination in Create an API Destination and Connection in EventBridge.
-
In Amazon Eventbridge, click Rules.
-
Select an event bus from the dropdown that is the source of the events that you want to send to Salesforce.
-
In the Rules section, click Create rule.
-
Provide a name for your rule.
-
Click Next.
-
Under Event pattern, select Custom patterns (JSON editor), and enter a filter. If you don’t want to be specific with the filter, use a filter that matches anything except events whose source field is "
dontSend
".For more information about event pattern matching, see Content filtering in Amazon EventBridge event patterns in the AWS documentation.
-
Click Next.
-
In Select targets, under Target 1, select EventBridge API destination.
-
Select the API destination that you just created from the dropdown.
-
Expand Additional settings.
-
Select Part of the matched event, and provide the part of the event message to pass to API destination. This step prevents the top-level Amazon event fields from being sent to Salesforce. Only the part containing the Salesforce event fields from the detail section of the original event are sent.
- If the event format is an EventBridge event, provide this value:
$.detail
- If the event originates from a Lambda function, provide a path in the Lambda function result message. For example, to return a section from the function response, use
$.detail.responsePayload.{responseSection}
.
- If the event format is an EventBridge event, provide this value:
-
Click Next and then Next.
-
Review the rule, and then click Create rule.
Note Troubleshooting Tip: To troubleshoot the execution of the API destination, you can add a dead letter queue to the target. The dead letter queue is an Amazon SQS queue that receives the messages that couldn’t be delivered along with the errors. From the Amazon SQS console, you can poll messages in the queue to view the messages and errors. For more information, see Event retry policy and using dead-letter queues and Receiving and deleting messages (console).
See Also
- AWS Documentation: API Destinations
- AWS Compute Blog: Using API destinations with Amazon EventBridge