Set up notifications (Amazon EventBridge workflow)
Learn how to set up your system to receive notifications using the Amazon EventBridge workflow.
Learn how to set up your system to receive the following notifications using the Amazon EventBridge workflow:
-
BRANDED_ITEM_CONTENT_CHANGE
: Sent when there is a change to the title, description, bullet points, or images for any ASIN that the selling partner has a brand relationship with. -
ITEM_PRODUCT_TYPE_CHANGE
: Sent when there is a change to the product type name of any ASIN that the selling partner has a brand relationship with. -
LISTINGS_ITEM_STATUS_CHANGE
: Sent when there is a listing status change including buyable transition, listing create, or listing delete for any SKU that the selling partner has. -
LISTINGS_ITEM_ISSUES_CHANGE
: Sent when there is an issues change for any SKU that the selling partner has. -
LISTINGS_ITEM_MFN_QUANTITY_CHANGE
: Sent when there is change in the available quantity of a listings item. -
PRODUCT_TYPE_DEFINITIONS_CHANGE
: Sent when there is a new Product Type or Product Type Version.
If you want to receive any other notification type, skip this tutorial and refer to Set up notifications (Amazon Simple Queue Service workflow).
Prerequisites
To complete this tutorial you need:
-
Authorization from the selling partners (sellers or vendors) for whom you are making calls. Refer to Authorizing Selling Partner API applications for more information.
-
An AWS account. This AWS account will be responsible for charges related to receiving notifications. If you are not already an AWS customer, you can create a free AWS account. For more information, refer to AWS Free Tier.
-
A target resource to receive notification events from your Amazon EventBridge bus. For more information, refer to What Is Amazon EventBridge?
-
A basic understanding of Amazon EventBridge. For more information, refer to Amazon EventBridge.
Step 1. Create a destination
- Call the
createDestination
operation to create an Amazon EventBridge destination.
Note
You can only create one EventBridge destination per AWS account.
Parameter | Description | Required |
---|---|---|
resourceSpecification |
The information required to create a destination resource. In this workflow, include the eventBridge specification.
Type: |
Yes |
name |
A developer-defined name to help identify this destination.
Type: string |
Yes |
Note
Calling the
createDestination
operation does not require authorization from any selling partner. In this respect, this operation is a "grantless" operation and has a different authorization model from most other Selling Partner API operations. For more information, refer to Grantless operations.
- Save the following values:
-
resource:eventBridge:name
: Use this value in Step 2. Configure Amazon EventBridge to handle notifications. -
destinationId
: Pass in this value in Step 4. Create a subscription.
Step 2. Configure Amazon EventBridge to handle notifications
Associate an event bus with your partner event source. For definitions, refer to Terminology.
-
Go to Amazon EventBridge and sign in to the AWS Console using the AWS Account ID that you specified when you called the
createDestination
operation in Step 1. Create a destination. -
In the console, ensure that the AWS Region that you specified when you called the
createDestination
operation is selected. -
In the navigation pane, choose Partner event sources.
-
In the Partner event sources area, under Name, select the partner event source that matches the
resource:eventBridge:name
value returned in Step 1. Create a destination. The partner event source is in this format:aws.partner/sellingpartnerapi.amazon.com/{AWS Account Id}/{Application Id}
. -
On the new page that appears, choose Associate with event bus.
-
On the Associate with event bus page, leave the checkboxes empty and choose Associate.
You have created a partner event bus and associated it with your partner event source. Go to Step 3. Create a rule that starts on a notification event.
Step 3. Create a rule that starts on a notification event
Create a rule that watches for specific notification events and routes them to the target resource of your choice.
-
Go to Amazon EventBridge. If you are not already signed in to the AWS Console, sign in using the AWS Account ID that you specified when you called the
createDestination
operation in Step 1. Create a destination. -
In the Console, ensure that the AWS Region that you specified when you called the
createDestination
operation is selected. -
In the navigation pane, choose Rules.
-
Choose Create rule.
-
Enter a name and optional description for the rule.
-
For Event bus, select the bus that you associated with the partner event source.
-
Choose Next.
-
For Event source, select AWS events or EventBridge partner events.
-
For Creation method, select Use pattern form.
-
In Event pattern:
- Choose Event source, select EventBridge partners.
- For the Partner dropdown, select Amazon Selling Partner APIs.
- For the Event type dropdown, select All Events.
The event pattern that displays should be similar to the following, which indicates that you will receive all events emitted by
sellingpartnerapi.amazon.com
:{ "source": [ { "prefix": "aws.partner/sellingpartnerapi.amazon.com" } ] }
-
(Optional) Edit the event pattern to include rules that match only the notification events that you want. The following event pattern contains a rule that matches only
BRANDED_ITEM_CONTENT_CHANGE
events fromsellingpartnerapi.amazon.com
:{ "source": [ { "prefix": "aws.partner/sellingpartnerapi.amazon.com" } ], "detail-type": ["BRANDED_ITEM_CONTENT_CHANGE"] }
For information about creating more complex rules, refer to Event Patterns in the Amazon EventBridge Developer Guide.
-
Choose Next.
-
Now select the AWS service that is to act when an event of the selected type is detected. Enter other information specific to this target type, if required.
Note
For many target types, EventBridge needs permissions to send events to the target. In these cases, you can create a new IAM role or you can use an existing IAM role. Do one of the following:
- To create an IAM role, select Create a new role for this specific resource.
- To use an IAM role that you have already created, select Use existing role.
Note
To verify that events are coming through your EventBridge, you can use an SQS queue as a target for the rule you created, and then poll that SQS queue as notifications arrive.
-
(Optional) Choose Add another target to add another target for this rule if you need more than one.
-
Choose Next.
-
(Optional) Enter one or more tags for the rule. For more information, refer to Tagging Your Amazon EventBridge Resources in the AWS documentation.
-
Choose Next.
-
Choose Create rule.
Troubleshooting:
-
If you create a rule with an encrypted Amazon SQS queue as a target, you must include a decrypt action in your AWS Key Management Service key policy for the event to be successfully delivered to the encrypted queue. For more information, refer to My events are not delivered to the target Amazon SQS queue in the AWS documentation.
-
For more troubleshooting information, refer to Troubleshooting Amazon EventBridge in the Amazon EventBridge Developer Guide.
Step 4. Create a subscription
Subscribe to a notification type, to be delivered to the destination that you created in Step 1. Create a destination.
Note: We allow multiple subscriptions with different payload versions per application, notification type, and party (seller/vendor). For supported payload versions of different notification type, refer to notificationType
.
- Call the
createSubscription
operation, passing the following parameters:
Path parameters:
Parameter | Description | Required |
---|---|---|
notificationType |
Information about the notification type and payload version to which you want to subscribe.
Possible values: Type: string |
Yes |
Body parameters:
Parameter | Description | Required |
---|---|---|
payloadVersion |
The version of the payload object to be used in the notification. For supported payloadVersion for different notification types, refer to notificationType .
Type: string |
Yes |
destinationId |
The identifier for the destination where notifications will be delivered. Use the destinationId value that you saved in Step 1. Create a destination.
Type: string |
Yes |
You are now subscribed to receive BRANDED_ITEM_CONTENT_CHANGE
notifications.
Updated 2 days ago