goals - YoYoGames/GMEXT-Twitch GitHub Wiki
These are the functions of this module:
Twitch Endpoint: Get Creator Goals
This function gets the broadcaster's list of active goals. Use this endpoint to get the current progress of each goal.
Instead of polling for the progress of a goal, consider subscribing to receive notifications when a goal makes progress using the channel.goal.progress subscription type. Read More
Note
Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_CHANNEL_READ_GOALS
.
This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.
Syntax:
twitch_goals_get_creator_goals(broadcaster_id, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
broadcaster_id | String | The ID of the broadcaster that created the goals. This ID must match the user ID in the user access token. |
callback_success | Function | Triggered if the request succeeded |
callback_failed | Function | Triggered if the request failed |
Returns:
N/A
Triggers:
These members are returned in the success callback:
Member | Type | Description |
---|---|---|
data | Array | The list of goals. The list is empty if the broadcaster hasn't created goals. |
├── id | String | An ID that identifies this goal. |
├── broadcaster_id | String | An ID that identifies the broadcaster that created the goal. |
├── broadcaster_name | String | The broadcaster's display name. |
├── broadcaster_login | String | The broadcaster's login name. |
├── type | String | The type of goal. Possible values are: "follower" - The goal is to increase followers. "subscription" - The goal is to increase subscriptions. This type shows the net increase or decrease in tier points associated with the subscriptions. "subscription_count" - The goal is to increase subscriptions. This type shows the net increase or decrease in the number of subscriptions."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). |
├── description | String | A description of the goal. Is an empty string if not specified. |
├── current_amount | Real | The goal's current value. The goal's type determines how this value is increased or decreased. If type is "follower" , 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. |
├── target_amount | Real | 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. |
└── created_at | String | The UTC date and time (in RFC3339 format) that the broadcaster created the goal. |
This method is triggered on failure.