Webhook User Guide
This document will guide you on how to use the CMS Webhook feature.
Webhook is triggered only for operations performed within CMS. Operations on the Cloud Development Database through other endpoints/SDK will not trigger CMS's Webhook.
Webhooks can be used to automatically call back external systems after content administrators modify content data, such as automatically building static websites or sending notifications. By using Webhooks, you can integrate CloudBase CMS with other systems and subscribe to specific events on CloudBase CMS.
Currently, CloudBase CMS supports two types of Webhooks: HTTP and cloud functions, which involve sending HTTP requests and invoking cloud functions upon triggering. It also supports monitoring changes to content data in the project, including create, update, and delete operations.
HTTP Webhook
When a Webhook is triggered, a specified HTTP request is sent.
Configure Webhook
- Webhook Name
- Trigger URL: The callback URL address when a specific event occurs
- Monitor Content: Specify All Content Collections
- HTTP method: Supports methods such as
POST
,DELETE
,PATCH
, etc. It is recommended to use thePOST
method. - HTTP Headers: Supports configuring HTTP Headers for the request URL.
HTTP Body
Body Carried When Webhook Is Triggered:
- collection: The collection name of the database that triggered the event
- action: Trigger event
- create: Create content
- update: Update content
- delete: Delete content
- payload: Response to the database operation
- source: Webhook origin, fixed to
CMS_WEBHOOK_HTTP
Example:
{
collection: '',
action: '',
payload: '',
source: 'CMS_WEBHOOK_HTTP'
}
Cloud Function Webhook
When the Webhook is triggered, the specified cloud function is invoked.
Configure Webhook
- Webhook Name
- Cloud Function name: Specifies the cloud function to be triggered. Only cloud functions within the same environment are supported.
- Monitor Content: Specify All Content Collections
Cloud Function event Parameters
Webhook-triggered cloud function event parameter
- collection: The collection name of the database that triggered the event
- action: Trigger event
- create: Create content
- update: Update content
- delete: Delete content
- payload: Response to the database operation
- source: Webhook source, fixed to
CMS_WEBHOOK_FUNCTION
Example:
{
collection: '',
action: '',
payload: '',
source: 'CMS_WEBHOOK_FUNCTION'
}