Skip to content

Activity

Activity variables expose the activity that triggered the command. They only resolve when the command runs from an activity trigger.

If the same response runs from a chat message trigger, activity variables are left unchanged.

Command scripts use the same field names on ctx.activity. For example, {activity.viewer_display_name} in a response is ctx.activity.viewer_display_name in a script.

{activity.viewer_display_name} triggered {activity.type_display_name}.
Value: {activity.amount} {activity.count_name}
Message: {activity.message}

For a Twitch resub activity, this can produce:

TestUser triggered Resub.
Value: 12 months
Message: Great stream!
FieldUseExample
viewer_display_nameDisplay name of the viewer who triggered the activity.TestUser
viewer_nameViewer username/login.testuser
type_display_nameReadable activity type name.Resub
typeRaw activity type.resub
sub_type_display_nameReadable subtype when the activity has one.T1
sub_typeRaw subtype.1000
countRaw number from the activity.12
amountDisplay value. Includes currency when the activity has one.12.34 USD
count_nameCount unit.months
messageUser-entered activity message when available.Great stream!
system_messagePlatform-generated message when available.TestUser subscribed
recipient_display_nameFirst gift recipient display name when available.GiftReceiver
providerProvider that created the activity.twitch
provider_message_idProvider message ID.abc-123
created_atActivity time as an ISO timestamp.2026-07-02T20:15:30+00:00

Use a field in a command response like this:

{activity.viewer_display_name}

Use the same field in a command script like this:

ctx.activity.viewer_display_name

Use count when you need the raw number. Use amount when you want the value formatted for chat.

For example, a donation stored as 1234 with two decimal places becomes:

Raw: {activity.count}
Amount: {activity.amount}
Raw: 1234
Amount: 12.34 USD