# Add new webhooks and customize webhook payload

**URL:** <https://meta.discourse.org/t/add-new-webhooks-and-customize-webhook-payload/59609>\
**Category:** Administrators\
**Tags:** webhooks, how-to\
**Created:** [March 21, 2017, 10:27am UTC](https://meta.discourse.org/t/add-new-webhooks-and-customize-webhook-payload/59609 "2017-03-21T10:27:08Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)\
**Post date:** [November 22, 2018, 3:01am UTC](https://meta.discourse.org/t/add-new-webhooks-and-customize-webhook-payload/59609/9 "2018-11-22T03:01:57Z")

</div>

@fantasticfears Thanks for the writeup!

It needs a bit of tweaking to take account of the changes introduced [in this commit](https://github.com/discourse/discourse/commit/bf84037f79ed8f2f5b5db0e22e2a17fbc7d38077#diff-0e98636b29e3b908201e344e101066ba).

- You no longer need a `setup_` method in `Jobs::EmitWebHookEvent`.

- There’s now a `WebHook` a class method for formatting custom payloads via a serializer:

Also, I’m wondering about the thinking behind namespacing the payload with the event type? This makes it a little harder to use endpoints you don’t fully control, which expect certain attributes in the body.

```plaintext
def build_web_hook_body(args, web_hook)
   ....
   if ping_event?(event_type)
     body[:ping] = 'OK'
   else
     body[event_type] = args[:payload]
   end
  ...
end

```

---

_[View the full topic](https://meta.discourse.org/t/add-new-webhooks-and-customize-webhook-payload/59609)._
