Example Webhook Payload for New Orders

Does anyone have an example of the webhook payload for new orders from Umbraco Commerce?

Happy to add it to the docs (Webhooks | Umbraco Commerce) once we have an example.

TIA

Hey Tim,

The webhook body should just be the ID of the order that triggered the webhook event.

{
    "OrderId": "93cf5e77-587e-4468-a3db-95ecbfdc1584"
}

Hope this helps

Ah ok thanks Matt, I was hoping we could use it as a Zapier alert but would need details of the order e.g. OrderNumber, OrderTotal, CountOfItems, CustomerName etc. Is that on the roadmap or should we spin something up and contribute it back?

I guess this was by design to keep the webhooks lightweight. You could then use the Management API to fetch the full Order model if you need to process it.

We could look to expand the model with some minimum properties that could be useful for decision making / workflow purposes so I’d be open to suggestions for that. In the initial release we just kept the data to a minimum saying “this is the order that triggered the webhook”.

Thanks, I get keeping it light, but equally, there has to be enough info to use it on the receiving system :grin:

We use Zapier/n8n to notify Slack/Teams/other of new orders, which could make a call back to get the order details, but that would add the extra overhead of the web request :smiley:

Will have a look over what’s available and let you know what we come up with for your review :+1:

1 Like

Sure, and it’s a balancing act.

Webhooks are all “HERE’S A MODEL” where as the Umbraco Commerce Management API’s all support the fields config to control the exact data to return therefore keeping things lightweight, however yes, this does then incur an extra HTTP request so that’s probably a greater overhead.

Anywho, yea, and feedback is welcome :+1:

Possibly a stupid question but how did we enable the Management API? We’ve got the docs to enable the Storefront but the Management API doesn’t appear in Swagger even when that’s enabled?

We could use the Storefront API but that requires a store id (which would fall down if we’re hosting multiple sites)

Ahh, sorry. I never asked what version you were using. The Management API came with the new backoffice in v14. I forgot we introduced the Storefront API before this.

In that case, a custom API controller my be your only option.