Alert Template Variables
Alert box widgets support template variables in their display message and TTS message templates. Variables are replaced with the actual alert data when the alert fires. Variables use the {{alert.field_name}} syntax (single braces {alert.field_name} also work).
The same handles work in child widgets nested inside a Custom Alert Group — see Custom Alert Box Widget.
Functions, fallbacks, and conditions
Alert display and TTS messages support the full template toolkit:
- Functions — e.g.
$(allUppercase {{alert.name}}), or$(abbreviateNumber {{alert.bits}})to shorten a big cheer. - Fallbacks and conditions — e.g.
{{alert.message ?? "no message"}}, or{{alert.is_anonymous ? "An anonymous cheer" : "A cheer"}}.
A viewer's own text (their {{alert.name}}, {{alert.message}} or {{alert.flair}}) is always treated as plain text — a function a viewer types into their cheer message is shown literally, never run.
Viewer Flair
Alerts from a viewer also carry their chat flair on your channel, as it was when the alert fired:
| Variable | Description |
|---|---|
{{alert.flair}} | The viewer's flair text, e.g. Warrior |
{{alert.flair_short}} | The flair's short text when it has one (e.g. WAR), otherwise the full flair |
These work for follows, cheers, Super Cheers, subs, resubs, gift subs, TTS and Soundboard purchases. They're empty when the viewer has no flair, and always empty for raids, tips and anonymous gifts or cheers.
Because a viewer without a flair gives an empty value, use || for a fallback: {{alert.flair || "Viewer"}}. Don't wrap the flair in square brackets: [like this] is TTS sound syntax and is removed from the display message.
Per-Event Variables
Each event type has its own specific fields under the alert. namespace. Fields that don't apply to the current event type resolve to an empty string.
Follow
| Variable | Description |
|---|---|
{{alert.name}} | Display name of the new follower |
{{alert.display_text}} | The fully-resolved display message for this alert |
Cheer (Bits)
| Variable | Description |
|---|---|
{{alert.name}} | Display name of the cheerer (or Anonymous) |
{{alert.bits}} | Number of bits cheered |
{{alert.message}} | The chat text the viewer attached to their cheer |
{{alert.is_anonymous}} | true or false — whether the cheer is anonymous |
{{alert.display_text}} | The fully-resolved display message for this alert |
New Subscription
| Variable | Description |
|---|---|
{{alert.name}} | Display name of the subscriber |
{{alert.tier}} | Subscription tier (1, 2, or 3) |
{{alert.display_text}} | The fully-resolved display message for this alert |
Recurring Subscription (Resub)
| Variable | Description |
|---|---|
{{alert.name}} | Display name of the subscriber |
{{alert.tier}} | Subscription tier (1, 2, or 3) |
{{alert.months}} | Months the viewer declared in their resub |
{{alert.streak_months}} | Consecutive months without a gap |
{{alert.cumulative_months}} | Lifetime months on the channel |
{{alert.duration_months}} | Multi-month sub duration (e.g. 3 for a 3-month gift sub) |
{{alert.message}} | The chat text the viewer attached to their resub |
{{alert.display_text}} | The fully-resolved display message for this alert |
Gifted Subscription
| Variable | Description |
|---|---|
{{alert.name}} | Display name of the gifter (or Anonymous) |
{{alert.tier}} | Subscription tier (1, 2, or 3) |
{{alert.quantity}} | Number of subs gifted (single-recipient gifts are 1) |
{{alert.recipient}} | Recipient display name (empty for bulk gifts) |
{{alert.is_anonymous}} | true or false — whether the gift is anonymous |
{{alert.display_text}} | The fully-resolved display message for this alert |
Raid
| Variable | Description |
|---|---|
{{alert.name}} | Display name of the raiding broadcaster |
{{alert.viewers}} | Number of viewers in the raid |
{{alert.display_text}} | The fully-resolved display message for this alert |