Webhook help needed
c
V13.2.2 The docs state:- Json payload For example, the Content Published event will also send the given content that triggered the event. The json from is the same as the Content Delivery Api, an example of such a json object:
Copy code
{
  "Name": "Root",
  "CreateDate": "2023-12-11T12:02:38.9979314",
  "UpdateDate": "2023-12-11T12:02:38.9979314",
  "Route": {
    "Path": "/",
    "StartItem": {
      "Id": "c1922956-7855-4fa0-8f2c-7af149a92135",
      "Path": "root"
    }
  },
  "Id": "c1922956-7855-4fa0-8f2c-7af149a92135",
  "ContentType": "root",
  "Properties": {}
}
however, the Content deleted does not send the entire content as JSON, instead, it sends the Id of the content like so:
Copy code
{
  "Id": "c1922956-7855-4fa0-8f2c-7af149a92135"
}
A coworker working on the legacy system the webhooks are aimed at tells me that the Delete event doesn't seem to send anything when fired. I'm just wondering what are the two ID's shown in the first example. It's not clear. If anyone could clarify, I'd be grateful. Thanks.
s
Point the webhook at https://webhook.site/ and check for yourself!
So for delete the payload is indeed the Id of the document, plus the header explaining the event cause:
Umb-Webhook-Event: Umbraco.ContentDelete
(in other words: different types of events send different payloads from the
Content Published
event)
c
Thanks. Didn't realise that was there. I've sent it on, they can play and debug to their heart's content now 🙂
Colleague reports back that the Delete event doesn't fire until the content is deleted from the Recycle Bin. So, does deleting a published content item fire the Unpublished event?
Also is there a way to delete all the delivery notices?
j
Pretty sure it's always been that way, IIRC you can listen to a content moved event and then see if it moved to the recycle bin. It has a specific node id, off the top of my head its -20 or -21 (one is the media and the other the content recycle bin)
c
In that case, "Content Moved" might be a good webhook source to add.
k
there is a Trashed notification too. although the best thing to do is probably listen for the ContentSaved event and check the status of the content there is a 'Trashed' flag, so you can tell if something is in the bin.
c
I modified the output of a webhook previously, I wrote a blog post, this might help you too. https://codeshare.co.uk/blog/using-webhooks-in-umbraco-13-to-send-messages-to-slack/
54 Views