Post event webhook does not indicate post was deleted

I have a webhook handling post events, but if I delete a post, there is nothing that indicates deletion. I expected one of these fields to tell me it was deleted:

post {
           u'deleted_at': None,
           u'hidden': False,
           u'user_deleted': False,
           ...
}

@justindirose can you reproduce?

1 Like

Yeah - I can.

I just deleted one on a locked category on a site of mine. A webhook was generated, but it does not indicate the post was deleted in the payload, only the header.

Headers:

Request URL: xxxxxxx
Request method: POST
Accept: */*
Connection: close
Content-Length: 880
Content-Type: application/json
Host: hooks.zapier.com
User-Agent: Discourse/2.4.0.beta1
X-Discourse-Instance: xxxxxxx
X-Discourse-Event-Id: 6334
X-Discourse-Event-Type: post
X-Discourse-Event: post_destroyed

Payload:

{
  "post": {
    "id": 11702,
    "name": "Justin DiRose",
    "username": "justindirose",
    "avatar_template": "/user_avatar/xxxxxxxx/justindirose/{size}/1795_2.png",
    "created_at": "2019-06-28T18:50:55.078Z",
    "cooked": "<p>A new post here. Just for tests.</p>",
    "post_number": 2,
    "post_type": 1,
    "updated_at": "2019-06-28T18:50:55.078Z",
    "reply_count": 0,
    "reply_to_post_number": null,
    "quote_count": 0,
    "incoming_link_count": 0,
    "reads": 1,
    "score": 0,
    "topic_id": 5184,
    "topic_slug": "test-webhook-topic",
    "topic_title": "Test Webhook Topic",
    "display_username": "Justin DiRose",
    "primary_group_name": "",
    "version": 1,
    "user_title": "",
    "moderator": true,
    "admin": true,
    "staff": true,
    "user_id": xxx,
    "hidden": false,
    "trust_level": 4,
    "deleted_at": null,
    "user_deleted": false,
    "edit_reason": null,
    "wiki": false,
    "reviewable_id": null,
    "reviewable_score_count": 0,
    "reviewable_score_pending_count": 0,
    "topic_posts_count": 2
  }
}
4 Likes

I think that is working as designed, the webhook sends a snapshot of object right before it happens as the action can be destructive and sends the reason of the webhook in the header.

5 Likes