Webhooks are a Pro feature of Castor that allow you to push data directly to Castor. It's a developer-friendly, advanced feature, that will help you integrate Castor with your existing backend.
Webhooks can simplify edition of widgets content, as you can edit just one particular line of a file using Edition Modes.
Webhooks can be used to push data to the following widget types:
- Text Widgets: set the text value
- Custom Tables: set the content or remote content URL
- Custom Charts: set the content or remote content URL
- Custom Frame: set the frame URL
Get the Webhook URL
Each widget has its own webhook URL where data can be sent to. To get the the webhook URL for a specific widget, click on the webhook icon, next to the
Copy the webhook URL: that's the URL where you'll send JSON payloads.
Webhook Payload Specification
POST JSON payloads to your Webhook URL according to the following specification:
||New value for target widget. Optional if
||Value from list:
||Edition mode, see Edition Modes.|
mode attribute is a required attribute in every webhook payload sent to Castor. It allows you to select how the widget content should be edited, and takes one of the following values:
Specific to local CSV content (Custom Tables and Charts):
valuewill be inserted in the file at the line described by
- Example: If
mode = 'addline'and
line = 2, the content from
valuewill be the new line 2 and former line 2 will become line 3.
- Example: If
removeline: line described by
lineargument will be deleted from target widget content.
editline: line described by
lineargument will be replaced by
Available to every type of content
valueprior to existing content
valueafter existing content
replace: replace old value with