Content Webhooks

Follow

Content Webhooks allow external applications or websites to become aware of content changes that occur within your Agility CMS instance. This works by providing a list or URL endpoints to Agility CMS. Each time content changes in the CMS, Agility will notify each endpoint of the change and pass-on a message representing the exact change that occurred.

This can be incredibly useful for a developer. Some use cases for using webhooks are:

  • Clearing and managing a custom cache in an external system such as a website, mobile application, or database
  • Providing a way to sync content/data for integrations with third-party systems (i.e. SalesForce, Mailchimp, etc)
  • Building custom content workflows
  • Kick-off a CI/D pipeline to redeploy your website when content has been updated - this is often used for JAMstack sites that are built using static site generators

How to Add a Webhook Endpoint

In order to add a webhook, you must have access to an Agility CMS instance with Content Fetch API enabled. If you don't have this enabled, please contact support@agilitycms.com.

  1. In Agility CMS, navigate to Settings > Customization/Development > Webhooks.

    mceclip0.png
  2. Click Add (+) to add a webhook endpoint.
    mceclip1.png
  3. In the Webhook details flyout, enter the Url endpoint that you want to send events to. For testing, we recommend using a free service such as https://requestbin.com which allows you to set up an endpoint and monitor the messages that get sent there.

    mceclip4.png

    After signing up/logging into their service, we get a Url we can use.

    mceclip3.png
  4. Next, select what type of Events this webhook should be subscribed to. You can optionally subscribe to all events (Publishes, Workflow Approvals, and Content Saves) or select only the type(s) you need.

    mceclip5.png
  5. When you are ready, click the Send Test Payload button to test your webhook endpoint. This will generate a sample request to your defined endpoint Url and log the result.
    mceclip6.png
  6. If you created a requestbin endpoint, you can verify the payload that was sent there.
    mceclip7.png
  7. When ready, click Save to save your webhook.

Payload Details

Page Events

On Save:

{    
    "state": "Saved",
    "instanceGuid": "046a1a87",
    "languageCode": "en-us",
    "pageID": 2,
    "pageVersionID": 76,
    "changeDateUTC": "2019-11-06T15:08:54.7977419Z"
}

On Publish:

{    
    "state": "Published",
    "instanceGuid": "046a1a87",
    "languageCode": "en-us",
    "pageID": 2,
    "pageVersionID": 76,
    "changeDateUTC": "2019-11-06T15:08:54.7977419Z"
}

Content Events

On Save:

{
    "state": "Saved",
    "instanceGuid": "046a1a87",
    "languageCode": "en-us",
    "referenceName": "posts",
    "contentID": 39,
    "contentVersionID": 300,
    "changeDateUTC": "2019-11-06T15:10:24.9905899Z"
}

On Publish:

{
    "state": "Published",
    "instanceGuid": "046a1a87",
    "languageCode": "en-us",
    "referenceName": "posts",
    "contentID": 39,
    "contentVersionID": 300,
    "changeDateUTC": "2019-11-06T15:10:24.9905899Z"
}
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.