Skip to main content

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.

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

VariableDescription
{{alert.name}}Display name of the new follower
{{alert.display_text}}The fully-resolved display message for this alert

Cheer (Bits)

VariableDescription
{{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

VariableDescription
{{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)

VariableDescription
{{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

VariableDescription
{{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

VariableDescription
{{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

User Data Variables

These variables are available on all event types and provide additional context about the user who triggered the alert. They are populated from the user's Avatar profile for the current channel.

If the user has no Avatar account or the event is anonymous, these resolve to empty strings (for text) or 0 (for numbers).

VariableDescriptionExample
{{flair}}User's flair text in this channelVIP
{{team_name}}User's team nameTeam Alpha
{{team_icon}}URL of the user's team icon
{{profile_image}}URL of the user's Twitch profile image
{{points}}User's loyalty points in this channel1500

User Variables

Streamers can define custom per-user variables. These are accessible in alert templates using the {{var:variable_name}} syntax, where variable_name is the name of the variable the streamer has defined.

VariableDescriptionExample
{{var:score}}Custom variable named "score"42
{{var:rank}}Custom variable named "rank"Gold

User variables are dynamic — the available variable names depend on what the streamer has configured. If a variable doesn't exist for the user, it resolves to an empty string.

Example

A follow alert message template like:

{{alert.name}} just followed! They're on {{team_name}} with {{var:score}} points!

Would render as:

CoolViewer123 just followed! They're on Team Alpha with 42 points!

Custom Alert Box Widgets

When using Custom Alert Box widgets, the user data fields are also available to child widgets via the data provider. Child widgets can reference them directly (e.g. an image widget bound to profile_image to display the user's avatar).

User variables are exposed in the data provider with a var_ prefix (e.g. a variable named score becomes var_score).

Additional data provider fields available (not usable in text templates due to being complex objects):

  • achievements — Array of the user's earned achievements (each with name, icon, config)
  • team_accent — Team accent color configuration
  • flair_config — Flair styling configuration