# Webhook for Discourse events

**URL:** https://meta.discourse.org/t/webhook-for-discourse-events/39808
**Category:** Feature
**Tags:** rfc
**Created:** [February 18, 2016, 4:06pm UTC](https://meta.discourse.org/t/webhook-for-discourse-events/39808 "2016-02-18T16:06:42Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![adrapereira](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/adrapereira/32/51755_2.png) [@adrapereira](https://meta.discourse.org/u/adrapereira)
#### Post date: [March 6, 2016, 7:28pm UTC](https://meta.discourse.org/t/webhook-for-discourse-events/39808/7 "2016-03-06T19:28:08Z")

</div>

I’m writing a proposal for this project to apply for GSOC 16 and would like your help since I’m not completely familiarized with Discourse and its code.

The settings page will be close the one GitHub has, admins will be able to create webhooks by defining the payload URL and the events that trigger the webhook. After a webhook is created, there will be options to enable/disable, edit or remove it.

I’m thinking that each payload will have two sections: the first defines the payload with some fields like the timestamp and action that triggered the event; the second section contains the fields specific to each action.

Regarding the second section, we can use the existing serializers for the object(s) in question (user, topic, post, etc.) or we can choose carefully which fields will be sent.

Just to start the discussion, I’ve made a quick list of the proposed fields of each payload:

## User

### user\_registered and user\_activated

`username, email, name, trust_level`

### trust\_level\_changed

`username, old_trust_level, new_trust_level`

### message\_sent

`sender_username, receiver_username, msg_title, msg_content`

Do we want the message content to be sent?

Another option is to define the required information of a user and use it whenever we’re referring to a user. For example, instead of `sender_username` we would have `sender_info` which has {ID, name, username, email, trust\_level, …}.

## Topic

### Topic\_created

`ID, title, content, creator_username, categories`

### Topic\_liked

`ID, title, username, number_of_likes`

### Topic\_{pinned,unpinned,archived,closed,invisibled,_bookmarked_}

`ID, title, username`

## Post

### Post\_liked

`post_ID, topic_ID, username, number_of_likes`

### Reply\_posted

`post_ID, topic_ID, username, content`

## Other

### Auto\_close\_set

I don’t know what this one means…

### Flag\_raised

`post_id, topic_id, reason`

* * *

This is what I had in mind, please let me know if you had another idea 😉

---

_[View the full topic](https://meta.discourse.org/t/webhook-for-discourse-events/39808)._
