Back to Support Account Tools Webhooks

Webhooks

Webhooks lets you easily develop push notifications. This push notification is 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.

Note: The Webhook settings mentioned on this page do not apply to plugin-enabled sites. Various plugins offer similar functionality.

You can find this feature by adding /wp-admin/options-general.php?page=webhooks to the end of your site’s URL (e.g. example.wordpress.com/wp-admin/options-general.php?page=webhooks).

Add a Webhook

You can add a webhook by clicking the Add webhook button and filling out a form.

Screen Shot 2015-06-05 at 1.44.57 PM

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.

wp-admin-webhooks

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.

Was this guide helpful for you?

Not quite what you're looking for? Get Help!

Copied to clipboard!