---
schema_version: "1"
id: 4f249979807c204c571b9695edd5fa692bd83d4eae46223f5d9aee8600738c26
title: Create an EventBridge Rule and Connect it to the API Destination
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/ev_relay_create_eb_rule.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.ev_relay_create_eb_rule.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: a80e6f4b559e6f5f65e31bdaa8dd0738c3431ba604ea4ca0d1bc5cb37b88d589
description: 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.
products:
  - Salesforce Platform
  - Security
release: "264"
---
# 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](https://help.salesforce.com/s/articleView?id=platform.ev_relay_create_api_destination.htm&release=264.0.0&type=5 "Create an API destination that uses a new connection. In this case, the API destination is a REST API call to Salesforce to publish a platform event back. The connection contains the authentication information for the API call. The connection accepts several authorization methods.").

For more information about EventBridge rules, see [Creating Amazon EventBridge rules that react to events](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-create-rule.html) in the AWS documentation.

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"`.
    
    ```
    {
      "source": [{
        "anything-but": ["dontSend"]
      }]
    }
    ```
    
    For more information about event pattern matching, see [Content filtering in Amazon EventBridge event patterns](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns-content-based-filtering.html) in the AWS documentation.
7. Click **Next**.
8. In Select targets, under Target 1, select **EventBridge API destination**.
9. From the dropdown, select the API destination that you just created.
10. Expand **Additional settings**.
11. Select **Part of the matched event**, and provide the part of the event message to pass to the 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**.

![Tip](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-extend_click-264-0-0-production-enus/5f7d9219-b7b1-4552-8891-f1aba9b289fc/images/icon_tip.png)

Tip 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](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-rule-dlq.html) and [Receiving and deleting messages (console)](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-using-receive-delete-message.html) in the AWS documentation.