Message and HTTP Action Templates
When configuring an Email/SMS/Slack notification, you can customize your email/SMS/Slack message by editing the message template.
Template variables (those wrapped by ${} symbol) will be replaced by actual values during task executions.
Built-in Template Variables
Here's built-in template variable list that you can use in your message template:
| Variables | Description | Example |
|---|---|---|
| ${task.name} | Task name | Example website healthcheck task |
| ${task.url} | Request URL of the task | https://example.com |
| ${task.executionLink} | CronDog URL of the task execution that triggered the message. This is helpful to redirect users to review task execution details. | |
| ${condition.description} | Description of the notification condition | [status_code equals 200] |
| ${condition.evaluatedSourceValue} | A list of all evaluated conditions during task execution. You may access each individual value by providing an index, e.g. ${condition.evaluatedSourceValue[0]} | [200] |
| ${responseBody} | The entire response body of the API request | Your API request was completed successfully. |
HTTP Notification Templates
HTTP notifications can also use templates. When a task execution triggers an HTTP notification, CronDog evaluates template variables in the HTTP notification's URL, request headers, and request body before sending the notification request.
HTTP notification templates support the triggering task's response body:
| Variables | Description | Example |
|---|---|---|
| ${responseBody} | The raw response body from the task execution that triggered the HTTP notification | {"token":"abc"} |
| ${responseBody.token} | A top-level JSON property from the triggering task response body | abc |
You can use these variables in:
| HTTP notification field | Example |
|---|---|
| URL | https://api.example.com/users/${responseBody.id} |
| Request headers | Authorization: Bearer ${responseBody.token} |
| Request body | {"sourceStatus":"${responseBody.status}"} |
For example, if the triggering task response body is:
{
"token": "abc",
"status": "active"
}
You can configure an HTTP notification with headers like:
Authorization: Bearer ${responseBody.token}
X-Source-Status: ${responseBody.status}
Simple nested JSON object access is supported, such as ${responseBody.data.token}. Full JSONPath syntax, array indexing, and bracket notation are not currently supported in HTTP notification templates.
