channel_points - YoYoGames/GMEXT-Twitch GitHub Wiki

Channel Points

Functions

These are the functions of this module:



Back To Top

twitch_channel_points_create_custom_rewards

Twitch Endpoint: Create Custom Rewards

This function creates a Custom Reward in the broadcaster's channel. The maximum number of custom rewards per channel is 50, which includes both enabled and disabled rewards.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_CHANNEL_MANAGE_REDEMPTIONS.

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_channel_points_create_custom_rewards(broadcaster_id, title, cost, optionals, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster to add the custom reward to. This ID must match the user ID found in the OAuth token.
title String The custom reward's title. The title may contain a maximum of 45 characters and it must be unique amongst all of the broadcaster's custom rewards.
cost Int64 The cost of the reward, in Channel Points. The minimum is 1 point.
optionals Struct The optional parameters to be passed into the function:

- prompt : String : The prompt shown to the viewer when they redeem the reward. Specify a prompt if is_user_input_required is true. The prompt is limited to a maximum of 200 characters.
- is_enabled : Boolean : A Boolean value that determines whether the reward is enabled. Viewers see only enabled rewards. The default is true.
- background_color : String : The background color to use for the reward. Specify the color using Hex format (for example, "#9147FF").
- is_user_input_required : Boolean : A Boolean value that determines whether the user needs to enter information when redeeming the reward. See the prompt field. The default is false.
- is_max_per_stream_enabled : Boolean : A Boolean value that determines whether to limit the maximum number of redemptions allowed per live stream (see the max_per_stream field). The default is false.
- max_per_stream : Real : The maximum number of redemptions allowed per live stream. Applied only if is_max_per_stream_enabled is true. The minimum value is 1.
- is_max_per_user_per_stream_enabled : Boolean : A Boolean value that determines whether to limit the maximum number of redemptions allowed per user per stream (see the max_per_user_per_stream field). The default is false.
- max_per_user_per_stream : Real : The maximum number of redemptions allowed per user per stream. Applied only if is_max_per_user_per_stream_enabled is true. The minimum value is 1.
- is_global_cooldown_enabled : Boolean : A Boolean value that determines whether to apply a cooldown period between redemptions (see the global_cooldown_seconds field for the duration of the cooldown period). The default is false.
- global_cooldown_seconds : Real : The cooldown period, in seconds. Applied only if the is_global_cooldown_enabled field is true. The minimum value is 1; however, the minimum value is 60 for it to be shown in the Twitch UX.
- should_redemptions_skip_request_queue : Boolean : A Boolean value that determines whether redemptions should be set to "FULFILLED" status immediately when a reward is redeemed. If false, status is set to "UNFULFILLED" and follows the normal request queue process. The default is false.
callback_success Function Triggered if request succeeded
callback_failed Function Triggered if request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array A list that contains the single custom reward you created.
 ├── broadcaster_id String The ID that uniquely identifies the broadcaster.
 ├── broadcaster_login String The broadcaster's login name.
 ├── broadcaster_name String The broadcaster's display name.
 ├── id String The ID that uniquely identifies this custom reward.
 ├── title String The title of the reward.
 ├── prompt String The prompt shown to the viewer when they redeem the reward if user input is required (see the is_user_input_required field).
 ├── cost Real The cost of the reward in Channel Points.
 ├── image Struct A set of custom images for the reward. This field is set to undefined if the broadcaster didn't upload images.
         ├── url_1x String The URL to a small version of the image.
         ├── url_2x String The URL to a medium version of the image.
         └── url_4x String The URL to a large version of the image.
 ├── default_image Struct A set of default images for the reward.
         ├── url_1x String The URL to a small version of the image.
         ├── url_2x String The URL to a medium version of the image.
         └── url_4x String The URL to a large version of the image.
 ├── background_color String The background color to use for the reward. The color is in Hex format (for example, "#00E5CB").
 ├── is_enabled Boolean A Boolean value that determines whether the reward is enabled. Is true if enabled; otherwise, false. Disabled rewards aren't shown to the user.
 ├── is_user_input_required Boolean A Boolean value that determines whether the user must enter information when redeeming the reward. Is true if the reward requires user input.
 ├── max_per_stream_setting Struct The settings used to determine whether to apply a maximum to the number to the redemptions allowed per live stream.
         ├── is_enabled Boolean A Boolean value that determines whether the reward applies a limit on the number of redemptions allowed per live stream. Is true if the reward applies a limit.
         └── max_per_stream Int64 The maximum number of redemptions allowed per live stream.
 ├── max_per_user_per_stream_setting Struct The settings used to determine whether to apply a maximum to the number of redemptions allowed per user per live stream.
         ├── is_enabled Boolean A Boolean value that determines whether the reward applies a limit on the number of redemptions allowed per user per live stream. Is true if the reward applies a limit.
         └── max_per_user_per_stream Int64 The maximum number of redemptions allowed per user per live stream.
 ├── global_cooldown_setting Struct The settings used to determine whether to apply a cooldown period between redemptions and the length of the cooldown.
         ├── is_enabled Boolean A Boolean value that determines whether to apply a cooldown period. Is true if a cooldown period is enabled.
         └── global_cooldown_seconds Int64 The cooldown period, in seconds.
 ├── is_paused Boolean A Boolean value that determines whether the reward is currently paused. Is true if the reward is paused. Viewers can't redeem paused rewards.
 ├── is_in_stock Boolean A Boolean value that determines whether the reward is currently in stock. Is true if the reward is in stock. Viewers can't redeem out of stock rewards.
 ├── should_redemptions_skip_request_queue Boolean A Boolean value that determines whether redemptions should be set to "FULFILLED" status immediately when a reward is redeemed. If false, status is "UNFULFILLED" and follows the normal request queue process.
 ├── redemptions_redeemed_current_stream Real The number of redemptions redeemed during the current live stream. The number counts against the max_per_stream_setting limit. This field is undefined if the broadcaster's stream isn't live or max_per_stream_setting isn't enabled.
 └── cooldown_expires_at String The timestamp of when the cooldown period expires. Is undefined if the reward isn't in a cooldown state (see the global_cooldown_setting field).

Failure Callback

This method is triggered on failure.




Back To Top

twitch_channel_points_delete_custom_reward

Twitch Endpoint: Delete Custom Reward

This function deletes a custom reward that the broadcaster created.

The app used to create the reward is the only app that may delete it. If the reward's redemption status is "UNFULFILLED" at the time the reward is deleted, its redemption status is marked as "FULFILLED".

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_CHANNEL_MANAGE_REDEMPTIONS.

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_channel_points_delete_custom_reward(broadcaster_id, id, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster that created the custom reward. This ID must match the user ID found in the OAuth token.
id String The ID of the custom reward to delete.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

This method is triggered on success.


Failure Callback

This method is triggered on failure.




Back To Top

twitch_channel_points_get_custom_reward

Twitch Endpoint: Get Custom Reward

This function gets a list of custom rewards that the specified broadcaster created.

Note

A channel may offer a maximum of 50 rewards, which includes both enabled and disabled rewards.

Note

Requires a user access token that includes the TWITCH_SCOPE_CHANNEL_READ_REDEMPTIONS or TWITCH_SCOPE_CHANNEL_MANAGE_REDEMPTIONS scope.

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_channel_points_get_custom_reward(broadcaster_id, optionals, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster whose custom rewards you want to get. This ID must match the user ID found in the OAuth token.
optionals Struct The optional parameters to be passed into the function:

- id : Real or Array of Real : A list of IDs to filter the rewards by. To specify more than one ID, pass an array with the ID of the rewards you want to get. You may specify a maximum of 50 IDs.
Duplicate IDs are ignored. The response contains only the IDs that were found. If none of the IDs were found, the response is 404 Not Found.
- only_manageable_rewards : Boolean : A Boolean value that determines whether the response contains only the custom rewards that the app may manage (the app is identified by the ID in the Client-Id header). Set to true to get only the custom rewards that the app may manage. The default is false.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array A list of custom rewards. The list is in ascending order by id. If the broadcaster hasn't created custom rewards, the list is empty.
 ├── broadcaster_id String The ID that uniquely identifies the broadcaster.
 ├── broadcaster_login String The broadcaster's login name.
 ├── broadcaster_name String The broadcaster's display name.
 ├── id String The ID that uniquely identifies this custom reward.
 ├── title String The title of the reward.
 ├── prompt String The prompt shown to the viewer when they redeem the reward if user input is required (see the is_user_input_required field).
 ├── cost Real The cost of the reward in Channel Points.
 ├── image Struct A set of custom images for the reward. This field is undefined if the broadcaster didn't upload images.
         ├── url_1x String The URL to a small version of the image.
         ├── url_2x String The URL to a medium version of the image.
         └── url_4x String The URL to a large version of the image.
 ├── default_image Struct A set of default images for the reward.
         ├── url_1x String The URL to a small version of the image.
         ├── url_2x String The URL to a medium version of the image.
         └── url_4x String The URL to a large version of the image.
 ├── background_color String The background color to use for the reward. The color is in Hex format (for example, "#00E5CB").
 ├── is_enabled Boolean A Boolean value that determines whether the reward is enabled. Is true if enabled; otherwise, false. Disabled rewards aren't shown to the user.
 ├── is_user_input_required Boolean A Boolean value that determines whether the user must enter information when redeeming the reward. Is true if the user is prompted.
 ├── max_per_stream_setting Struct The settings used to determine whether to apply a maximum to the number of redemptions allowed per live stream.
         ├── is_enabled Boolean A Boolean value that determines whether the reward applies a limit on the number of redemptions allowed per live stream. Is true if the reward applies a limit.
         └── max_per_stream Int64 The maximum number of redemptions allowed per live stream.
 ├── max_per_user_per_stream_setting Struct The settings used to determine whether to apply a maximum to the number of redemptions allowed per user per live stream.
         ├── is_enabled Boolean A Boolean value that determines whether the reward applies a limit on the number of redemptions allowed per user per live stream. Is true if the reward applies a limit.
         └── max_per_user_per_stream Int64 The maximum number of redemptions allowed per user per live stream.
 ├── global_cooldown_setting Struct The settings used to determine whether to apply a cooldown period between redemptions and the length of the cooldown.
         ├── is_enabled Boolean A Boolean value that determines whether to apply a cooldown period. Is true if a cooldown period is enabled.
         └── global_cooldown_seconds Int64 The cooldown period, in seconds.
 ├── is_paused Boolean A Boolean value that determines whether the reward is currently paused. Is true if the reward is paused. Viewers can't redeem paused rewards.
 ├── is_in_stock Boolean A Boolean value that determines whether the reward is currently in stock. Is true if the reward is in stock. Viewers can't redeem out of stock rewards.
 ├── should_redemptions_skip_request_queue Boolean A Boolean value that determines whether redemptions should be set to "FULFILLED" status immediately when a reward is redeemed. If false, status is set to "UNFULFILLED" and follows the normal request queue process.
 ├── redemptions_redeemed_current_stream Real The number of redemptions redeemed during the current live stream. The number counts against the max_per_stream_setting limit. This field is undefined if the broadcaster's stream isn't live or max_per_stream_setting isn't enabled.
 └── cooldown_expires_at String The timestamp of when the cooldown period expires. Is undefined if the reward isn't in a cooldown state. See the global_cooldown_setting field.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_channel_points_get_custom_reward_redemption

Twitch Endpoint: Get Custom Reward Redemption

This function gets a list of redemptions for the specified custom reward. The app used to create the reward is the only app that may get the redemptions.

Note

Requires a user access token that includes the TWITCH_SCOPE_CHANNEL_READ_REDEMPTIONS or TWITCH_SCOPE_CHANNEL_MANAGE_REDEMPTIONS scope.

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_channel_points_get_custom_reward_redemption(broadcaster_id, reward_id, status, optionals, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster that owns the custom reward. This ID must match the user ID found in the user OAuth token.
reward_id String The ID that identifies the custom reward whose redemptions you want to get.
status String The status of the redemptions to return. The possible case-sensitive values are:
* "CANCELED"
* "FULFILLED"
* "UNFULFILLED"

Note: This field is required only if you don't specify the id parameter.
Note: Canceled and fulfilled redemptions are returned for only a few days after they're canceled or fulfilled.
optionals Struct The optional parameters to be passed into the function:

- id : Real or Array of Real : A list of IDs to filter the redemptions by. To specify more than one ID, pass an array containing the ID of each redemption you want to get. You may specify a maximum of 50 IDs.
Duplicate IDs are ignored. The response contains only the IDs that were found. If none of the IDs were found, the response is 404 Not Found.
- sort : String : The order to sort redemptions by. The possible case-sensitive values are:
* "OLDEST"
* "NEWEST"

The default is "OLDEST".

- after : String : The cursor used to get the next page of results. The Pagination struct in the response contains the cursor's value. Read more
- first : Real : The maximum number of redemptions to return per page in the response. The minimum page size is 1 redemption per page and the maximum is 50. The default is 20.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array The list of redemptions for the specified reward. The list is empty if there are no redemptions that match the redemption criteria.
 ├── broadcaster_id String The ID that uniquely identifies the broadcaster.
 ├── broadcaster_login String The broadcaster's login name.
 ├── broadcaster_name String The broadcaster's display name.
 ├── id String The ID that uniquely identifies this redemption.
 ├── user_login String The user's login name.
 ├── user_id String The ID that uniquely identifies the user that redeemed the reward.
 ├── user_name String The user's display name.
 ├── user_input String The text the user entered at the prompt when they redeemed the reward; otherwise, an empty string if user input was not required.
 ├── status String The state of the redemption. Possible values are: "CANCELED", "FULFILLED", "UNFULFILLED"
 ├── redeemed_at String The date and time of when the reward was redeemed, in RFC3339 format.
 └── reward Struct The reward that the user redeemed.
         ├── id String The ID that uniquely identifies the redeemed reward.
         ├── title String The reward's title.
         ├── prompt String The prompt displayed to the viewer if user input is required.
         └── cost Int64 The reward's cost, in Channel Points.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_channel_points_update_custom_reward

Twitch Endpoint: Update Custom Reward

This function updates a custom reward. The app used to create the reward is the only app that may update the reward.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_CHANNEL_MANAGE_REDEMPTIONS.

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_channel_points_update_custom_reward(broadcaster_id, id, optionals, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster that's updating the reward. This ID must match the user ID found in the OAuth token.
id String The ID of the reward to update.
optionals Struct The optional parameters to be passed into the function:

- title : String : The reward's title. The title may contain a maximum of 45 characters and it must be unique amongst all of the broadcaster's custom rewards.
- prompt : String : The prompt shown to the viewer when they redeem the reward. Specify a prompt if is_user_input_required is true. The prompt is limited to a maximum of 200 characters.
- cost : Int64 : The cost of the reward, in channel points. The minimum is 1 point.
- background_color : String : The background color to use for the reward. Specify the color using Hex format (for example, #00E5CB).
- is_enabled : Boolean : A Boolean value that indicates whether the reward is enabled. Set to true to enable the reward. Viewers see only enabled rewards.
- is_user_input_required : Boolean : A Boolean value that determines whether users must enter information to redeem the reward. Set to true if user input is required. See the prompt field.
- is_max_per_stream_enabled : Boolean : A Boolean value that determines whether to limit the maximum number of redemptions allowed per live stream (see the max_per_stream field). Set to true to limit redemptions.
- max_per_stream : Int64 : The maximum number of redemptions allowed per live stream. Applied only if is_max_per_stream_enabled is true. The minimum value is 1.
- is_max_per_user_per_stream_enabled : Boolean : A Boolean value that determines whether to limit the maximum number of redemptions allowed per user per stream (see max_per_user_per_stream). The minimum value is 1. Set to true to limit redemptions.
- max_per_user_per_stream : Int64 : The maximum number of redemptions allowed per user per stream. Applied only if is_max_per_user_per_stream_enabled is true.
- is_global_cooldown_enabled : Boolean : A Boolean value that determines whether to apply a cooldown period between redemptions. Set to true to apply a cooldown period. For the duration of the cooldown period, see global_cooldown_seconds.
- global_cooldown_seconds : Int64 : The cooldown period, in seconds. Applied only if is_global_cooldown_enabled is true. The minimum value is 1; however, for it to be shown in the Twitch UX, the minimum value is 60.
- is_paused : Boolean : A Boolean value that determines whether to pause the reward. Set to true to pause the reward. Viewers can't redeem paused rewards..
- should_redemptions_skip_request_queue : Boolean : A Boolean value that determines whether redemptions should be set to "FULFILLED" status immediately when a reward is redeemed. If false, status is set to "UNFULFILLED" and follows the normal request queue process.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array The list contains the single reward that you updated.
 ├── broadcaster_id String The ID that uniquely identifies the broadcaster.
 ├── broadcaster_login String The broadcaster's login name.
 ├── broadcaster_name String The broadcaster's display name.
 ├── id String The ID that uniquely identifies this custom reward.
 ├── title String The title of the reward.
 ├── prompt String The prompt shown to the viewer when they redeem the reward if user input is required. See the is_user_input_required field.
 ├── cost Int64 The cost of the reward in Channel Points.
 ├── image Struct A set of custom images for the reward. This field is undefined if the broadcaster didn't upload images.
         ├── url_1x String The URL to a small version of the image.
         ├── url_2x String The URL to a medium version of the image.
         └── url_4x String The URL to a large version of the image.
 ├── default_image Struct A set of default images for the reward.
         ├── url_1x String The URL to a small version of the image.
         ├── url_2x String The URL to a medium version of the image.
         └── url_4x String The URL to a large version of the image.
 ├── background_color String The background color to use for the reward. The color is in Hex format (for example, "#00E5CB").
 ├── is_enabled Boolean A Boolean value that determines whether the reward is enabled. Is true if enabled; otherwise, false. Disabled rewards aren't shown to the user.
 ├── is_user_input_required Boolean A Boolean value that determines whether the user must enter information when they redeem the reward. Is true if the user is prompted.
 ├── max_per_stream_setting Struct The settings used to determine whether to apply a maximum to the number of redemptions allowed per live stream.
         ├── is_enabled Boolean A Boolean value that determines whether the reward applies a limit on the number of redemptions allowed per live stream. Is true if the reward applies a limit.
         └── max_per_stream Int64 The maximum number of redemptions allowed per live stream.
 ├── max_per_user_per_stream_setting Struct The settings used to determine whether to apply a maximum to the number of redemptions allowed per user per live stream.
         ├── is_enabled Boolean A Boolean value that determines whether the reward applies a limit on the number of redemptions allowed per user per live stream. Is true if the reward applies a limit.
         └── max_per_user_per_stream Int64 The maximum number of redemptions allowed per user per live stream.
 ├── global_cooldown_setting Struct The settings used to determine whether to apply a cooldown period between redemptions and the length of the cooldown.
         ├── is_enabled Boolean A Boolean value that determines whether to apply a cooldown period. Is true if a cooldown period is enabled.
         └── global_cooldown_seconds Int64 The cooldown period, in seconds.
 ├── is_paused Boolean A Boolean value that determines whether the reward is currently paused. Is true if the reward is paused. Viewers can't redeem paused rewards.
 ├── is_in_stock Boolean A Boolean value that determines whether the reward is currently in stock. Is true if the reward is in stock. Viewers can't redeem out of stock rewards.
 ├── should_redemptions_skip_request_queue Boolean A Boolean value that determines whether redemptions should be set to "FULFILLED" status immediately when a reward is redeemed. If false, status is set to "UNFULFILLED" and follows the normal request queue process.
 ├── redemptions_redeemed_current_stream Real The number of redemptions redeemed during the current live stream. The number counts against the max_per_stream_setting limit. This field is undefined if the broadcaster's stream isn't live or max_per_stream_setting isn't enabled.
 └── cooldown_expires_at String The timestamp of when the cooldown period expires. Is undefined if the reward isn't in a cooldown state. See the global_cooldown_setting field.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_channel_points_update_redemption_status

Twitch Endpoint: Update Redemption Status

This function updates a redemption's status. You may update a redemption only if its status is "UNFULFILLED". The app used to create the reward is the only app that may update the redemption.

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_CHANNEL_MANAGE_REDEMPTIONS.

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_channel_points_update_redemption_status(id, broadcaster_id, reward_id, status, callback_success, callback_failed)
Argument Type Description
id Real or Array A list of IDs that identify the redemptions to update. To specify more than one ID, pass an array containing the IDs of the redemptions you want to update. You may specify a maximum of 50 IDs.
broadcaster_id String The ID of the broadcaster that's updating the redemption. This ID must match the user ID in the user access token.
reward_id String The ID that identifies the reward that's been redeemed.
status String The status to set the redemption to. Possible values are:

* "CANCELED"
* "FULFILLED"

Setting the status to "CANCELED" refunds the user's channel points.
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array The list contains the single redemption that you updated.
 ├── broadcaster_id String The ID that uniquely identifies the broadcaster.
 ├── broadcaster_login String The broadcaster's login name.
 ├── broadcaster_name String The broadcaster's display name.
 ├── id String The ID that uniquely identifies this redemption..
 ├── user_id String The ID of the user that redeemed the reward.
 ├── user_name String The user's display name.
 ├── user_login String The user's login name.
 ├── reward Struct a struct that describes the reward that the user redeemed.
         ├── id String The ID that uniquely identifies the reward.
         ├── title String The reward's title.
         ├── prompt String The prompt displayed to the viewer if user input is required.
         └── cost Int64 The reward's cost, in Channel Points.
 ├── user_input String The text that the user entered at the prompt when they redeemed the reward; otherwise, an empty string if user input was not required.
 ├── status String The state of the redemption. Possible values are: "CANCELED", "FULFILLED", "UNFULFILLED"
 └── redeemed_at String The date and time of when the reward was redeemed, in RFC3339 format.

Failure Callback

This method is triggered on failure.



⚠️ **GitHub.com Fallback** ⚠️