Goal

Events raised as a broadcaster's creator goal starts, progresses and ends.

View as markdown
Provide feedback for this page

Goal Begin

Notifies the subscriber when a goal begins on the specified broadcaster's channel. A goal begins when the broadcaster or one of the channel's editors creates it, or when Twitch starts one automatically. For example, when the stream ends, an achieved goal that's set to renew automatically is replaced by a new goal of the same type with a new target.

Note

It's possible to receive the Begin event after receiving Progress events.

Subscription

Type
channel.goal.begin
Version
1

Authorization

Requires one of the following:

  • A user access token that includes the channel:read:goals scope.
  • An app access token.The application, through prior authorization, must have been granted:
    • The channel:read:goals scope for the user represented by the broadcaster_user_id event condition.

Subscription Request Body

  • typeStringRequired
    The subscription type name: channel.goal.begin.
  • versionStringRequired
    The subscription type version: 1.
  • conditionObjectRequired
    Set the Condition object's broadcaster_user_id field to the ID of the broadcaster whose goals you want to get notified about.
    Hide child attributesShow child attributes
    • condition.broadcaster_user_idStringRequired
      The ID of the broadcaster to get notified about. If you use a user access token, the ID must match the user ID in the token. If you use an app access token, the broadcaster must have authorized your app with the channel:read:goals scope.
  • transportObjectRequired
    Transport-specific parameters.
    Hide child attributesShow child attributes
    • transport.methodStringRequired
      The transport method for EventSub.

      Possible values

      • webhook
      • websocket
      • conduit
    • transport.callbackString

      The callback URL where notifications are sent. The URL must use the HTTPS protocol and port 443, and its host must resolve to a public IPv4 address. Hosts that resolve only to IPv6 addresses aren't supported. See Processing an Event.

      Required if method is webhook. Don't specify it for other methods.

      NOTE: Redirects are not followed.

    • transport.secretString

      The secret used to verify the signature. The secret must be an ASCII string that's a minimum of 10 characters long and a maximum of 100 characters long. For information about how the secret is used, see Verifying the event message.

      Required if method is webhook. Don't specify it for other methods.

    • transport.session_idString

      An ID that identifies the WebSocket to send notifications to. When you connect to EventSub using WebSockets, the server returns the ID in the Welcome message.

      Required if method is websocket. Don't specify it for other methods.

    • transport.conduit_idString

      An ID that identifies the conduit to send this notification to. When you create a conduit, the server returns the ID in the API response.

      Required if method is conduit. Don't specify it for other methods.

Event Payload

  • subscriptionObject
    Metadata about the subscription.
    Hide child attributesShow child attributes
    • subscription.idString
      The Subscription ID of the subscription.
    • subscription.typeString
      The notification's subscription type.
    • subscription.versionString
      The version of the subscription.
    • subscription.statusString
      The status of the subscription.
    • subscription.costInteger
      How much the subscription counts against your limit. See Subscription Limits for more information.
    • subscription.conditionObject
      Subscription-specific parameters.
      Hide child attributesShow child attributes
      • subscription.condition.broadcaster_user_idString
        The ID of the broadcaster to get notified about. If you use a user access token, the ID must match the user ID in the token. If you use an app access token, the broadcaster must have authorized your app with the channel:read:goals scope.
    • subscription.created_atString
      The UTC date and time (in RFC3339 format) of when the subscription was created.
    • subscription.transportObject
      The transport that the notification was sent over.
      Hide child attributesShow child attributes
      • subscription.transport.methodString
        The transport method.

        Possible values

        • webhook
        • websocket
        • conduit
      • subscription.transport.callbackString
        The callback URL where notifications are sent. Included only if method is webhook.
      • subscription.transport.session_idString
        The ID of the WebSocket session that notifications are sent to. Included only if method is websocket.
      • subscription.transport.conduit_idString
        The ID of the conduit that notifications are sent to. Included only if method is conduit.
  • eventObject
    The event information.
    Hide child attributesShow child attributes
    • event.idString
      An ID that identifies the goal. The channel.goal.progress and channel.goal.end events for this goal carry the same ID, and it matches the id that Get Creator Goals returns.
    • event.broadcaster_user_idString
      An ID that uniquely identifies the broadcaster.
    • event.broadcaster_user_nameString
      The broadcaster's display name.
    • event.broadcaster_user_loginString
      The broadcaster's user handle.
    • event.typeString
      The type of goal.

      Possible values

      • follow
        The goal is to increase followers.
      • subscription
        The goal is to increase subscriptions. This type shows the broadcaster's total tier points from subscriptions, which increase and decrease as users subscribe and unsubscribe.
      • subscription_count
        The goal is to increase subscriptions. This type shows the broadcaster's total number of subscriptions, which increases and decreases as users subscribe and unsubscribe.
      • new_subscription
        The goal is to increase subscriptions. This type shows only the net increase in tier points associated with the subscriptions (it does not account for users that unsubscribed since the goal started).
      • new_subscription_count
        The goal is to increase subscriptions. This type shows only the net increase in the number of subscriptions (it does not account for users that unsubscribed since the goal started).
      • new_bit
        The goal is to increase the amount of Bits used on the channel.
      • new_cheerer
        The goal is to increase the number of unique Cheerers to Cheer on the channel.
    • event.descriptionString
      A description of the goal. Is an empty string if not specified. The description may contain a maximum of 40 characters. Goals whose type is new_bit or new_cheerer don't have a description, so this field is always an empty string for them.
    • event.current_amountInteger

      The goal's current value.

      The goal's type determines how this value is increased or decreased.

      • If type is follow, this field is set to the broadcaster's current number of followers. This number increases with new followers and decreases when users unfollow the broadcaster.
      • If type is subscription, this field is increased and decreased by the points value associated with the subscription tier. For example, if a tier-two subscription is worth 2 points, this field is increased or decreased by 2, not 1.
      • If type is subscription_count, this field is increased by 1 for each new subscription and decreased by 1 for each user that unsubscribes.
      • If type is new_subscription, this field is increased by the points value associated with the subscription tier. For example, if a tier-two subscription is worth 2 points, this field is increased by 2, not 1.
      • If type is new_subscription_count, this field is increased by 1 for each new subscription.
      • If type is new_bit, this field is increased by the number of Bits used on the channel.
      • If type is new_cheerer, this field is increased by 1 the first time each user Cheers on the channel after the goal starts. Other ways of using Bits don't count.

      In the Begin event, this field is the goal's starting value: the broadcaster's current number of followers for follow goals, the channel's current subscription points or number of subscriptions for subscription and subscription_count goals, and 0 for new_subscription, new_subscription_count, new_bit and new_cheerer goals.

    • event.target_amountInteger
      The goal's target value. For example, if the broadcaster has 200 followers before creating the goal, and their goal is to double that number, this field is set to 400.
    • event.started_atString
      The UTC timestamp in RFC 3339 format, which indicates when the goal began.
Subscription Request Body Example
{
  "type": "channel.goal.begin",
  "version": "1",
  "condition": {
    "broadcaster_user_id": "141981764"
  },
  "transport": {
    "method": "webhook",
    "callback": "https://example.com/webhooks/callback",
    "secret": "s3cRe7"
  }
}
Event Payload Example
{
    "subscription": {
        "id": "f1c2a387-161a-49f9-a165-0f21d7a4e1c4",
        "status": "enabled",
        "type": "channel.goal.begin",
        "version": "1",
        "cost": 0,
        "condition": {
            "broadcaster_user_id": "141981764"
        },
        "transport": {
            "method": "webhook",
            "callback": "https://example.com/webhooks/callback"
        },
        "created_at": "2021-07-15T10:11:12.123Z"
    },
    "event": {
        "id": "1woowvbkiNv8BRxEWSqmQz6Zk92",
        "broadcaster_user_id": "141981764",
        "broadcaster_user_name": "TwitchDev",
        "broadcaster_user_login": "twitchdev",
        "type": "subscription",
        "description": "Help me get partner!",
        "current_amount": 100,
        "target_amount": 220,
        "started_at": "2021-07-15T17:16:03.17106713Z"
    }
}

Goal End

Notifies the subscriber when the specified broadcaster, or one of the broadcaster's editors, ends a goal.

Note

It's possible to receive Progress events after receiving the End event.

Subscription

Type
channel.goal.end
Version
1

Authorization

Requires one of the following:

  • A user access token that includes the channel:read:goals scope.
  • An app access token.The application, through prior authorization, must have been granted:
    • The channel:read:goals scope for the user represented by the broadcaster_user_id event condition.

Subscription Request Body

  • typeStringRequired
    The subscription type name: channel.goal.end.
  • versionStringRequired
    The subscription type version: 1.
  • conditionObjectRequired
    Set the Condition object's broadcaster_user_id field to the ID of the broadcaster whose goals you want to get notified about.
    Hide child attributesShow child attributes
    • condition.broadcaster_user_idStringRequired
      The ID of the broadcaster to get notified about. If you use a user access token, the ID must match the user ID in the token. If you use an app access token, the broadcaster must have authorized your app with the channel:read:goals scope.
  • transportObjectRequired
    Transport-specific parameters.
    Hide child attributesShow child attributes
    • transport.methodStringRequired
      The transport method for EventSub.

      Possible values

      • webhook
      • websocket
      • conduit
    • transport.callbackString

      The callback URL where notifications are sent. The URL must use the HTTPS protocol and port 443, and its host must resolve to a public IPv4 address. Hosts that resolve only to IPv6 addresses aren't supported. See Processing an Event.

      Required if method is webhook. Don't specify it for other methods.

      NOTE: Redirects are not followed.

    • transport.secretString

      The secret used to verify the signature. The secret must be an ASCII string that's a minimum of 10 characters long and a maximum of 100 characters long. For information about how the secret is used, see Verifying the event message.

      Required if method is webhook. Don't specify it for other methods.

    • transport.session_idString

      An ID that identifies the WebSocket to send notifications to. When you connect to EventSub using WebSockets, the server returns the ID in the Welcome message.

      Required if method is websocket. Don't specify it for other methods.

    • transport.conduit_idString

      An ID that identifies the conduit to send this notification to. When you create a conduit, the server returns the ID in the API response.

      Required if method is conduit. Don't specify it for other methods.

Event Payload

  • subscriptionObject
    Metadata about the subscription.
    Hide child attributesShow child attributes
    • subscription.idString
      The Subscription ID of the subscription.
    • subscription.typeString
      The notification's subscription type.
    • subscription.versionString
      The version of the subscription.
    • subscription.statusString
      The status of the subscription.
    • subscription.costInteger
      How much the subscription counts against your limit. See Subscription Limits for more information.
    • subscription.conditionObject
      Subscription-specific parameters.
      Hide child attributesShow child attributes
      • subscription.condition.broadcaster_user_idString
        The ID of the broadcaster to get notified about. If you use a user access token, the ID must match the user ID in the token. If you use an app access token, the broadcaster must have authorized your app with the channel:read:goals scope.
    • subscription.created_atString
      The UTC date and time (in RFC3339 format) of when the subscription was created.
    • subscription.transportObject
      The transport that the notification was sent over.
      Hide child attributesShow child attributes
      • subscription.transport.methodString
        The transport method.

        Possible values

        • webhook
        • websocket
        • conduit
      • subscription.transport.callbackString
        The callback URL where notifications are sent. Included only if method is webhook.
      • subscription.transport.session_idString
        The ID of the WebSocket session that notifications are sent to. Included only if method is websocket.
      • subscription.transport.conduit_idString
        The ID of the conduit that notifications are sent to. Included only if method is conduit.
  • eventObject
    The event information.
    Hide child attributesShow child attributes
    • event.idString
      An ID that identifies the goal. The channel.goal.begin and channel.goal.progress events for this goal carry the same ID, and it matches the id that Get Creator Goals returns.
    • event.broadcaster_user_idString
      An ID that uniquely identifies the broadcaster.
    • event.broadcaster_user_nameString
      The broadcaster's display name.
    • event.broadcaster_user_loginString
      The broadcaster's user handle.
    • event.typeString
      The type of goal.

      Possible values

      • follow
        The goal is to increase followers.
      • subscription
        The goal is to increase subscriptions. This type shows the broadcaster's total tier points from subscriptions, which increase and decrease as users subscribe and unsubscribe.
      • subscription_count
        The goal is to increase subscriptions. This type shows the broadcaster's total number of subscriptions, which increases and decreases as users subscribe and unsubscribe.
      • new_subscription
        The goal is to increase subscriptions. This type shows only the net increase in tier points associated with the subscriptions (it does not account for users that unsubscribed since the goal started).
      • new_subscription_count
        The goal is to increase subscriptions. This type shows only the net increase in the number of subscriptions (it does not account for users that unsubscribed since the goal started).
      • new_bit
        The goal is to increase the amount of Bits used on the channel.
      • new_cheerer
        The goal is to increase the number of unique Cheerers to Cheer on the channel.
    • event.descriptionString
      A description of the goal. Is an empty string if not specified. The description may contain a maximum of 40 characters. Goals whose type is new_bit or new_cheerer don't have a description, so this field is always an empty string for them.
    • event.is_achievedBoolean

      A Boolean value that indicates whether the broadcaster achieved their goal. Is true if current_amount was greater than or equal to target_amount when the goal ended; otherwise, false. For follow, subscription and subscription_count goals, this is false if unfollows or unsubscriptions brought current_amount back below target_amount before the goal ended.

      Only the channel.goal.end event includes this field.

    • event.current_amountInteger

      The goal's current value.

      The goal's type determines how this value is increased or decreased.

      • If type is follow, this field is set to the broadcaster's current number of followers. This number increases with new followers and decreases when users unfollow the broadcaster.
      • If type is subscription, this field starts at the broadcaster's current total of subscription points when the goal begins, and is increased and decreased by the points value associated with the subscription tier. For example, if a tier-two subscription is worth 2 points, this field is increased or decreased by 2, not 1.
      • If type is subscription_count, this field starts at the broadcaster's current number of subscriptions when the goal begins, and is increased by 1 for each new subscription and decreased by 1 for each user that unsubscribes.
      • If type is new_subscription, this field starts at 0 and is increased by the points value associated with the subscription tier. For example, if a tier-two subscription is worth 2 points, this field is increased by 2, not 1.
      • If type is new_subscription_count, this field starts at 0 and is increased by 1 for each new subscription.
      • If type is new_bit, this field starts at 0 and is increased by the number of Bits used on the channel.
      • If type is new_cheerer, this field starts at 0 and is increased by 1 the first time each user Cheers on the channel after the goal starts. Other ways of using Bits don't count.
    • event.target_amountInteger
      The goal's target value. For example, if the broadcaster has 200 followers before creating the goal, and their goal is to double that number, this field is set to 400.
    • event.started_atString
      The UTC timestamp in RFC 3339 format, which indicates when the broadcaster created the goal.
    • event.ended_atString

      The UTC timestamp in RFC 3339 format, which indicates when the broadcaster ended the goal.

      Only the channel.goal.end event includes this field.

Subscription Request Body Example
{
  "type": "channel.goal.end",
  "version": "1",
  "condition": {
    "broadcaster_user_id": "141981764"
  },
  "transport": {
    "method": "webhook",
    "callback": "https://example.com/webhooks/callback",
    "secret": "s3cRe7"
  }
}
Event Payload Example
{
    "subscription": {
        "id": "f1c2a387-161a-49f9-a165-0f21d7a4e1c4",
        "status": "enabled",
        "type": "channel.goal.end",
        "version": "1",
        "cost": 0,
        "condition": {
            "broadcaster_user_id": "141981764"
        },
        "transport": {
            "method": "webhook",
            "callback": "https://example.com/webhooks/callback"
        },
        "created_at": "2021-07-15T10:11:12.123Z"
    },
    "event": {
        "id": "1woowvbkiNv8BRxEWSqmQz6Zk92",
        "broadcaster_user_id": "141981764",
        "broadcaster_user_name": "TwitchDev",
        "broadcaster_user_login": "twitchdev",
        "type": "subscription",
        "description": "Help me get partner!",
        "is_achieved": false,
        "current_amount": 180,
        "target_amount": 220,
        "started_at": "2021-07-15T17:16:03.17106713Z",
        "ended_at": "2021-07-16T17:16:03.17106713Z"
    }
}

Goal Progress

Notifies the subscriber when the specified broadcaster's goal is updated. Most updates report progress, which could be positive (added followers) or negative (lost followers). You also get this notification when the broadcaster or one of their editors changes the goal (for example, its description or target amount) and when they end the goal, so a notification doesn't always mean that current_amount changed.

Note

It's possible to receive Progress events before receiving the Begin event.

Note

When the broadcaster or one of their editors ends a goal, you receive a Progress event as well as the End event, in either order.

Note

The broadcaster can have more than one active goal at a time, for example a follower goal, a subscription goal, and a Bits goal. You receive Progress events for each of them, so use the event's id field, which identifies the goal, to tell which goal an event is for.

Subscription

Type
channel.goal.progress
Version
1

Authorization

Requires one of the following:

  • A user access token that includes the channel:read:goals scope.
  • An app access token.The application, through prior authorization, must have been granted:
    • The channel:read:goals scope for the user represented by the broadcaster_user_id event condition.

Subscription Request Body

  • typeStringRequired
    The subscription type name: channel.goal.progress.
  • versionStringRequired
    The subscription type version: 1.
  • conditionObjectRequired
    Set the Condition object's broadcaster_user_id field to the ID of the broadcaster whose goals you want to get notified about.
    Hide child attributesShow child attributes
    • condition.broadcaster_user_idStringRequired
      The ID of the broadcaster to get notified about. If you use a user access token, the ID must match the user ID in the token. If you use an app access token, the broadcaster must have authorized your app with the channel:read:goals scope.
  • transportObjectRequired
    Transport-specific parameters.
    Hide child attributesShow child attributes
    • transport.methodStringRequired
      The transport method for EventSub.

      Possible values

      • webhook
      • websocket
      • conduit
    • transport.callbackString

      The callback URL where notifications are sent. The URL must use the HTTPS protocol and port 443, and its host must resolve to a public IPv4 address. Hosts that resolve only to IPv6 addresses aren't supported. See Processing an Event.

      Required if method is webhook. Don't specify it for other methods.

      NOTE: Redirects are not followed.

    • transport.secretString

      The secret used to verify the signature. The secret must be an ASCII string that's a minimum of 10 characters long and a maximum of 100 characters long. For information about how the secret is used, see Verifying the event message.

      Required if method is webhook. Don't specify it for other methods.

    • transport.session_idString

      An ID that identifies the WebSocket to send notifications to. When you connect to EventSub using WebSockets, the server returns the ID in the Welcome message.

      Required if method is websocket. Don't specify it for other methods.

    • transport.conduit_idString

      An ID that identifies the conduit to send this notification to. When you create a conduit, the server returns the ID in the API response.

      Required if method is conduit. Don't specify it for other methods.

Event Payload

  • subscriptionObject
    Metadata about the subscription.
    Hide child attributesShow child attributes
    • subscription.idString
      The Subscription ID of the subscription.
    • subscription.typeString
      The notification's subscription type.
    • subscription.versionString
      The version of the subscription.
    • subscription.statusString
      The status of the subscription.
    • subscription.costInteger
      How much the subscription counts against your limit. See Subscription Limits for more information.
    • subscription.conditionObject
      Subscription-specific parameters.
      Hide child attributesShow child attributes
      • subscription.condition.broadcaster_user_idString
        The ID of the broadcaster to get notified about. If you use a user access token, the ID must match the user ID in the token. If you use an app access token, the broadcaster must have authorized your app with the channel:read:goals scope.
    • subscription.created_atString
      The UTC date and time (in RFC3339 format) of when the subscription was created.
    • subscription.transportObject
      The transport that the notification was sent over.
      Hide child attributesShow child attributes
      • subscription.transport.methodString
        The transport method.

        Possible values

        • webhook
        • websocket
        • conduit
      • subscription.transport.callbackString
        The callback URL where notifications are sent. Included only if method is webhook.
      • subscription.transport.session_idString
        The ID of the WebSocket session that notifications are sent to. Included only if method is websocket.
      • subscription.transport.conduit_idString
        The ID of the conduit that notifications are sent to. Included only if method is conduit.
  • eventObject
    The event information.
    Hide child attributesShow child attributes
    • event.idString
      An ID that identifies the goal. Every channel.goal.begin, channel.goal.progress and channel.goal.end notification for the goal has the same ID, which is also the id that Get Creator Goals returns. To identify an individual notification, use the notification's message ID.
    • event.broadcaster_user_idString
      An ID that uniquely identifies the broadcaster.
    • event.broadcaster_user_nameString
      The broadcaster's display name.
    • event.broadcaster_user_loginString
      The broadcaster's user handle.
    • event.typeString
      The type of goal.

      Possible values

      • follow
        The goal is to increase followers.
      • subscription
        The goal is to increase subscriptions. This type shows the broadcaster's total tier points from subscriptions, which increase and decrease as users subscribe and unsubscribe.
      • subscription_count
        The goal is to increase subscriptions. This type shows the broadcaster's total number of subscriptions, which increases and decreases as users subscribe and unsubscribe.
      • new_subscription
        The goal is to increase subscriptions. This type shows only the net increase in tier points associated with the subscriptions (it does not account for users that unsubscribed since the goal started).
      • new_subscription_count
        The goal is to increase subscriptions. This type shows only the net increase in the number of subscriptions (it does not account for users that unsubscribed since the goal started).
      • new_bit
        The goal is to increase the amount of Bits used on the channel.
      • new_cheerer
        The goal is to increase the number of unique Cheerers to Cheer on the channel.
    • event.descriptionString
      A description of the goal. Is an empty string if not specified. The description may contain a maximum of 40 characters. Goals whose type is new_bit or new_cheerer don't have a description, so this field is always an empty string for them.
    • event.current_amountInteger

      The goal's current value.

      The goal's type determines how this value is increased or decreased.

      • If type is follow, this field is set to the broadcaster's current number of followers. This number increases with new followers and decreases when users unfollow the broadcaster.
      • If type is subscription, this field starts at the broadcaster's current total of subscription points when the goal begins, and is increased and decreased by the points value associated with the subscription tier. For example, if a tier-two subscription is worth 2 points, this field is increased or decreased by 2, not 1.
      • If type is subscription_count, this field starts at the broadcaster's current number of subscriptions when the goal begins, and is increased by 1 for each new subscription and decreased by 1 for each user that unsubscribes.
      • If type is new_subscription, this field starts at 0 and is increased by the points value associated with the subscription tier. For example, if a tier-two subscription is worth 2 points, this field is increased by 2, not 1.
      • If type is new_subscription_count, this field starts at 0 and is increased by 1 for each new subscription.
      • If type is new_bit, this field starts at 0 and is increased by the number of Bits used on the channel.
      • If type is new_cheerer, this field starts at 0 and is increased by 1 the first time each user Cheers on the channel after the goal starts. Other ways of using Bits don't count.

      If the broadcaster resets the goal's progress, this field is set to 0.

    • event.target_amountInteger
      The goal's target value. For example, if the broadcaster has 200 followers before creating the goal, and their goal is to double that number, this field is set to 400.
    • event.started_atString
      The UTC timestamp in RFC 3339 format, which indicates when the broadcaster created the goal.
Subscription Request Body Example
{
  "type": "channel.goal.progress",
  "version": "1",
  "condition": {
    "broadcaster_user_id": "141981764"
  },
  "transport": {
    "method": "webhook",
    "callback": "https://example.com/webhooks/callback",
    "secret": "s3cRe7"
  }
}
Event Payload Example
{
    "subscription": {
        "id": "f1c2a387-161a-49f9-a165-0f21d7a4e1c4",
        "status": "enabled",
        "type": "channel.goal.progress",
        "version": "1",
        "cost": 0,
        "condition": {
            "broadcaster_user_id": "141981764"
        },
        "transport": {
            "method": "webhook",
            "callback": "https://example.com/webhooks/callback"
        },
        "created_at": "2021-07-15T10:11:12.123Z"
    },
    "event": {
        "id": "1woowvbkiNv8BRxEWSqmQz6Zk92",
        "broadcaster_user_id": "141981764",
        "broadcaster_user_name": "TwitchDev",
        "broadcaster_user_login": "twitchdev",
        "type": "subscription",
        "description": "Help me get partner!",
        "current_amount": 120,
        "target_amount": 220,
        "started_at": "2021-07-15T17:16:03.17106713Z"
    }
}