# Webhooks feedback

**URL:** https://meta.discourse.org/t/webhooks-feedback/49046
**Category:** Development
**Created:** [August 23, 2016, 5:37am UTC](https://meta.discourse.org/t/webhooks-feedback/49046 "2016-08-23T05:37:11Z")
**Posts on this page:** 15
**Page:** 2

<div class="post-metadata">

### Author: ![Bala\_V](https://avatars.discourse-cdn.com/v4/letter/b/a88e4f/32.png) [@Bala\_V](https://meta.discourse.org/u/Bala_V)
#### Post date: [September 23, 2016, 11:37am UTC](https://meta.discourse.org/t/webhooks-feedback/49046/21 "2016-09-23T11:37:52Z")

</div>

> [@Falco](#):
>
> But are you sending this hook to 50k endpoints? Or to another system that parses and then send the notifications? Couldn’t this system filter the fields?

I am not sending this to 50K endpoints. Another system will parse and send the notifications. I would prefer not to deal with large payloads (unless you are in a very closed and tightly coupled environment). But if you are talking about a scale of 1M users, it is just not efficient. So some option to filter would make it really efficient & work for all use cases.

---

<div class="post-metadata">

### Author: ![Semaphorism](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/semaphorism/32/61600_2.png) [@Semaphorism](https://meta.discourse.org/u/Semaphorism)
#### Post date: [October 2, 2016, 4:21am UTC](https://meta.discourse.org/t/webhooks-feedback/49046/22 "2016-10-02T04:21:18Z")

</div>

There doesn’t seem to be a way to differentiate between what website is sending the webhook, is it possible to add a domain in the discourse config to the request headers, something like `x-discourse-domain`? or maybe something unique to each instance of discourse?

Use case:  
I have a Discord bot that is going to post to when someone creates a topic or reply, and notifies certain discord servers. I am currently running 2 discourse instances on my server, and they both have webhooks to the same API on the bot, but there appears to be no difference in request headers.

---

<div class="post-metadata">

### Author: ![DanielMarquard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danielmarquard/32/74010_2.png) [@DanielMarquard](https://meta.discourse.org/u/DanielMarquard)
#### Post date: [October 4, 2016, 6:59am UTC](https://meta.discourse.org/t/webhooks-feedback/49046/23 "2016-10-04T06:59:36Z")

</div>

I love the webhooks feature! I have some critique to offer, though.

First, it seems like the permalink/URL would be central to the post/topic events, but this is not included in the payload. It’s not a big deal since I was able to build the URL myself from the properties provided, but it seems logical that this should be added for topics and posts in the post stream.

Second, it looks like only the cooked posts are delivered. Receiving the raw posts could be useful, too, if that’s possible, especially when used in an application that doesn’t parse HTML.

While I appreciate the copious number of properties sent from topic and post webhooks, some of the data seems irrelevant, like `can_act`, `can_edit`, and `unseen`, among others. Not an issue at all, but some fields may be unnecessary.

---

<div class="post-metadata">

### Author: ![burke](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/burke/32/4211_2.png) [@burke](https://meta.discourse.org/u/burke)
#### Post date: [October 12, 2016, 1:28pm UTC](https://meta.discourse.org/t/webhooks-feedback/49046/24 "2016-10-12T13:28:10Z")

</div>

Webhooks is a great addition to Discourse! I’d like to `+1` @r3trosteve’s earlier comment:

> [@Webhook for Discourse events](https://meta.discourse.org/t/webhook-for-discourse-events/39808/8):
>
> I’d like to add: Badge Awarded

**Triggering webhooks on a “Badge Event” would be incredibly useful.** We could use these to toggle on permissions in external applications when badges are earned in Discourse (e.g., you can edit our wiki once you’ve earned trust level 2 in our forum).

* * *

_Extra credit: reduce unnecessary traffic by allowing badge events to be scoped to specific badge(s)_

---

<div class="post-metadata">

### Author: ![mr8](https://avatars.discourse-cdn.com/v4/letter/m/f9ae1b/32.png) [@mr8](https://meta.discourse.org/u/mr8)
#### Post date: [October 13, 2016, 7:04pm UTC](https://meta.discourse.org/t/webhooks-feedback/49046/25 "2016-10-13T19:04:31Z")

</div>

First of all, just want to say thanks! This looks really fantastic!

I was playing around with it earlier today and noticed a couple of things:

1. **Post Event** doesn’t work on edits.  
The description on the webhooks page says “When there is a new reply, **edit** , deleted or recovered.” but I can’t get it to work with edits for some reason…

2. Payload format?  
The [Setting up webhooks](https://meta.discourse.org/t/setting-up-webhooks/49045) howto makes it looks as if the a Post event will trigger a payload with just the relevant post, however I seem to be getting the whole topic and post\_stream in my payloads. Is this expected or am I doing something wrong?

---

<div class="post-metadata">

### Author: ![burke](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/burke/32/4211_2.png) [@burke](https://meta.discourse.org/u/burke)
#### Post date: [October 27, 2016, 8:57pm UTC](https://meta.discourse.org/t/webhooks-feedback/49046/26 "2016-10-27T20:57:52Z")

</div>

@fantasticfears, do you think adding [Badge Event](https://meta.discourse.org/t/webhooks-feedback/49046/24) to webhooks would be hard? Would it take a lot more than adding support for `user_badge_granted` and `user_badge_removed` events to [web\_hooks.rb](https://github.com/discourse/discourse/blob/master/app/models/web_hook.rb)?

This feature would be a game-changer for the [OpenMRS](http://openmrs.org) community. 😄

(the [Camel’s nose](https://en.wikipedia.org/wiki/Camel%27s_nose) … “you give 'em an inch and they want a mile”)

---

<div class="post-metadata">

### Author: ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)
#### Post date: [November 4, 2016, 7:26pm UTC](https://meta.discourse.org/t/webhooks-feedback/49046/27 "2016-11-04T19:26:39Z")

</div>

> [@Semaphorism](#):
>
> There doesn’t seem to be a way to differentiate between what website is sending the webhook, is it possible to add a domain in the discourse config to the request headers, something like x-discourse-domain? or maybe something unique to each instance of discourse?

Added per [Merge pull request #4535 from fantasticfears/webhooks-url · discourse/discourse@3daba93 · GitHub](https://github.com/discourse/discourse/commit/3daba9351a14d6d74dde4bfc3db6334046f65429). You can try `X-Discourse-Instance`. The value is your Discourse instance url including domain. If you uses subfolder feature, it would also include the subfolder name.

---

<div class="post-metadata">

### Author: ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)
#### Post date: [November 4, 2016, 8:31pm UTC](https://meta.discourse.org/t/webhooks-feedback/49046/28 "2016-11-04T20:31:04Z")

</div>

> [@mr8](#):
>
> Post Event doesn’t work on edits.  
> The description on the webhooks page says “When there is a new reply, edit, deleted or recovered.” but I can’t get it to work with edits for some reason…

I missed this event. I will submit the pull request.

> [@mr8](#):
>
> Payload format?  
> The Setting up webhooks howto makes it looks as if the a Post event will trigger a payload with just the relevant post, however I seem to be getting the whole topic and post\_stream in my payloads. Is this expected or am I doing something wrong?

My intention is to push as most information as possible. But a lot of people complains about it. Later I would send only the relevant model. E.g. Post webhook for only post.

As of the fields in the payload, I would eliminate some fields only used by the Ember app. The query language mentioned by @Lapinot might be better in a plugin.

@burke Badge Event is on the way. I will need some time for testing.

---

<div class="post-metadata">

### Author: ![jackzampolin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jackzampolin/32/121017_2.png) [@jackzampolin](https://meta.discourse.org/u/jackzampolin)
#### Post date: [January 26, 2017, 9:31pm UTC](https://meta.discourse.org/t/webhooks-feedback/49046/29 "2017-01-26T21:31:35Z")

</div>

Is there any documentation on the Payload format? I would like to write my own client and that documentation would make getting started way easier.

---

<div class="post-metadata">

### Author: ![mikechristopher](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mikechristopher/32/89135_2.png) [@mikechristopher](https://meta.discourse.org/u/mikechristopher)
#### Post date: [February 10, 2017, 1:57pm UTC](https://meta.discourse.org/t/webhooks-feedback/49046/30 "2017-02-10T13:57:37Z")

</div>

I realised I probably posted on the wrong post before -

on the user creation / update is it possibly to get the email address added into the payload? As was surprised to see this is missing.

Also I have noticed that it only seems to be sending out users that have updated their profile rather than new ones registered. For example I sent an invite to an email, registered via the invite of which auto approves the user but is not showing up in the list having been sent only the ones that I have updated.

> User Event  
> When a user is created, approved or updated.

---

<div class="post-metadata">

### Author: ![burke](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/burke/32/4211_2.png) [@burke](https://meta.discourse.org/u/burke)
#### Post date: [February 17, 2017, 3:19pm UTC](https://meta.discourse.org/t/webhooks-feedback/49046/31 "2017-02-17T15:19:20Z")

</div>

> [@fantasticfears](#):
>
> @burke Badge Event is on the way. I will need some time for testing.

@fantasticfears, any closer with Badge events? Anything we could do to help? Thanks!

Still salivating about how Badge Event webhooks could revolutionize spam filtering for our community by allowing Discourse badge assignments to manipulate LDAP entries. 🤓

---

<div class="post-metadata">

### Author: ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)
#### Post date: [February 20, 2017, 9:53am UTC](https://meta.discourse.org/t/webhooks-feedback/49046/32 "2017-02-20T09:53:09Z")

</div>

@jackzampolin The payload is almost the same as the Discourse web application gets. The generic format is like this:

```json
{
  "user": {
    // user payload
  }
}

```

You can read the payload examples in the webhook event page.

* * *

@mikechristopher Thanks for mention that. I included this within the submitted pull request.

* * *

@burke The team will [focus on some important event types](https://meta.discourse.org/t/setting-up-webhooks/49045/12). Once [the pull request](https://github.com/discourse/discourse/pull/4696) which allows easy customization is ready, I’ll write a documentation to show how to add some types on your own.

---

<div class="post-metadata">

### Author: ![jackzampolin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jackzampolin/32/121017_2.png) [@jackzampolin](https://meta.discourse.org/u/jackzampolin)
#### Post date: [March 1, 2017, 11:53pm UTC](https://meta.discourse.org/t/webhooks-feedback/49046/33 "2017-03-01T23:53:52Z")

</div>

@fantasticfears By the webhook event page do you mean this topic: [Webhook for Discourse events - #7 by adrapereira](https://meta.discourse.org/t/webhook-for-discourse-events/39808/7)

It would be nice to have exact JSON examples for each event type. That way developing clients is very easy.

---

<div class="post-metadata">

### Author: ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)
#### Post date: [March 21, 2017, 8:00am UTC](https://meta.discourse.org/t/webhooks-feedback/49046/34 "2017-03-21T08:00:40Z")

</div>

As the recent change to webhooks (many thanks to @tgxworld for the help), the serialization payload includes only relevant object. i.e. Payload for topic event type includes only topic.

Please start a new topic for any other webhook feature requests and bug report.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [March 21, 2017, 8:12am UTC](https://meta.discourse.org/t/webhooks-feedback/49046/35 "2017-03-21T08:12:52Z")

</div>



[Previous page](https://meta.discourse.org/t/webhooks-feedback/49046.md?page=1)
