# Webhooks: how best to differentiate a PM from a public post

**URL:** <https://meta.discourse.org/t/webhooks-how-best-to-differentiate-a-pm-from-a-public-post/76363>\
**Category:** Development\
**Tags:** webhooks\
**Created:** [2017 年 12 月 18 日午後 11:52 UTC](https://meta.discourse.org/t/webhooks-how-best-to-differentiate-a-pm-from-a-public-post/76363 "2017-12-18T23:52:31Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![johnaschroeder](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johnaschroeder/32/84460_2.png) [@johnaschroeder](https://meta.discourse.org/u/johnaschroeder)\
**Post date:** [2017 年 12 月 18 日午後 11:52 UTC](https://meta.discourse.org/t/webhooks-how-best-to-differentiate-a-pm-from-a-public-post/76363/1 "2017-12-18T23:52:31Z")

</div>

Hi All,

I’ve been scrutinizing the various JSON post results from our webhooks. We record and react to public posts that contribute to our common knowledge-base differently than PMs or discobot conversations. For example, it’s relatively easy to filter out posts from discobot using its userid; likewise with system posts and topics. However, I haven’t been able to identify a reliable way to filter posts back to discobot, or PMs between two users. At first I thought only PMs had a “reply\_to\_user” field, but it appears that some (but not all) posts have it also. Here is an example of what we are trying to filter out:

```plaintext
{
"post": {
    "id": 1296,
    "name": "Test User",
    "username": "testuser",
    "avatar_template": "/letter_avatar_proxy/v2/letter/c/stringhere/{size}.png",
    "created_at": "2017-12-14T21:11:30.992Z",
    "cooked": "\u003cp\u003e[quote=\"cutlery, post:11, topic:626\"]\u003cbr\u003eIf this is coffee, please bring me some tea; but if this is tea, please bring me some coffee\u003c/p\u003e",
    "post_number": 13,
    "post_type": 1,
    "updated_at": "2017-12-14T21:11:30.992Z",
    "reply_count": 0,
    "reply_to_post_number": 11,
    "quote_count": 1,
    "avg_time": null,
    "incoming_link_count": 0,
    "reads": 1,
    "score": 0,
    "yours": false,
    "topic_id": 626,
    "topic_slug": "robot-greetings",
    "topic_title": ":robot: Greetings!",
    "display_username": "Test User",
    "primary_group_name": null,
    "primary_group_flair_url": null,
    "primary_group_flair_bg_color": null,
    "primary_group_flair_color": null,
    "version": 1,
    "user_title": null,
    "reply_to_user": {
        "username": "testuser",
        "avatar_template": "/letter_avatar_proxy/v2/letter/c/stringhere/{size}.png"
    },
    "actions_summary": [{
        "id": 2,
        "can_act": true
    }, {
        "id": 3,
        "can_act": true
    }, {
        "id": 4,
        "can_act": true
    }, {
        "id": 5,
        "hidden": true,
        "can_act": true
    }, {
        "id": 6,
        "can_act": true
    }, {
        "id": 7,
        "can_act": true
    }, {
        "id": 8,
        "can_act": true
    }],
    "moderator": false,
    "admin": false,
    "staff": false,
    "user_id": 1234,
    "hidden": false,
    "hidden_reason_id": null,
    "trust_level": 0,
    "deleted_at": null,
    "user_deleted": false,
    "edit_reason": null,
    "can_view_edit_history": true,
    "wiki": false
}
}

```

---

_[View the full topic](https://meta.discourse.org/t/webhooks-how-best-to-differentiate-a-pm-from-a-public-post/76363)._
