How to get the customer details in 'Entitlement-Updated' message which is received in SQS queue through AWS marketplace.


I have prepared a SQS queue using the SNS topic for Entitlement Notification for SaaS Contract Integration. Now in the AWS document, it is mentioned that we will receive only Entitlement-Updated message in the queue for any subscription changes by the customer. Basically, as per the document, we need to call the GetEntitlements after that in order to receive the updated entitlements. How do we know for which customer I need to call the GetEntitlement as I only have the Entitlement-Updated message in the queue. Can anybody please provide a sample Entitlement-Updated message which gets received into the SQS?

1 Answer
Accepted Answer

When your buyers on Amazon marketplace creates a new contract, upgrade it, renew it, or if the contract expires a notification will be published to the "aws-mp-entitlement-notification" SNS topic. The notification sent to this topic will have the following three key piece of information:

    "action": "<action-name>",
    "customer-identifier": " X01EXAMPLEX",
    "product-code": "n0123EXAMPLEXXXXXXXXXXXX",

Even though the "action" attribute key will always have the value "entitlement-updated", the buyer/customer identity will be provided using the attribute key "customer-identifier".

When the aws-mp-entitlement-notification SNS topic forwards this message to your SQS queue, the message would look similar to the following:

  "Type" : "Notification",
  "MessageId" : "63a3f6b6-d533-4a47-aef9-fcf5cf758c76",
  "TopicArn" : "arn:aws:sns:us-west-2:123456789012:MyTopic",
  "Message" : "{\n    \"action\": \"<action-name>\",\n    \"customer-identifier\": \" X01EXAMPLEX\",\n    \"product-code\": \"n0123EXAMPLEXXXXXXXXXXXX\",\n}",
  "Timestamp" : "2012-03-29T05:12:16.901Z",
  "SignatureVersion" : "1",
  "Signature" : "EXAMPLEnTrFPa3...",
  "SigningCertURL" : "",
  "UnsubscribeURL" : ""

The details on "customer-identifier" and "product-code" will be part of the "Message" attribute key on the SQS queue message as mentioned above.

"Message" : "{\n    \"action\": \"<action-name>\",\n    \"customer-identifier\": \" X01EXAMPLEX\",\n    \"product-code\": \"n0123EXAMPLEXXXXXXXXXXXX\",\n}",

You can then make the "GetEntitlements" API call and make use of the "customer-identifier" and "product-code" from the SQS message.

While making the GetEntitlements, you will have to pass the "product-code" from SQS message as the "ProductCode" request parameter. You will then have to use the "Filter" request parameter and pass customer identifier you obtained from SQS message as a value to the CUSTOMER_IDENTIFIER filter key.

This API call will return the entitlements specific to the customer identified by the customer-identifier and the product code identified by product-code in the SQS message.

For example, with python programming language using boto3 SDK you have make the "get_entitlements" function call:

response = client.get_entitlements(
        'CustomerIdentifier': [

answered 2 years ago
  • Thank you so much for this detailed answer. I was stuck over here. Now I will be able to continue from here. Thanks again for your help!

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions