Hi everyone,
I have a question regarding Shopify webhooks.
Can a single Shopify app register multiple webhook URLs for the same event (for example, orders/create)?
For example, can the same app have:
both subscribed to the orders/create event, so that Shopify sends the webhook payload to both URLs whenever an order is created?
If yes, are there any limitations or best practices I should be aware of?
Thanks!
Hello @Ajay_Rabari
As far as I have worked, No. You can not add multiple url to a single webhook.
You need to receive the payload in a single url and then you can broadcast them into your urls.
Thanks
Hey @Ajay_Rabari - thanks for reaching out and good question.
The short answer: yes, just not on a single subscription.
One subscription points at one URL, but you can create two subscriptions to the same topic, each with its own URL, and Shopify delivers to both. I did some testing to confirm - one product created, both endpoints fired, same X-Shopify-Event-Id with different X-Shopify-Webhook-Id values.
[[webhooks.subscriptions]]
topics = ["orders/create"]
uri = "https://example.com/webhook1"
name = "orders-create-a"
[[webhooks.subscriptions]]
topics = ["orders/create"]
uri = "https://example.com/webhook2"
name = "orders-create-b"
The name field just labels subscriptions on the same topic (echoed back in X-Shopify-Name). The same idea works through webhookSubscriptionCreate if you use the Admin API and graphQL.
If you only need the payload in two places, a single endpoint that re-broadcasts internally is an alternative option to having two subscriptions as well.
Hope this helps!
Thank you @Enumbin and @Wes-Dev-Shopify for your response.