# Webhooks don't function properly when moderator approval is enabled

**URL:** https://meta.discourse.org/t/webhooks-dont-function-properly-when-moderator-approval-is-enabled/76635
**Category:** Bug
**Created:** [2017 年 12 月 22 日午後 5:41 UTC](https://meta.discourse.org/t/webhooks-dont-function-properly-when-moderator-approval-is-enabled/76635 "2017-12-22T17:41:42Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![jordan1909](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@jordan1909](https://meta.discourse.org/u/jordan1909)
#### Post date: [2017 年 12 月 22 日午後 5:41 UTC](https://meta.discourse.org/t/webhooks-dont-function-properly-when-moderator-approval-is-enabled/76635/1 "2017-12-22T17:41:42Z")

</div>

I am using webhooks as I’ve mentioned in other threads here.

I’ve noticed a bug however in this and I’d like to understand if its by design or other.

On our install we use moderator approval on posts if the TL is 2 or less. In my testing however I have noticed that with this feature enabled, the webhooks on post or topic actions do not fire 99.9% of the time.

The biggest confusion for me is a few randomly fire but the bulk majority do not. I could potentially wrap my head around all not going or all going but a few here or there going and the rest not is confusing me.

Can anyone think of a reason webhooks wouldn’t fire when we approve moderated posts? I’ve tried all variations including send me everything to no success.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2017 年 12 月 22 日午後 8:09 UTC](https://meta.discourse.org/t/webhooks-dont-function-properly-when-moderator-approval-is-enabled/76635/2 "2017-12-22T20:09:20Z")

</div>

> [@jordan1909](#):
>
> webhooks on post or topic actions

Which webhook are you looking for? Topic creation?

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [2017 年 12 月 22 日午後 10:17 UTC](https://meta.discourse.org/t/webhooks-dont-function-properly-when-moderator-approval-is-enabled/76635/3 "2017-12-22T22:17:30Z")

</div>

I was testing this in my development environment yesterday. When a post is approved it is sending a Post Event webhook, when a topic is approved it is sending a Topic and a Post Event webhook. This is working consistently for me. Are you seeing any errors in the events list for the webhook?

---

<div class="post-metadata">

### Author: ![jordan1909](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@jordan1909](https://meta.discourse.org/u/jordan1909)
#### Post date: [2017 年 12 月 28 日午後 11:39 UTC](https://meta.discourse.org/t/webhooks-dont-function-properly-when-moderator-approval-is-enabled/76635/4 "2017-12-28T23:39:21Z")

</div>

@simon @codinghorror

Sorry for the delay, I went afk for the holidays. I am still able to replicate this. When I get a chance I will make a quick video in the hopes someone spots a mistake.

Basically nothing is being triggered after approving topic. I am seeing no errors in the events list for the webhook either.

As you can see below I have pretty much set it to send me everything though I have tried limiting to just topic and post actions as well.

 ![webhook](https://global.discourse-cdn.com/meta/original/3X/5/b/5b386b1b817edc7a5a9b22f752f8259a8e827a94.png)

When I checked today the last webhook event that executed since 12/22 was for a ping that I sent using the ping button. Though the site has been pretty active since then.

**When I can I will create a video of this in action. In the hopes someone has an idea why they are missing.**

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [2017 年 12 月 29 日午前 3:14 UTC](https://meta.discourse.org/t/webhooks-dont-function-properly-when-moderator-approval-is-enabled/76635/5 "2017-12-29T03:14:48Z")

</div>

After you approve a topic or a post, do you see any errors in the Discourse logs? (Admin/Logs/Error Logs)

---

<div class="post-metadata">

### Author: ![jordan1909](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@jordan1909](https://meta.discourse.org/u/jordan1909)
#### Post date: [2017 年 12 月 29 日午前 3:51 UTC](https://meta.discourse.org/t/webhooks-dont-function-properly-when-moderator-approval-is-enabled/76635/6 "2017-12-29T03:51:46Z")

</div>

Literally nothing, its almost as if they aren’t enabled but they definitely are. I can actually replicate this in my development and production environments.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2017 年 12 月 29 日午前 6:17 UTC](https://meta.discourse.org/t/webhooks-dont-function-properly-when-moderator-approval-is-enabled/76635/7 "2017-12-29T06:17:12Z")

</div>

What version of Discourse are you on? View source to see.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [2017 年 12 月 29 日午前 7:36 UTC](https://meta.discourse.org/t/webhooks-dont-function-properly-when-moderator-approval-is-enabled/76635/8 "2017-12-29T07:36:05Z")

</div>

> [@jordan1909](#):
>
> When I checked today the last webhook event that executed since 12/22 was for a ping that I sent using the ping button. Though the site has been pretty active since then.

I was thinking that the issue was the webhook not being sent after a post or topic is _approved_, but it sounds as though the issue is affecting all webhook events on your forum. What happens when a TL 3 user creates or edits a post? If you reset the moderator approval settings to their defaults, does the problem go away?

---

<div class="post-metadata">

### Author: ![jordan1909](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@jordan1909](https://meta.discourse.org/u/jordan1909)
#### Post date: [2018 年 1 月 2 日午後 4:20 UTC](https://meta.discourse.org/t/webhooks-dont-function-properly-when-moderator-approval-is-enabled/76635/9 "2018-01-02T16:20:00Z")

</div>

> [@codinghorror](#):
>
> What version of Discourse are you on? View source to see.

I am on **v1.9.0.beta17 +80**

  

> [@simon](#):
>
> What happens when a TL 3 user creates or edits a post? If you reset the moderator approval settings to their defaults, does the problem go away?

If a user of TL 3 or higher creates or edits a post a webhook is triggered immediately. If I reset moderator approval it does in fact go away. So it seems to be directly tied into topics that require approval.

#### Tests:
Tests were done with a moderation required level of 2 or less.   
  
  

| Test | Moderation Required | Successful |
| --- | --- | --- |
| Create topic with TL \> 3 | No | Yes. Webhook successfully triggered. |
| Create Topic with TL \< 3 | Yes | Sporadically. This was strange but out of 10 runs  
3 successfully triggered a webhook but the rest did not. |
| Reply to Topic with TL \>= 3 | No | Yes. Webhook successfully triggered. |
| **Reply to Topic with TL \< 3** | **Yes** | **No. No webhook is triggered.** |
| Private Message (any TL) | No | Yes. Webhook successfully triggered. |
| Topic deleted | No | Yes. Webhook successfully triggered. |
| Topic edited TL \>= 3 | No | Yes. Webhook successfully triggered. |
| Topic edited TL \<= 3 | No | Yes. Webhook successfully triggered. |

  

#### Videos:

1. Creating a topic with TL of 3 or higher.

[https://global.discourse-cdn.com/meta/original/3X/d/b/dbcadafda0a876c65c9d1cac5b3d9fb0769bebcf.mp4](https://global.discourse-cdn.com/meta/original/3X/d/b/dbcadafda0a876c65c9d1cac5b3d9fb0769bebcf.mp4)

2. Creating a topic with TL of 2 or less.

[https://global.discourse-cdn.com/meta/original/3X/1/c/1c96ff78a71cb29220efb81862a8fa5406e20310.mp4](https://global.discourse-cdn.com/meta/original/3X/1/c/1c96ff78a71cb29220efb81862a8fa5406e20310.mp4)

1. Replying with a topic of TL of 3 or higher

[https://global.discourse-cdn.com/meta/original/3X/b/6/b6e1fb699f82e51b1306b7d353f45023ff218683.mp4](https://global.discourse-cdn.com/meta/original/3X/b/6/b6e1fb699f82e51b1306b7d353f45023ff218683.mp4)

1. Replying with a topic of TL of 2 or less

[https://global.discourse-cdn.com/meta/original/3X/f/7/f75ba1c64948c8d47f920bcfca212cc3110eb50b.mp4](https://global.discourse-cdn.com/meta/original/3X/f/7/f75ba1c64948c8d47f920bcfca212cc3110eb50b.mp4)

**EDIT: Not sure why my videos are being wonky but they work when you paste them directly.**

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2018 年 1 月 2 日午後 11:04 UTC](https://meta.discourse.org/t/webhooks-dont-function-properly-when-moderator-approval-is-enabled/76635/10 "2018-01-02T23:04:32Z")

</div>

@tgxworld can you have a look at this?

---

<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: [2018 年 1 月 3 日午前 9:28 UTC](https://meta.discourse.org/t/webhooks-dont-function-properly-when-moderator-approval-is-enabled/76635/12 "2018-01-03T09:28:00Z")

</div>

Fixed in

[https://github.com/discourse/discourse/commit/ad024373580531021e64ef1d695d9c1b8e1bdc61](https://github.com/discourse/discourse/commit/ad024373580531021e64ef1d695d9c1b8e1bdc61)

and I also found another bug while looking through the code

[https://github.com/discourse/discourse/commit/9644569a289ac9244c67ae9de5a1e183d669b133](https://github.com/discourse/discourse/commit/9644569a289ac9244c67ae9de5a1e183d669b133)

---

<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: [2018 年 1 月 6 日午前 10:09 UTC](https://meta.discourse.org/t/webhooks-dont-function-properly-when-moderator-approval-is-enabled/76635/13 "2018-01-06T10:09:01Z")

</div>

This topic was automatically closed after 3 days. New replies are no longer allowed.
