Skip to content

Variables

A variable is a {name} placeholder in a step's text, such as @{user} clipped it! {clip_url}. When the macro runs, CroStream swaps each placeholder for its value. Values come from three places: the event that started the run, a few that every run has, and the outputs of earlier steps. This page lists all of them. How to use them is explained in Macros.

How placeholders work

You write You get
{user} The value of user.
{args|url} The value made safe to put inside a web address (spaces and symbols encoded).
{message|json} The value made safe to put inside a JSON string: quotes, backslashes and line breaks are escaped, and the quotes around it are not added.
{clip.clip_url} The output clip_url of the step whose ID is clip.
{clip.twitch.clip_url} The output of that step from one provider only (here Twitch).
{nothing_here} An unknown name is left exactly as written.

Names are lowercase. A variable that exists but is empty (a sub with no message, {arg3} when the viewer typed two words) becomes nothing.

Event variables always win

A step's short output never replaces an event variable of the same name. In a Gifted subs macro, {count} stays the number of subs even after a Change a counter step; use the step's own name, such as {deaths.count}, to get the counter. The same goes for {body} and {content_type} in a macro started by an incoming webhook: the request's win, so read a Send a webhook step's answer as {lights.body}.

JSON-safe values

When you write JSON by hand, a viewer's text can break it: a chat message with a quote in it ends your string early. Put the variable inside the quotes with the |json filter, and it is escaped for you:

{"text": "{message|json}", "viewers": {viewers}}

With the message He said "hi" that gives {"text": "He said \"hi\"", "viewers": 42}. Use it in the JSON box of a Send a webhook step with body json_raw, and in a webhook's JSON reply. The json body of the same step (JSON fields) escapes text for you, so it needs no filter. The filter leaves <, > and & as they are.

Every run

Variable Meaning
{rule} The name of the trigger that started the run (the macro's name when you press Run).
{user_role} The role of whoever caused the run: everyone, subscriber, vip, moderator or broadcaster. everyone when nobody did (a timer, the stream going live).
{detail} A short description of what fired the trigger, such as the chat message or the combination pressed. Not every event sets it.

When you press Run on a macro or Test on a trigger, the run is attributed to you: {user} is your Twitch login name (test while you aren't logged in) and {user_role} is broadcaster.

From events

Which events provide each variable. Click an event for its full list.

Variable Meaning Events
{user} The display name of the person who caused the event. Chat command, Channel point redemption, Follow, Subscription, Gifted subs, Cheer or power-up, Raid, Built-in channel point reward, Queue release, First-time chatter, Returning chatter
{user_login} Their lowercase Twitch login name. Use it for actions that take a user, such as Time out a user. Chat command, Channel point redemption, Follow, Subscription, Gifted subs, Cheer or power-up, Raid, Built-in channel point reward, Queue release, First-time chatter, Returning chatter
{user_id} Their Twitch user ID, a number. Chat command, Channel point redemption, Follow, Subscription, Gifted subs, Cheer or power-up, Raid, Built-in channel point reward, Queue release, First-time chatter, Returning chatter
{appid} The game's Steam app ID. A Steam game starts, A Steam game stops, A screenshot is taken
{arg1} 1st word after the command. Chat command
{arg2} 2nd word after the command. Chat command
{arg3} 3rd word after the command. Chat command
{arg4} 4th word after the command. Chat command
{arg5} 5th word after the command. Chat command
{arg6} 6th word after the command. Chat command
{arg7} 7th word after the command. Chat command
{arg8} 8th word after the command. Chat command
{arg9} 9th word after the command. Chat command
{args} Text after the command. Chat command
{automatic} true for a scheduled break, false for one started by hand. Ad break
{body} The request body as text, at most 64 KiB. A webhook is received
{bits} Bits spent. Cheer or power-up
{category} The category (game) name. Title or category change
{content_type} The request's Content-Type header. A webhook is received
{cost} Depends on the event: Channel point redemption: Channel points the reward cost.
Built-in channel point reward: Channel points spent.
{count} Depends on the event: Gifted subs: Subs in this gift.
On a timer: How many times this timer has fired since it started.
{days_away} Days since they were last seen. First-time chatter, Returning chatter
{duration} Length of the break in seconds. Ad break
{emote} The unlocked emote, for emote rewards. Built-in channel point reward
{every} The interval, for example 10m. On a timer
{game} The game's name. A Steam game starts, A Steam game stops, A screenshot is taken
{gifter} Who gifted the sub, for gifted subs. Subscription
{goal} Points needed for the next level. Hype train
{header.<name>} A request header, name in lowercase, such as {header.user-agent}. Credentials and the signature header are left out. A webhook is received
{hook} The webhook's name. A webhook is received
{input} Text the viewer entered, if the reward asks for it. Channel point redemption
{keys} The combination pressed. Hotkey
{kind} cheer, power_up or custom_power_up. Cheer or power-up
{language} The broadcast language. Title or category change
{level} The train's level. Hype train
{message} Depends on the event: Subscription: The resub message, if any.
Cheer or power-up: The cheer message, if any.
Built-in channel point reward: The viewer's message, for message rewards.
First-time chatter: The chat message.
Returning chatter: The chat message.
{messages} Chat messages they had written before. First-time chatter, Returning chatter
{method} The HTTP method, such as POST. A webhook is received
{months} Cumulative months subscribed. Subscription
{playtime_hours} Your total hours in the game, with one decimal. A Steam game starts, A Steam game stops
{points} Their points. First-time chatter, Returning chatter
{power_up} The power-up's type or custom title. Cheer or power-up
{progress} Points toward the next level. Hype train
{query.<name>} A query string parameter of the address, such as {query.scene} for ?scene=intro. A webhook is received
{queue} The name of the queue. Queue release
{queue_item_id} The item's ID. Queue release
{queue_remaining} How many items are still waiting after this one. Queue release
{queued_at} The time of day the item was added, like 14:05:09. Queue release
{remote} The IP address the request came from. A webhook is received
{reward} Depends on the event: Channel point redemption: Title of the reward.
Built-in channel point reward: The reward type, such as send_highlighted_message.
{reward_id} ID of the reward. Channel point redemption
{screenshot_path} The screenshot file on this computer. A screenshot is taken
{session_minutes} How long you played this time, in minutes. A Steam game stops
{status} Depends on the event: Poll ended: completed, or terminated when ended early.
Prediction ended: resolved or canceled.
{streak} Consecutive months, if the viewer shared it. Subscription
{stream_type} live, playlist, watch_party, premiere or rerun (when going online). Stream online/offline
{streams} Streams they were in before this one. First-time chatter, Returning chatter
{tier} Depends on the event: Subscription: 1, 2 or 3. A Prime sub is 1.
Gifted subs: 1, 2 or 3.
{title} Depends on the event: Title or category change: The stream title.
Poll ended: The poll question.
Prediction ended: The prediction.
{total} Depends on the event: Gifted subs: The gifter's lifetime gifts in the channel, when Twitch shares it.
Hype train: Points contributed so far.
{train_type} regular, golden_kappa or treasure. Hype train
{viewers} Viewers brought by the raid. Raid
{votes} Votes for the winning choice. Poll ended
{waited} How long the item waited, like 45s, 1m 20s or 2h 3m. Queue release
{waited_seconds} How long the item waited, in whole seconds. Queue release
{watch_time} Time they had watched before, such as 12h 5m. First-time chatter, Returning chatter
{winner} Depends on the event: Poll ended: The winning choice; ties are joined with " / ".
Prediction ended: The winning outcome; empty when canceled.

A Queue release also gives one variable per field you declared on the queue, named after the field. A webhook is received gives one for each row of the webhook's Variables panel.

From earlier steps

Steps that report something back make it available to the steps after them. Each output can be written three ways, shown here for a Clip step with the ID clip:

Form Example Notes
{step.provider.output} {clip.twitch.clip_url} Always set when that provider ran the step.
{step.output} {clip.clip_url} From the first provider that succeeded, in the order Twitch, OBS Studio, Steam, Discord, Queues, Tools, Viewers, Overlays.
{output} {clip_url} Like {step.output}, but a later step with the same output replaces it, and it never replaces an event variable.

Use the longer forms when two steps report the same output, or when a step runs on more than one provider. The step ID is the Step ID box on the step's card.

Output Meaning Reported by
{account_age} How old the account is, for example 3 years. Look up viewer
{account_created} Day the account was created (YYYY-MM-DD). Look up viewer
{ad_length} How long the ad runs, in seconds. Run ad
{amount} The amount each of them got. Give points to everyone watching
{appid} The game's Steam app ID. Look up a Steam game, Launch a Steam game
{avatar_url} Link to the user's profile picture. Look up viewer
{bits} Bits cheered. Look up a viewer
{body} The answer's body as text (at most 64 KiB). Send a webhook
{broadcaster_type} partner, affiliate, or empty. Look up viewer
{category} Name of the category that was set. Set category
{change} How much the balance changed, such as +5 or -20. Change points
{channel_category} Your current category (game). Get stream info
{channel_language} Your stream language as a two-letter code, for example en. Get stream info
{channel_tags} Your tags, separated by commas. Get stream info
{channel_title} Your current stream title. Get stream info
{chapter_name} The name given to the chapter. Marker (OBS Studio)
{choice} The option that was picked. Pick at random
{choice_number} Its position in the list, starting at 1. Pick at random
{clip_id} ID of the new clip. Clip (Twitch)
{clip_url} Public URL of the new clip. Clip (Twitch)
{content_type} The answer's content type, such as application/json. Send a webhook
{count} Depends on the action: Change a counter: The counter's value after this step.
Give points to everyone watching: How many viewers got the points.
Top viewers: How many viewers are listed.
{currency} What the points are called. Look up a viewer
{description} The user's profile text. Look up viewer
{filter_enabled} true or false: whether the filter is on afterward. Turn an OBS filter on or off
{first} The display name of the viewer in first place. Top viewers
{first_seen} The day they were first seen, as YYYY-MM-DD. Look up a viewer
{follow_age} How long they have followed, such as 1 year, 3 months or 12 days; empty when not following. Look up a viewer
{followage} How long the user has followed you, for example 1 year 2 months. Empty if not following. Look up viewer
{followed_at} The day they followed, as YYYY-MM-DD; empty when unknown. Look up a viewer
{following} true when they follow the channel, else false. Look up a viewer
{follows_since} Day the user followed you (YYYY-MM-DD), or "not following". Look up viewer
{from_points} The giver's balance after the gift. Give points to another viewer
{game} The game's name. Look up a Steam game, Launch a Steam game
{gifted} Subs gifted. Look up a viewer
{known} true when the viewer is in the database, else false. Look up a viewer
{last_game} The category the user last streamed, if any. Look up viewer
{last_played} The day you last played it, as YYYY-MM-DD; empty when never. Look up a Steam game
{last_title} The title of the user's last stream, if any. Look up viewer
{list} The ranking as one line, rows joined by the separator. Top viewers
{login} The viewer's login name. Look up a viewer
{lookup_id} The user's Twitch ID. Look up viewer
{lookup_login} The user's login name, in lowercase. Look up viewer
{lookup_user} The user's display name. Look up viewer
{marker_position} Where the marker is in the VOD, in seconds from its start. Marker (Twitch)
{messages} Chat messages written. Look up a viewer
{muted} true or false: whether the source is muted afterward. Mute or unmute an OBS audio source
{name} The viewer's display name. Look up a viewer
{next_ad_at} When the next ad is due (UTC, YYYY-MM-DD HH:MM). Snooze next ad
{output_active} true or false: whether it is running afterward. Control the OBS replay buffer, Control the OBS stream, Control the OBS virtual camera
{path} The file that was written. Write to a text file
{playtime_2wks_hours} Your hours in the game over the last two weeks, with one decimal. Look up a Steam game
{playtime_hours} Your total hours in the game, with one decimal. Look up a Steam game
{points} Depends on the action: Look up a viewer: Their points.
Change points: The viewer's balance after the change.
{poll_id} ID of the new poll; give it to "End poll" to end this one. Start poll
{prediction_id} ID of the new prediction. Start prediction
{queue_dropped} How many items were thrown away. Clear queue
{queue_item_id} The new item's ID. Add to queue
{queue_position} Where the item stands in line, starting at 1. Add to queue
{queue_released} How many items were released. Release next now
{queue_waiting} How many items are waiting, including this one. Add to queue
{rank} Their place by points, 1 is the richest; 0 when unranked. Look up a viewer
{record_path} Path of the finished recording, when the recording was stopped. Control the OBS recording
{remaining} Seconds left on a countdown (rounded up), or seconds counted by a stopwatch, after the action. Control a timer
{replay_path} Path of the saved replay file. Clip (OBS Studio)
{response} The start of the server's answer, as text (first 4 KB). Send a web request
{result} The label of the slice the wheel stopped on. Spin the wheel
{result_index} That slice's number, counting from 1 in the order of the wheel's list. Spin the wheel
{retry_after} Seconds until another ad can be started. Run ad
{reward_id} ID of the new reward. Create reward
{running} true while the timer runs, else false. Control a timer
{screenshot_path} Where the picture was saved, on the computer running OBS. Save a screenshot of an OBS source
{shoutout_user} Display name of the channel that got the shoutout. Shout out a channel
{snooze_count} How many snoozes you have left. Snooze next ad
{source_locked} true or false: whether the source is locked afterward. Lock or unlock an OBS source
{source_visible} true or false after a toggle. Show or hide an OBS source
{status} Depends on the action: Post to Discord: The HTTP status code Discord answered with.
Send a web request: The HTTP status code the server answered with.
{streams} How many streams they watched or chatted in. Look up a viewer
{studio_mode} true or false: whether studio mode is on afterward. Turn OBS studio mode on or off
{sub_months} Months subscribed, the highest count seen. Look up a viewer
{to} The receiver's display name. Give points to another viewer
{to_points} The receiver's balance after the gift. Give points to another viewer
{value} The value that was set. Set a value
{vendor_response} The plugin's answer, as JSON text. Send a request to an OBS plugin
{viewer} The viewer's display name. Change points
{watch_minutes} Minutes watched, as a number. Look up a viewer
{watch_time} Time watched, such as 12h 5m or 45m. Look up a viewer

Set a value has an output called value: give the step an ID such as greeting and later steps read it as {greeting.value}.