collective.webhook#

collective.webhook adds the Call webhook action to Plone content rules. This page shows how to call a webhook, such as the build hook of a static site host, each time content changes.

Create a content rule#

  1. Open Site Setup ‣ Content Rules and click Add content rule.

    The Content Rules control panel with the Add content rule button.
  2. Enter a Title, choose the Triggering event, and click Save. For example, choose Object modified to call the webhook when an editor saves a change.

    The Add Rule form with the title Call webhook on change and the event Object modified.

Add the webhook action#

  1. Choose Call webhook in the Action list and click Add.

    The rule page with Call webhook selected in the Action list.
  2. Fill in the form and click Save.

    The Add Webhook Action form filled in with a URL, the POST method, and a JSON payload.
    Webhook URL

    The URL to call, such as the build hook URL from your hosting service.

    Call method

    GET, POST or POST FORM. Choose POST unless your service documents another method.

    JSON payload

    The data to send, as JSON. Always fill in this field, and use {} when you have nothing to send. To send values from the content, use variables such as ${title} and ${url}. The table below the form lists all the variables.

    JSON headers

    Optional. A JSON object of headers, for example {"Authorization": "Bearer my-secret-token"}.

    Verbose logging

    Optional. Select it to write the request and the response to the Plone log while you test.

Apply the rule#

Click Apply rule on the whole site on the rule page.

The rule page with the Call webhook action and the Apply rule on the whole site button.

Plone now calls the webhook each time the triggering event happens.