Rules
Overview
If you prefer to send a webhook only when predefined criteria are met, you can set up rules on it. The rules consist of three components: variable_name, operation, and value. Every rule must pass for the webhook to be sent; a webhook with no rules is sent after every run, successful or failed.
The available operations, and how the value must be written, vary depending on the data type of the variable:
uuid and string
EQUAL, NOT_EQUAL, IN, NOT_IN
Any text
integer
EQUAL, NOT_EQUAL, IN, NOT_IN, LESS_THAN, GREATER_THAN
A number, e.g. "0"
date and time
LESS_THAN, GREATER_THAN
YYYY-MM-DD / HH:MM in UTC
boolean
EQUAL, NOT_EQUAL
"true" or "false"
IN and NOT_IN take a list of values, e.g. ["Erathos Schedule", "ana@acme.com"]; values can contain spaces and commas. Every other operation takes a single value.
Rules are provided via the rules attribute, when creating a webhook or updating it (an update replaces all of its rules). Below is an example of a body with multiple rules for reference:
{
"description": "airflow_trigger_example",
"is_active": true,
"jobs": [
"uuid_1",
"uuid_2",
...,
"uuid_n"
],
"method": "POST",
"url": "https://${{variables.AIRFLOW_HOST}}/api/v1/dags/${{erathos.job_id}}/dagRuns",
"header": {
"Content-Type": "application/json",
"Authorization": "Basic ${{secrets.AIRFLOW_KEY}}"
},
"body": {
"conf": {
"name": "${{erathos.table_name}}",
"status": "${{erathos.status}}"
}
},
"rules": [
{
"variable_name": "STATUS",
"operation": "EQUAL",
"value": "FINISHED"
},
{
"variable_name": "ROWS",
"operation": "GREATER_THAN",
"value": "0"
},
{
"variable_name": "FINISHED_AT_TIME",
"operation": "GREATER_THAN",
"value": "00:00"
},
{
"variable_name": "FINISHED_AT_TIME",
"operation": "LESS_THAN",
"value": "08:00"
},
{
"variable_name": "FINISHED_AT_WEEKDAY",
"operation": "NOT_IN",
"value": ["0", "6"]
}
]
}To discover the variables available for creating rules, refer to Metadata.
Examples
Below are groups of frequently used rules that can be included in your custom webhooks and combined with the webhook templates presented next.
Execution status
Success
Every successful execution that has encountered any data.
Failed
Every execution that results in a failure.
Dependent jobs
Filter only the main tables (endpoints with nested tables generate a separate webhook for each table when this rule is not used).
Time
Executions during weekdays between 00:00 BRT and 08:00 BRT (03:00 to 11:00 UTC: times are compared in UTC).
Execution type
Filter only Full Refresh executions.
Schedules
Filter only scheduled executions.
Orchestration
Filter only executions triggered programmatically.
Last updated

