# Webhooks plugin

**URL:** https://meta.discourse.org/t/webhooks-plugin/25176
**Category:** Plugin
**Created:** [February 12, 2015, 10:19pm UTC](https://meta.discourse.org/t/webhooks-plugin/25176 "2015-02-12T22:19:34Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![rcfox](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rcfox/32/115486_2.png) [@rcfox](https://meta.discourse.org/u/rcfox)
#### Post date: [February 12, 2015, 10:19pm UTC](https://meta.discourse.org/t/webhooks-plugin/25176/1 "2015-02-12T22:19:34Z")

</div>

I made a super-simple webhooks plugin, which sends HTTP requests for chosen DiscourseEvents that are triggered. Right now, there aren’t many events that are triggered, and only topic\_created and post\_created seem like they’d be useful for this. Hopefully, more events will be sprinkled around the main code in the future.

[https://github.com/rcfox/Discourse-Webhooks](https://github.com/rcfox/Discourse-Webhooks)

---

<div class="post-metadata">

### Author: ![Craig\_Kahle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/craig_kahle/32/115539_2.png) [@Craig\_Kahle](https://meta.discourse.org/u/Craig_Kahle)
#### Post date: [May 6, 2015, 8:59pm UTC](https://meta.discourse.org/t/webhooks-plugin/25176/2 "2015-05-06T20:59:45Z")

</div>

Would it be difficult to listen for new Notifications for a user? How would you potentially go about this? Thanks for the plugin btw.

---

<div class="post-metadata">

### Author: ![rcfox](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rcfox/32/115486_2.png) [@rcfox](https://meta.discourse.org/u/rcfox)
#### Post date: [May 6, 2015, 9:20pm UTC](https://meta.discourse.org/t/webhooks-plugin/25176/3 "2015-05-06T21:20:36Z")

</div>

The plugin listens to DiscourseEvent.trigger. There aren’t a whole lot of uses of it yet though: [Code search results · GitHub](https://github.com/discourse/discourse/search?q=DiscourseEvent.trigger+path%3A%2Flib+path%3A%2Fapp&type=Code)

Adding it yourself wouldn’t be too difficult if you find where notifications are created. Or maybe you can get one of the Discourse devs to do it for you.

---

<div class="post-metadata">

### Author: ![Pugwash](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pugwash/32/3760_2.png) [@Pugwash](https://meta.discourse.org/u/Pugwash)
#### Post date: [July 22, 2015, 10:12pm UTC](https://meta.discourse.org/t/webhooks-plugin/25176/4 "2015-07-22T22:12:17Z")

</div>

One possible use-case for webhooks would be syncing new users on Discourse with a 3rd party application or CRM system. I’m not sure about the internals for Discourse, but if you were able to set a trigger against a new user that would be very useful.

One step further you could link this to [Zapier](https://zapier.com), making it trivial to sync to a few hundred other SaaS apps.

---

<div class="post-metadata">

### Author: ![ntrrobng](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ntrrobng/32/121884_2.png) [@ntrrobng](https://meta.discourse.org/u/ntrrobng)
#### Post date: [March 30, 2016, 2:26pm UTC](https://meta.discourse.org/t/webhooks-plugin/25176/5 "2016-03-30T14:26:36Z")

</div>

Hero. This is precisely what I need.

I also need a user\_created hook, but I’m playing with that and will be be creating a pull request for that (and more?) soon.

---

<div class="post-metadata">

### Author: ![jesselperry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jesselperry/32/119501_2.png) [@jesselperry](https://meta.discourse.org/u/jesselperry)
#### Post date: [March 30, 2016, 3:32pm UTC](https://meta.discourse.org/t/webhooks-plugin/25176/6 "2016-03-30T15:32:31Z")

</div>

I’ve been using this plugin for a few months and it’s worked perfectly. Thanks for bringing it into existence @rcfox!

---

<div class="post-metadata">

### Author: ![ntrrobng](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ntrrobng/32/121884_2.png) [@ntrrobng](https://meta.discourse.org/u/ntrrobng)
#### Post date: [March 31, 2016, 8:51am UTC](https://meta.discourse.org/t/webhooks-plugin/25176/7 "2016-03-31T08:51:34Z")

</div>

I’m trying to setup a user created event hook, but when I do so, it breaks some tests related to post creation. The new event seems to be causing topic\_created to fire multiple times while preventing post\_created from firing.

in /app/models/user.rb

```
after_create do
  DiscourseEvent.trigger(:user_created, self)
end

```

Relevant test output

```
Failures:

  1) PostCreator new topic success triggers extensibility events
     Failure/Error: creator.create
     Mocha::ExpectationError:
       unexpected invocation: DiscourseEvent.trigger(:topic_created, #<Topic:0x7fcbdc666ae8>, {:title => 'hello world topic', :raw => 'my name is fred', :archetype_id => 1}, #<User:0x7fcbdd907c10>)
       unsatisfied expectations:
       - expected exactly once, not yet invoked: DiscourseEvent.trigger(:post_created, anything, anything, #<User:0x7fcbdd907c10>)
       - expected exactly once, invoked twice: DiscourseEvent.trigger(:topic_created, anything, anything, #<User:0x7fcbdd907c10>)
       satisfied expectations:
       - expected at least once, invoked 4 times: DiscourseEvent.trigger(:markdown_context, anything)
       - expected exactly once, invoked once: DiscourseEvent.trigger(:after_trigger_post_process, anything)
       - expected exactly once, invoked once: DiscourseEvent.trigger(:before_create_topic, anything, anything)
       - expected exactly once, invoked once: DiscourseEvent.trigger(:after_validate_topic, anything, anything)
       - expected exactly once, invoked once: DiscourseEvent.trigger(:validate_post, anything)
       - expected exactly once, invoked once: DiscourseEvent.trigger(:before_create_post, anything)
     # ./lib/post_creator.rb:220:in `trigger_after_events'
     # ./lib/post_creator.rb:150:in `create'
     # ./spec/components/post_creator_spec.rb:82:in `block (4 levels) in <top (required)>'

```

---

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [July 7, 2016, 12:42am UTC](https://meta.discourse.org/t/webhooks-plugin/25176/8 "2016-07-07T00:42:04Z")

</div>

Anyone tried to integrate it with Zapier?

---

<div class="post-metadata">

### Author: ![ajkoft](https://avatars.discourse-cdn.com/v4/letter/a/ed655f/32.png) [@ajkoft](https://meta.discourse.org/u/ajkoft)
#### Post date: [July 20, 2016, 5:09am UTC](https://meta.discourse.org/t/webhooks-plugin/25176/9 "2016-07-20T05:09:41Z")

</div>

Im looking for it too, cheers

---

<div class="post-metadata">

### Author: ![rriemann](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rriemann/32/115238_2.png) [@rriemann](https://meta.discourse.org/u/rriemann)
#### Post date: [July 28, 2016, 7:51am UTC](https://meta.discourse.org/t/webhooks-plugin/25176/10 "2016-07-28T07:51:57Z")

</div>

> [@rcfox](#):
>
> The plugin listens to DiscourseEvent.trigger. There aren’t a whole lot of uses of it yet though: [Code search results · GitHub](https://github.com/discourse/discourse/search?q=DiscourseEvent.trigger+path%3A%2Flib+path%3A%2Fapp&type=Code)

I checked the repo to find events for

- user profile changed (more precisely, new mail address confirmed)
- group membership changed (either triggered for every user or once for the group)

I couldn’t find it. Did I miss something?

---

<div class="post-metadata">

### Author: ![sunjam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sunjam/32/175682_2.png) [@sunjam](https://meta.discourse.org/u/sunjam)
#### Post date: [September 20, 2023, 3:32pm UTC](https://meta.discourse.org/t/webhooks-plugin/25176/11 "2023-09-20T15:32:39Z")

</div>

This plugin could be nice to integrate with [#auto](https://meta.discourse.org/t/discourse-automation/195773)

---

<div class="post-metadata">

### Author: ![rcfox](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rcfox/32/115486_2.png) [@rcfox](https://meta.discourse.org/u/rcfox)
#### Post date: [September 20, 2023, 3:48pm UTC](https://meta.discourse.org/t/webhooks-plugin/25176/12 "2023-09-20T15:48:22Z")

</div>

I believe Discourse supports webhooks directly now, so this plugin isn’t needed anymore.

---

<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: [September 20, 2023, 8:45pm UTC](https://meta.discourse.org/t/webhooks-plugin/25176/13 "2023-09-20T20:45:18Z")

</div>

It sure does. Webhooks are documented here: [Configure webhooks that trigger on Discourse events to integrate with external services](https://meta.discourse.org/t/configure-webhooks-that-trigger-on-discourse-events-to-integrate-with-external-services/49045).
