Manage Shopify webhooks using our new Amazon EventBridge integration

TyW
Community Manager
451 63 1207

We’re proud to introduce a new integration which will help you easily manage large volumes of webhooks by integrating your app with Amazon EventBridge. EventBridge is a serverless, event-driven alternative to receiving webhooks via HTTP. If your app is hosted on AWS you can use EventBridge to handle significant scale while reducing your infrastructure cost and complexity.

 

Checkout the tutorial in our developer documentation to learn how to set up an event source and manage your app’s webhooks with EventBridge.

 

Questions about EventBridge?

Post them in this thread to discuss your integrations with other developers and Shopify staff.

TyW | Online Community Manager @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Replies 26 (26)

pawanthalia
Shopify Partner
13 0 0

Followed Step 1 and 2 from tutorial, everything worked smoothly .
But when trying to follow step 3 for creating rule 

i'm not able to find  Shopify in Service name drop-down.
check screenshot attached 
provider.png

 

 

TyW
Community Manager
451 63 1207

Thanks! I’ve notified the team and will update when I know more.

 

In the meantime, there are two other options you can use.

 

Under ‘Event matching pattern’, choose ‘Pre-defined pattern by service’ and then select ‘All Events’ from the ‘Service provider’ drop-down. This will allow all events sent to that event source to trigger your rule.

 

Alternatively, under ‘Event matching pattern’, choose ‘Custom pattern’. Then define the pattern that you would like the rule to filter on in the text area on the right and click Save. Here’s an example event pattern for filtering based on a specific webhook topic:

 

{
  "detail-type": [
    "shopifyWebhook"
  ],
  "detail": {
    "metadata": {
      "X-Shopify-Topic": [
        "products/update"
      ]
    }
  }
}

TyW | Online Community Manager @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Mets
Shopify Partner
12 0 4

There seems to be a BUG...?

 

Went pretty far with the setup, but...

 

Shopify is displaying an error when subscribing to the webhook via the API with an "ARN" address.

 

I've completed the setup, have used the "unstable" API version as specified in the tutorial ( https://shopify.dev/tutorials/manage-webhook-events-with-eventbridge#4-create-webhook-subscriptions-... ).

Tried both APIs, the REST & GraphQL and get the same error on both.

 

Error: "Address is not a valid AWS ARN"

 

Any ideas?

TyW
Community Manager
451 63 1207

Hi @Mets

 

Are you able to share the ARN (address) tha you are trying to subscribe to the webhook with so the team can review? Feel free to send it to as a private message

Thanks!

TyW | Online Community Manager @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

NTT
Tourist
4 0 3

I got an error, this is my ARN arn:aws:events:us-east-2::event-source/aws.partner/shopify.com/3929673/product-label-pro-dev.

I used koa-shopify-webhook to register webhook, but this library didn't support ARN. I tried to edit the shopify-koa-webhook to accept ARN. This is error message:

Failed to register webhook for PRODUCTS_CREATE {
  data: {
    eventBridgeWebhookSubscriptionCreate: { userErrors: [], webhookSubscription: [Object] }
  },
  extensions: {
    cost: {
      requestedQueryCost: 10,
      actualQueryCost: 10,
      throttleStatus: [Object]
    }
  }
}

Please help, I don't want to use a REST service from API gateway directly!

 

 

NTT
Tourist
4 0 3

If I use shopify admin to register webhook, the same error happens.

image.png

Mathieu2
Tourist
4 0 1

I get the same kind of error when trying to register a webhook.

{
    "errors": {
        "address": [
            "is invalid",
            "is an AWS ARN and includes api_client_id '3985939' instead of '3986211'"
        ]
    }
}
AAAecommerce
Visitor
3 0 0

I am also having the same issue.

Did anyone found the solution for it?

Any update from Shopify Team?

Call:

curl -X POST \
  https://xxxxxxxxx.myshopify.com/admin/api/2020-07/webhooks.json \
  -H 'authorization: Basic xxxxxxxxxxxx=' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'postman-token: 9b6249b5-9296-3dbb-d724-1225bd051dd0' \
  -d '{
"webhook": {
    "topic": "customers/create",
    "address": "arn:aws:events:us-east-1:xxxxxxxxxx:event-bus/store-webhooks-but",
    "format": "json"
  }
}'

 

Response:

{
    "errors": {
        "address": [
            "is invalid",
            "is not a valid AWS ARN"
        ]
    }
}

 

Mathieu2
Tourist
4 0 1

In my case it looks like there is a problem when Shopify register the event partner source in Event Bridge and dosent put valid information.

linahovanessian
Visitor
1 0 0

Did you find any workaround for this from admin panel? (not api level...) I checked the response error code is 422 . The problem is with the arn:aws:events:<region>::  ...

linking a webhook to aws eventbridgelinking a webhook to aws eventbridge

daaru
Visitor
1 0 9

Hi all,

I think I understand the problem: the partner event bus ARN should not be copied from AWS Console at "Amazon EventBridge > Events > Event buses" (with format like arn:aws:events:eu-west-1:00000000:event-bus/aws.partner/shopify.com/12345678/my-app), this is the mapped event bus to create rules on. When you try to register a webhook with that ARN the Sopify API respond with "422 - address: is not a valid AWS ARN".

The correct ARN need to be copied from "Amazon EventBridge > Events > Partner event sources", with format like "arn:aws:events:eu-west-1::event-source/aws.partner/shopify.com/12345678/eataly-shopify-bundle" the is the EventSource ARN and not the EventBus ARN.

Here an example of REST API payload:

{
  "webhook": {
    "topic": "products/update",
    "address": "arn:aws:events:eu-west-1::event-source/aws.partner/shopify.com/12345678/eataly-shopify-bundle",
    "format": "json"
  }
}

 

AnikMazumder
Visitor
1 0 1

yes I followed this instructions but still i am getting error 

pubokia
Visitor
2 0 0

bumping this, facing the same issue

darcybrown
Visitor
2 1 7

Oh wow, this helped! The Partner Event Source Arn and NOT your Event Bus Arn... Thanks for saving me lots of wheel spinning....

Jamal_Ali
Shopify Partner
2 0 0

Thanks Daaru you superstar! This solved it for me.

iozyigit
Shopify Partner
28 2 2

thanks @daaru , that arn was accepted. 

"arn:aws:events:us-west-1::event-source/aws.partner/shopify.com/....."
https://www.linkedin.com/in/ismailozyigit/
Gopal7417
Shopify Partner
2 0 0

same for me as well

Gopal7417
Shopify Partner
2 0 0

I converted the Event bus pattern to partner souce pattern and used the partner souce pattern as ARN
Event bus pattern: arn:aws:events:ap-northeast-1:393169321359:event-bus/aws.partner/shopify.com/14645592065/Shopify

partner souce pattern: arn:aws:events:ap-northeast-1::event-source/aws.partner/shopify.com/14645592065/Shopify

gcalixto
Visitor
1 0 2

hello help i get this error when registering the webhook

{
"webhook": {
    "topic""products/update",
    "address""arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/4051183/awesome-app-webhooks",
    "format""json"
  }
}

 

Response:

{
    "errors": {
        "address": [
            "is invalid",
            "is an AWS ARN and includes api_client_id '4051183' instead of '4051275'"
        ]
    }
}
bestrada
Tourist
12 2 1

Subscribing to this topic. I have the same issue when `POST`ing this to the REST endpoint (I am using REST instead of graphql because of this issue😞

 

{
  "webhook": {
    "topic": "checkouts/create",
    "address": "arn:aws:events:us-east-1:246797399506:rule/aws.partner/shopify.com/1891866/merchrock-stats/CHECKOUTS_CREATE",
    "format": "json"
  }
}

 

and the error response:

{
  "errors": {
    "address": [
      "is invalid",
      "is not a valid AWS ARN"
    ]
  }
}

 

Mariano081
Visitor
1 0 1

The same problem haunts my project. Is it Shopify integration bug, or the docs miss necessary information?

sebizox
Shopify Partner
5 0 3

I'm getting the following error after copy/pasting from the tutorial:

 

mutation {
  eventBridgeWebhookSubscriptionCreate(
    topic: PRODUCTS_CREATE
    webhookSubscription: {
      arn: "arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/...."
      format: JSON

  })
  {
    webhookSubscription {
      id
    }
    userErrors {
      message
    }
  }
}

I get the following response:

{
  "data": {
    "eventBridgeWebhookSubscriptionCreate": {
      "webhookSubscription": null,
      "userErrors": [
        {
          "message": "You cannot create a webhook subscription with the specified topic"
        }
      ]
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 10,
      "actualQueryCost": 10,
      "throttleStatus": {
        "maximumAvailable": 2000,
        "currentlyAvailable": 1990,
        "restoreRate": 100
      }
    }
  }
}
AntoineAndrieu
Tourist
3 0 0

I had the same bug and fixed it by using the workaround described here : https://community.shopify.com/c/Shopify-APIs-SDKs/AWS-EventBridge-set-up/m-p/816093

r0badams
Visitor
2 0 0

Was having the same issue.  Took me a bit to realize that I was using the admin token from a different app to register the webhook.  I switched to the admin token from the correct app and the webhook subscription post worked.

vladyslav22
Shopify Partner
3 0 0

Hi.

I have a question about Event Source. I've tried to add Event Source in the Shopify Admin area with my AWS info. Event Source was created in the Shopify application, but it doesn't appear in the AWS console. What do I need to check to make it available in the AWS?

Thanks.

Sergiy_Cherevko
Shopify Partner
13 0 2

Hi,

I followed this video tutorial, and it worked for me fine.

However, I am stuck after that, since I am not sure how to connect back to the Shopify backend and then update things, based on the webhooks payload.