You are here:
Create an API Destination and Connection in EventBridge
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.
Prerequisites:
To use OAuth authorization for the API destination connection, create a connected app in Salesforce by following the steps in Create a Connected App in Salesforce for OAuth. You use the consumer key and secret from the connected app for the API destination connection.
- To create an API destination in the EventBridge console, follow the steps in Create an API destination in the AWS documentation. Then set up the configurations that are specific to Salesforce.
- Get your Salesforce org’s My Domain name, which is on the My Domain page in Setup. You use the name in the endpoint in the next step.
-
For the event that you want to send to Salesforce, use an existing custom platform
event or define a new one. For example, you can create a platform event with the label
Carbon Estimate (API name
Carbon_Estimate__e). To learn how to add fields to a platform event, see (Optional) Define a Platform Event. Add the same fields as the ones in the Carbon Comparison event. Also, add this field.Field type: Number (3,0), Label: Carbon Reduction Percentage -
For API destination endpoint, use this URL after replacing
MyDomainName with your org’s domain name and
MyEvent__e with the API name of the platform event to return:
https://MyDomainName.my.salesforce.com/services/data/v58.0/sobjects/MyEvent__eFor example, for the Carbon Estimate event, the URL is:https://MyDomainName.my.salesforce.com/services/data/v58.0/sobjects/Carbon_Estimate__e - For HTTP method, select POST.
- For the connection, select Create a new connection, and enter a connection name.
-
For Destination type, select Partners, and then select
Salesforce from Partner Destinations.
If you’re setting up OAuth authorization, provide this information for your Salesforce org.
- For Authorization type, make sure that OAuth Client Credentials is selected.
-
For Authorization endpoint, replace the populated endpoint with one of these
options.
-
If using a production org, enter this URL, and replace
MyDomainName with your org’s My Domain name:
https://MyDomainName.my.salesforce.com/services/oauth2/token -
If using a sandbox without enhanced domains, enter this URL, and replace
MyDomainName with your org’s My Domain name and
SandboxName with your sandbox name:
https://MyDomainName--SandboxName.my.salesforce.com/services/oauth2/token -
If using a sandbox with enhanced domains, enter this URL, and replace
MyDomainName with your org’s My Domain name and
SandboxName with your sandbox name:
https://MyDomainName--SandboxName.sandbox.my.salesforce.com/services/oauth2/token
-
If using a production org, enter this URL, and replace
MyDomainName with your org’s My Domain name:
- For HTTP method, select POST.
- For Client ID, enter the consumer key from the connected app in Salesforce.
- For Client secret, enter the consumer secret from the connected app in Salesforce.
-
Add OAuth HTTP parameters.
- Parameter: Body field, Key: grant_type, Value: client_credentials
After you create the API destination, you can create a rule whose target is the destination. See Create an EventBridge Rule and Connect it to the API Destination.

