Webhooks
Contents
Related
Webhooks lets you easily develop push notifications. This push notification is simply a HTTP POST, that is triggered by some action. This is a feature aimed for developers who want to get data from actions (like when a new comment is submitted) that occur on a blog. Only admin level users can add or manage webhooks.
You can now find this under Settings -> Webhooks in the dashboard.

Add a Webhook
You will be able to add a webhook by pressing the Add webhook button and filling out a simple form.

You can choose an action and the fields associated with that action to be posted to the URL. The URL will receive an HTTP POST request when the selected action fires. The post data will contain the selected fields and one additional field called hook, that contains the action title.
You can edit, delete and activate or deactivate the webhook using the options in the webhook row.

Possible Actions/Fields
| Action | Description | Fields | ||
|---|---|---|---|---|
| comment_post | Runs just after a comment is saved in the database | comment_ID, comment_agent, comment_approved, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_content, comment_date, comment_date_gmt, comment_karma, comment_parent, comment_post_ID, comment_type, user_id | ||
| publish_page | Runs when a page is published, or if it is edited and its status is “published” | ID, comment_count, comment_status, guid, menu_order, ping_status, pinged, post_author, post_category, post_content, post_content_filtered, post_date, post_date_gmt, post_excerpt, post_mime_type, post_modified, post_modified_gmt, post_name, post_parent, post_password, post_status, post_title, post_type, post_url, to_ping | ||
| publish_post | Runs when a post is published, or if it is edited and its status is “published” | ID, comment_count, comment_status, guid, menu_order, ping_status, pinged, post_author, post_category, post_content, post_content_filtered, post_date, post_date_gmt, post_excerpt, post_mime_type, post_modified, post_modified_gmt, post_name, post_parent, post_password, post_status, post_title, post_type, post_url, to_ping |
What would I use something like this for?
Let’s look at a hypothetical example; say I want to get a text message every time a new comment is submitted to my site. First you need to setup a URL that will accept an HTTP POST request with the comment data and then does all of the heavy lifting of taking that data and shipping it off to your phone in the form of a text message. Then you add a new hook via the Webhooks section of the admin area for the ‘comment_post’ action, selecting which fields you want and the URL that you setup earlier. That’s all there is to it, WordPress.com will automatically send an HTTP POST with the fields you selected to the URL you configured for each comment that is submitted. A contrived example to be sure, but it gives you an idea of what the process looks like.
Last modified: April 12, 2012
Still confused?
Help us improve:
We're always looking to improve our documentation. If this page didn't answer your question or left you wanting more, let us know! We love hearing your feedback. For support, please use the forums or contact support form. Thanks!
