New user signup and PM is triggering a "topic" event


(Alex Weissman) #1

I’ve set up a webhook with only the Topic Event and Post Event options checked - in other words, I only want to receive data when a topic is created/updated/replied-to.

Unfortunately, it seems that new user registration is triggering a “topic” event, so that I receive a message from discobot whenever someone signs up. The relevant headers are:

X-Discourse-Instance: http://forums.userfrosting.com
X-Discourse-Event-Id: 27
X-Discourse-Event-Type: topic
X-Discourse-Event: topic_created

and the payload starts with:

{
  "topic": {
    "id": 30,
    "title": "🤖 Greetings!",
    "fancy_title": ":robot: Greetings!",
    "posts_count": 1,
    "created_at": "2017-07-15T04:29:01.550Z",
    "views": 0,
    "reply_count": 0,
    "participant_count": 1,
    "like_count": 0,
    "last_posted_at": "2017-07-15T04:29:01.641Z",
    "visible": true,
    "closed": false,
    "archived": false,
    "has_summary": false,
    "archetype": "private_message",
    "slug": "greetings",
    "category_id": null,
    "word_count": 110,
    "deleted_at": null,
    "pending_posts_count": 0,
    "user_id": -2,
    "pm_with_non_human_user": true,
    "draft": null,
    "draft_key": "topic_30",
    "draft_sequence": 0,
    "unpinned": null,
    "pinned_globally": false,
    "pinned": false,
    "pinned_at": null,
    "pinned_until": null,
    "details": {
      "created_by": {
        "id": -2,
        "username": "discobot",
        "avatar_template": "/user_avatar/forums.userfrosting.com/discobot/{size}/1_1.png"
      },
   ...

It appears that discobot sends a PM to the new user upon registration. However, I find it counterintuitive for a PM to be considered a “topic” event.


(Jeff Atwood) #2

It is a topic, so I would screen out private messages or use an API key that has no permissions to see PMs.


(Alex Weissman) #3

Yeah, this is probably what I will do for now. I do think that there should be a separate event category for PMs, though.

Anyway, thanks for the great software, Jeff!