# How to differentiate webhooks for created, approved or updated

**URL:** https://meta.discourse.org/t/how-to-differentiate-webhooks-for-created-approved-or-updated/71607
**Category:** Support
**Created:** [10월 8, 2017, 12:18오전 UTC](https://meta.discourse.org/t/how-to-differentiate-webhooks-for-created-approved-or-updated/71607 "2017-10-08T00:18:45Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![watchmanmonitor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watchmanmonitor/32/430970_2.png) [@watchmanmonitor](https://meta.discourse.org/u/watchmanmonitor)
#### Post date: [10월 8, 2017, 12:18오전 UTC](https://meta.discourse.org/t/how-to-differentiate-webhooks-for-created-approved-or-updated/71607/1 "2017-10-08T00:18:45Z")

</div>

I’m using webhooks to process new users [via zapier](https://meta.discourse.org/t/discourse-webhooks-and-zapier/56753), and lately it’s being triggered too often.

The option we have in the admin is `When a user is created, approved or updated.`

I thought that the email would only be sent on [new user creation](https://meta.discourse.org/t/should-the-email-address-of-a-new-user-be-included-in-the-webhook/59255). but we’re getting it even if the user had a badge awarded, joined a group, etc.

So the question is.. what’s the best way to identify when the webhook is related to a new user, vs a user being updated?

Thanks!

---

<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: [10월 8, 2017, 2:45오전 UTC](https://meta.discourse.org/t/how-to-differentiate-webhooks-for-created-approved-or-updated/71607/2 "2017-10-08T02:45:45Z")

</div>

Hmm I think our webhook should be more distinct here.

- user created
- user updated

Can you add this to your list @neil

---

<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: [10월 8, 2017, 10:01오후 UTC](https://meta.discourse.org/t/how-to-differentiate-webhooks-for-created-approved-or-updated/71607/3 "2017-10-08T22:01:13Z")

</div>

> [@watchmanmonitor](#):
>
> what’s the best way to identify when the webhook is related to a new user, vs a user being updated?

You can get that from the `X-Discourse-Event` header field. When a user is created that field’s value will be `user_created`.

> [@watchmanmonitor](#):
>
> lately it’s being triggered too often.

It seems that the User `user_updated` webhook is being sent every time a user creates a Topic or a Post. This didn’t used to happen and seems like a bug.

---

<div class="post-metadata">

### Author: ![watchmanmonitor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watchmanmonitor/32/430970_2.png) [@watchmanmonitor](https://meta.discourse.org/u/watchmanmonitor)
#### Post date: [10월 8, 2017, 11:48오후 UTC](https://meta.discourse.org/t/how-to-differentiate-webhooks-for-created-approved-or-updated/71607/4 "2017-10-08T23:48:35Z")

</div>

> [@simon](#):
>
> header field

Thanks @simon it looks like Zapier doesn’t surface the headers which are sent over. Assuming we get the user\_created & user\_updated in the body of the webhook, I should be able to know just when to perform an action for a newly created user.

For the record, these are the fields I can act on via Zapier as of Oct 7 2017

> <https://gist.github.com/YesThatAllen/8e6f835042a4fc6fb09c9dfee2163e2c#file-discourse_webhook_data-txt-L8-L14>

---

<div class="post-metadata">

### Author: ![watchmanmonitor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watchmanmonitor/32/430970_2.png) [@watchmanmonitor](https://meta.discourse.org/u/watchmanmonitor)
#### Post date: [10월 10, 2017, 7:17오전 UTC](https://meta.discourse.org/t/how-to-differentiate-webhooks-for-created-approved-or-updated/71607/5 "2017-10-10T07:17:43Z")

</div>

> [@simon](#):
>
> You can get that from the X-Discourse-Event header field. When a user is created that field’s value will be user\_created.

I asked Zapier about this, and while the information sent in the header is awesome, they don’t include it in [Zaps](https://meta.discourse.org/t/discourse-webhooks-and-zapier/56753).

I’d love to see this information sent in the body of Discourse’s webhook, and not just the headers.

Given this set of headers:

```plaintext
Request URL: https://hooks.zapier.com/hooks/catch/REDACTED/
Request method: POST
Accept: */*
Connection: close
Content-Length: 7429
Content-Type: application/json
Host: hooks.zapier.com
User-Agent: Discourse/1.9.0.beta12
X-Discourse-Instance: https://SITE_NAME
X-Discourse-Event-Id: 168
X-Discourse-Event-Type: user
X-Discourse-Event: user_updated

```

Specifically: `X-Discourse-Event-Type` and `X-Discourse-Event`

Though I can see where `X-Discourse-Instance` would be useful too.

Maybe this change can be included with the fix for [71643](https://meta.discourse.org/t/creating-a-topic-or-a-post-sends-the-user-updated-webhook/71643/10)

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [10월 24, 2017, 8:35오후 UTC](https://meta.discourse.org/t/how-to-differentiate-webhooks-for-created-approved-or-updated/71607/6 "2017-10-24T20:35:40Z")

</div>

The issue with user\_updated always being triggered [was fixed](https://meta.discourse.org/t/creating-a-topic-or-a-post-sends-the-user-updated-webhook/71643/12) by @tgxworld. 🎉

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [12월 5, 2019, 8:12오전 UTC](https://meta.discourse.org/t/how-to-differentiate-webhooks-for-created-approved-or-updated/71607/7 "2019-12-05T08:12:37Z")

</div>



---

<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: [12월 5, 2019, 5:15오후 UTC](https://meta.discourse.org/t/how-to-differentiate-webhooks-for-created-approved-or-updated/71607/8 "2019-12-05T17:15:44Z")

</div>

> [@watchmanmonitor](#):
>
> 이 문제에 대해 Zapier에 문의했는데, 헤더에 전송되는 정보는 훌륭하지만 [Zaps](https://meta.discourse.org/t/discourse-webhooks-and-zapier/56753)에는 이를 포함하지 않는다고 합니다.

조금 복잡하지만, 이 게시물에 설명된 방법을 사용하여 Zapier에서 웹훅 요청 헤더를 추출할 수 있습니다: [https://meta.discourse.org/t/discourse-webhooks-and-zapier/56753/32](https://meta.discourse.org/t/discourse-webhooks-and-zapier/56753/32).

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [9월 13, 2023, 9:15오전 UTC](https://meta.discourse.org/t/how-to-differentiate-webhooks-for-created-approved-or-updated/71607/9 "2023-09-13T09:15:18Z")

</div>



---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [9월 13, 2023, 9:26오전 UTC](https://meta.discourse.org/t/how-to-differentiate-webhooks-for-created-approved-or-updated/71607/10 "2023-09-13T09:26:14Z")

</div>


