Webhook for Discourse events

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 :wink:

10 Likes