# 插件可以添加 Webhook 吗？

**URL:** https://meta.discourse.org/t/can-a-plugin-add-a-webhook/81361
**Category:** Development
**Created:** [2018年二月23日 22:10 UTC](https://meta.discourse.org/t/can-a-plugin-add-a-webhook/81361 "2018-02-23T22:10:51Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![jack2](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jack2](https://meta.discourse.org/u/jack2)
#### Post date: [2018年二月24日 11:19 UTC](https://meta.discourse.org/t/can-a-plugin-add-a-webhook/81361/4 "2018-02-24T11:19:14Z")

</div>

Thanks @tgxworld. I’ve seen examples of how to use `DiscourseEvents` to emulate Discourse native webhooks [here](https://github.com/rcfox/Discourse-Webhooks/blob/master/plugin.rb#L34) and [here](https://github.com/bernd/discourse-slack-plugin/blob/master/plugin.rb#L8). I will try to do that if there’s no other choice.

But this seems complex. I would love to have a one-liner, like what @pfaffman proposed. [When you use the UI](https://meta.discourse.org/t/setting-up-webhooks/49045) or [the API](http://docs.discourse.org/#tag/Web-Hooks%2Fpaths%2F~1admin~1api~1web_hooks%2Fpost) to create a webhook, doesn’t Discourse call an internal function I could also use from my `plugin.rb` file?

---

_[View the full topic](https://meta.discourse.org/t/can-a-plugin-add-a-webhook/81361)._
