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.


Create an API destination in Create an API Destination and Connection in EventBridge.

  1. In Amazon Eventbridge, click Rules.

  2. Select an event bus from the dropdown that is the source of the events that you want to send to Salesforce.

  3. In the Rules section, click Create rule.

  4. Provide a name for your rule.

  5. Click Next.

  6. 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.

  7. Click Next.

  8. In Select targets, under Target 1, select EventBridge API destination.

  9. Select the API destination that you just created from the dropdown.

  10. Expand Additional settings.

  11. 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.

    1. If the event format is an EventBridge event, provide this value: $.detail
    2. 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}.
  12. Click Next and then Next.

  13. 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