From 979435e5c15d27a20283f53629020fcbc4f8c98c Mon Sep 17 00:00:00 2001 From: Tal Brenev Date: Thu, 13 May 2021 14:59:14 -0400 Subject: [PATCH] Add documentation for how to register eventbridge and pubsub webhooks --- docs/usage/webhooks.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/usage/webhooks.md b/docs/usage/webhooks.md index 949325e1f..049745569 100644 --- a/docs/usage/webhooks.md +++ b/docs/usage/webhooks.md @@ -74,6 +74,20 @@ app.get('/auth/callback', async (req, res) => { ``` +### EventBridge and PubSub Webhooks + +You can also register webhooks for delivery to Amazon EventBridge or Google Cloud +Pub/Sub. In this case the `path` argument to +`Shopify.Webhooks.Registry.register` needs to be of a specific form. + +For EventBridge, the `path` must be the [ARN of the partner event +source](https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_EventSource.html). + +For Pub/Sub, the `path` must be of the form +`pubsub://[PROJECT-ID]:[PUB-SUB-TOPIC-ID]`. For example, if you created a topic +with id `red` in the project `blue`, then the value of `path` would be +`pubsub://red:blue`. + ## Process a Webhook To process a webhook, you need to listen on the route(s) you provided during the Webhook registration process, then call the appropriate handler. The library provides a convenient `process` method that acts as a middleware to handle webhooks. It takes care of calling the correct handler for the registered Webhook topics.