Skip to Content
Rule ReferenceTemplate Variables

Template Variables

Template variables let you inject dynamic, runtime data into action parameters. They use double-curly-brace syntax and are resolved at execution time when the rule fires.

Syntax

Variables are written as {{variable.name}} inside any action param string value.

params: text: "The result is {{condition.result}} as of {{now}}"

Available Variables

VariableTypeDescriptionExample Value
{{condition.result}}string or numberThe value returned by the condition check"72", "3", "1024"
{{org.owner.email}}stringEmail address of the organization owner"admin@acme.com"
{{rule.name}}stringThe name of the currently executing rule"cost-alert"
{{now}}string (ISO 8601)Current UTC timestamp at execution time"2026-04-28T09:00:00Z"
{{trigger.data}}string (JSON)Raw event data from the trigger{"action":"opened","number":42}

Variable Details

{{condition.result}}

Contains the value that was evaluated by the condition check. This is the actual data point retrieved from the provider.

  • For pr.age with operator gt and value 3: if the oldest PR is 5 days old, {{condition.result}} is "5".
  • For billing.mtd with operator gt and value 50: if the spend is $72, {{condition.result}} is "72".

If the rule has no condition block, {{condition.result}} will be empty. Only use this variable in rules that have a condition defined.

{{org.owner.email}}

The email address of the organization owner who set up the TinyOps workspace. Useful for routing notifications to the right person without hardcoding email addresses.

{{rule.name}}

The name field from the rule definition. Useful for identifying which rule generated a notification, especially when multiple rules share the same action channel.

{{now}}

The current UTC timestamp in ISO 8601 format when the action executes. Useful for audit trails and time-stamping notifications.

{{trigger.data}}

The raw event payload that caused the trigger to fire. For webhook triggers, this contains the full incoming event data. For schedule and poll triggers, this may be minimal or empty.

{{trigger.data}} can be large for webhook events. Use it primarily for debugging or when you need to surface specific event details in notifications.


Usage in Action Params

Template variables work in any string value within the params object. They can be combined with static text and used across all action providers.

Slack Message Example

slack-with-variables.yaml
name: stale-pr-alert trigger: type: schedule cron: "0 9 * * 1-5" condition: provider: github check: pr.age operator: gt value: 3 repo: acme/webapp action: provider: slack method: send_message params: channel: "#engineering" text: | *Stale PR Alert* Rule: {{rule.name}} Oldest PR age: {{condition.result}} days Checked at: {{now}} Owner: {{org.owner.email}}

Email Example

email-with-variables.yaml
name: weekly-repo-summary trigger: type: schedule cron: "0 9 * * 1" condition: provider: github check: repo.open_prs operator: gt value: 0 repo: acme/webapp action: provider: email method: send params: to: "{{org.owner.email}}" subject: "Weekly summary: {{rule.name}}" body: | Hello, Your weekly repository summary is ready. Open PRs: {{condition.result}} Generated: {{now}} - TinyOps

GitHub Comment Example

github-comment-with-variables.yaml
name: large-pr-warning trigger: type: webhook event: github.pull_request.opened source: github condition: provider: github check: pr.lines_changed operator: gt value: 500 action: provider: github method: pr_comment params: body: | ## Large PR Detected This PR has **{{condition.result}}** lines changed (threshold: 500). Please consider splitting this into smaller pull requests for easier review. _Automated by {{rule.name}} at {{now}}_

Webhook Payload Debugging

debug-webhook.yaml
name: release-notification trigger: type: webhook event: release source: generic action: provider: slack method: send_message params: channel: "#releases" text: "Release event received at {{now}}. Payload: {{trigger.data}}"

Multiple Variables in One String

You can combine any number of variables in a single param value:

params: text: "[{{rule.name}}] Alert at {{now}}: value is {{condition.result}}. Contact {{org.owner.email}}."

Variables by Provider Context

VariableWorks with condition?Works without condition?
{{condition.result}}YesNo (empty)
{{org.owner.email}}YesYes
{{rule.name}}YesYes
{{now}}YesYes
{{trigger.data}}YesYes

Next Steps

  • Actions for all available methods and params
  • Conditions to understand what {{condition.result}} contains
  • YAML Syntax for complete rule structure