Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
I've created a custom app in our Shopify store and use that API key to register a webhook for orders/create events in a third party application. The app has read_customers and read_orders permission for the Admin API.
The request to register the hook looks like this:
POST /admin/api/2022-07/webhooks.json
{
"webhook": {
"topic": "orders/create",
"address": "https://<DOMAIN>/api/webhooks/shopify",
"format": "json",
"fields": [
"id",
"created_at",
"updated_at",
"fulfillment_status",
"line_items",
"customer"
]
}
}
When listing webhooks via the API I can see that it has indeed been created:
GET /admin/api/2022-07/webhooks.json
{
"webhooks": [
{
"id": 1074798919795,
"address": "https://<DOMAIN>/api/webhooks/shopify",
"topic": "orders/create",
"created_at": "2022-09-12T12:23:03+02:00",
"updated_at": "2022-09-12T12:23:03+02:00",
"format": "json",
"fields": [
"id",
"created_at",
"updated_at",
"fulfillment_status",
"line_items",
"customer"
],
"metafield_namespaces": [],
"api_version": "2022-07",
"private_metafield_namespaces": []
}
]
}
But when I create an order I get no callback on that hook. If I instead register a webhook via the admin gui for the same topic it works! However, doing it that way is not viable for my clients needs.
Why is there a difference between creating a webhook though the admin gui and the API? Am I missing some permissions, and if so which ones? How do I troubleshoot this?