Subscribing to webhooks
Your app must respond to mandatory webhook topics. In addition, your app can register optional webhook topics.
Anchor to configConfiguring webhooks
To set up webhooks first we need to configure with 2 pieces:
- The webhooks you want to subscribe to. In this example we subscribe to the
topic.
- The code to register the
topic after a merchant installs you app. Here
provides an
hook.
You can't register mandatory topics using this package, you must configure those in the Partner Dashboard instead.
/app/shopify.server.ts
Anchor to endpointsSet up your endpoints
Legitimate webhook requests are always s signed by Shopify, so you must authenticate them before taking any action.
For each in your configuration, you must set up an
action
that uses the authenticate.webhook
function to authenticate the request.
Please keep in mind that webhook endpoints should respond as quickly as possible. If you need to run a long-running job, then consider using background tasks.
Webhook endpoints must respond with an code, or Shopify will retry.