Setting up webhooks


#21

As per a couple of posts above is there anyway to extract the user email address on user event create/update? As I dont see it on the user payload.


(Erlend Sogge Heggen) #22

A post was split to a new topic: Trying to set up SSO


#23

I’ve been playing with this and I am getting nowhere. Need some help here :slight_smile:

I am trying to deliver new forum posts into a Discord chat channel. The webhook is triggered, but it fails with this error in the response:

{"code": 50006, "message": "Cannot send an empty message"} 

So it looks like for some reason Discourse is sending an empty message to Discord.

Any clues?

Thanks


(Daniela) #24

You can try cloning this repo from critcola


(Allen Huang) #25

Is the notification web hook plugin available now? I can not find it on Github.


(Erick Guan) #26

This sample plugin enables the notification web hook. GitHub - fantasticfears/discourse-webhooks-example


(Pad Pors) #27

Hi,

is there any way to make a webhook that notifies when a new user is created?

it should be possible using “user event”, but this item notifies for every user and not just the new ones. any idea how to limit it for new sign ups?

p.s.: I also tried new user event webhook limited to “TL0” group, but it doesn’t notify anything.


(Allen - Watchman Monitoring) #28

I don’t see how to limit the webhook to just “new user” but the headers have the webhook reason:

X-Discourse-Event-Id: 414
X-Discourse-Event-Type: user
X-Discourse-Event: user_created

Unfortunately, the last time I asked, some services like Zapier can’t filter on the header data.

You might be able to act on last_seen_at, or other keys which would only be empty on their first visit:

  "last_seen_at": null,
  "time_read": 0,
  "stats": [],

Or check out @fantasticfears plugin, see if it works for you:


(Nitin Sapre) #29

Hey Erick, does this plugin still work? I’ve installed it and enabled the notification events for my web hook. Although users are receiving notifications, I don’t see any events being triggered for the web hook. Please help me figure this out. Thanks!


(Tranquyet) #30

Hi @fantasticfears,
How can i get user email include in POST payload ? Is there any config to allow include user email ?
Thanks.

{
  "post": {
    "id": 19,
    "name": "user",
    "username": "user",
    "avatar_template": "/letter_avatar_proxy/v2/letter/u/c0e974/{size}.png",
    "created_at": "2018-07-20T06:24:33.205Z",
    "cooked": "<p>Cool, now i have you, haha</p>",
    "post_number": 6,
    "post_type": 1,
    "updated_at": "2018-07-20T06:24:33.205Z",
    "reply_count": 0,
    "reply_to_post_number": null,
    "quote_count": 0,
    "avg_time": null,
    "incoming_link_count": 0,
    "reads": 0,
    "score": 0,
    "topic_id": 11,
    "topic_slug": "this-is-new-topic",
    "topic_title": "This is new topic",
    "display_username": "user",
    "primary_group_name": null,
    "version": 1,
    "user_title": null,
    "moderator": false,
    "admin": true,
    "staff": true,
    "user_id": 1,
    "hidden": false,
    "trust_level": 1,
    "deleted_at": null,
    "user_deleted": false,
    "edit_reason": null,
    "wiki": false,
    "topic_posts_count": 6
  }
}

(Vinoth Kannan) #31

The post payload will never include the email address. If you want then you can add it in a custom plugin code using add_to_serializer(:web_hook_post, ....) method.