I’m trying to establish a webhook so that my backend is notified of metafield updates associated with my orders.
To start I created a webhook with id 1032526397617, it looks like this:
{
"id": 1032526397617,
"address": "https://REDACTED/path",
"topic": "orders/updated",
"created_at": "2021-05-07T12:26:04-04:00",
"updated_at": "2021-05-07T12:26:04-04:00",
"format": "json",
"fields": [
"id",
"updated_at",
"order_number"
],
"metafield_namespaces": [
"global"
],
"api_version": "2021-04",
"private_metafield_namespaces": []
}
I do receive events on that endpoint when metafields in the “global” namespace are added/updated, but the payload does not include the metafields themselves.
Instead I just receive something like:
{
"id":3876848500913,
"order_number":1037,
"updated_at":"2021-05-07T12:36:53-04:00"
}
I find it interesting that the webhook does not even include an empty “metafields” array.
If I query the order directly, I see my metafields are indeed present and part of the “global” namespace:
curl ‘https://REDACTED.myshopify.com/admin/api/2021-04/orders/3876848500913/metafields.json’
{
"metafields": [
{
"id": 19278238417073,
"namespace": "global",
"key": "wallType",
"value": "0",
"value_type": "string",
"description": null,
"owner_id": 3876848500913,
"created_at": "2021-05-07T12:36:53-04:00",
"updated_at": "2021-05-07T12:36:53-04:00",
"owner_resource": "order",
"admin_graphql_api_id": "gid://shopify/Metafield/19278238417073"
},
/// ...
]
}
After reading and re-reading the documentation, I tried using a different metafield namespace on the off-chance that “global” is reserved, but I I still receive a payload without any metafields.