extensions - YoYoGames/GMEXT-Twitch GitHub Wiki
These are the functions of this module:
- twitch_extensions_create_jwt_token
- twitch_extensions_get_extension_configuration_segment
- twitch_extensions_set_extension_configuration_segment
- twitch_extensions_set_extension_required_configuration
- twitch_extensions_send_extension_pubsub_message
- twitch_extensions_get_extension_live_channels
- twitch_extensions_get_extension_secrets
- twitch_extensions_create_extension_secret
- twitch_extensions_send_extension_chat_message
- twitch_extensions_get_extensions
- twitch_extensions_get_released_extensions
- twitch_extensions_get_extension_bits_products
- twitch_extensions_update_extension_bits_product
This function creates a JSON Web Token (JWT) to be used with the twitch_extensions_*
functions that require it.
Syntax:
twitch_extensions_create_jwt_token(secret, payload=undefined)
Argument | Type | Description |
---|---|---|
secret | String | The base64 encoded Twitch secret |
payload | String | The payload |
Returns:
Twitch Endpoint: Get Extension Configuration Segment
This function gets the specified configuration segment from the specified extension.
Rate Limits: You may retrieve each segment a maximum of 20 times per minute.
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_extensions_get_extension_configuration_segment(jwt_token, extension_id, segment, optionals, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
jwt_token | String | A signed JSON Web Token (JWT) created by twitch_extensions_create_jwt_token. For signing requirements, see Signing the JWT. The signed JWT must include the role , user_id , and exp fields (see JWT Schema). The role field must be set to "external" . |
extension_id | String | The ID of the extension that contains the configuration segment you want to get. |
segment | String or Array | The type of configuration segment to get. Possible case-sensitive values are: "broadcaster" , "developer" , "global" . You may specify one or more segments. To specify multiple segments, pass an array with the segments you want to get. Ignores duplicate segments. |
optionals | Struct | The optional parameters to be passed into the function: - broadcaster_id : String : The ID of the broadcaster that installed the extension. This parameter is required if you set the segment parameter to broadcaster or developer. Do not specify this parameter if you set segment to "global" . |
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 requested configuration segments. The list is returned in the same order that you specified the list of segments in the request. |
├── segment | String | The type of segment. Possible values are: "broadcaster" , "developer" , "global"
|
├── broadcaster_id | String | The ID of the broadcaster that installed the extension. The struct includes this field only if the segment parameter is set to "developer" or "broadcaster" . |
├── content | String | The contents of the segment. This string may be a plain-text string or a string-encoded JSON object. |
└── version | String | The version number that identifies this definition of the segment's data. |
This method is triggered on failure.
Twitch Endpoint: Set Extension Configuration Segment
This function updates a configuration segment. The segment is limited to 5 KB. Extensions that are active on a channel do not receive the updated configuration.
Rate Limits: You may update the configuration a maximum of 20 times per minute.
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_extensions_set_extension_configuration_segment(jwt_token, extension_id, segment, optionals, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
jwt_token | String | A signed JSON Web Token (JWT) created by twitch_extensions_create_jwt_token. For signing requirements, see Signing the JWT. The signed JWT must include the role , user_id , and exp fields (see JWT Schema). The role field must be set to "external" . |
extension_id | String | The ID of the extension to update. |
segment | String | The configuration segment to update. Possible case-sensitive values are: "broadcaster" , "developer" , "global"
|
optionals | Struct | The optional parameters to be passed into the function: - broadcaster_id : String : The ID of the broadcaster that installed the extension. Include this field only if the segment is set to "developer" or "broadcaster" .- content : String : The contents of the segment. This string may be a plain-text string or a string-encoded JSON object.- version : String : The version number that identifies this definition of the segment's data. If not specified, the latest definition is updated. |
callback_success | Function | Triggered if the request succeeded |
callback_failed | Function | Triggered if the request failed |
Returns:
N/A
Triggers:
This method is triggered on success. It has no response body.
This method is triggered on failure.
Twitch Endpoint: Set Extension Required Configuration
This function updates the extension's required_configuration string. Use this endpoint if your extension requires the broadcaster to configure the extension before activating it (to require configuration, you must select Custom/My Own Service in Extension Capabilities). For more information, see Required Configurations and Setting Required Configuration.
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_extensions_set_extension_required_configuration(jwt_token, broadcaster_id, extension_id, extension_version, required_configuration, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
jwt_token | String | A signed JSON Web Token (JWT) created by twitch_extensions_create_jwt_token. For signing requirements, see Signing the JWT. The signed JWT must include the role , user_id , and exp fields (see JWT Schema). Set the role field to "external" and the "user_id" field to the ID of the user that owns the extension. |
broadcaster_id | String | The ID of the broadcaster that installed the extension on their channel. |
extension_id | String | The ID of the extension to update. |
extension_version | String | The version of the extension to update. |
required_configuration | String | The required_configuration string to use with the extension. |
callback_success | Function | Triggered if the request succeeded |
callback_failed | Function | Triggered if the request failed |
Returns:
N/A
Triggers:
This method is triggered on success. It has no response body.
This method is triggered on failure.
Twitch Endpoint: Send Extension PubSub Message
This function sends a message to one or more viewers. You can send messages to a specific channel or to all channels where your extension is active. This endpoint uses the same mechanism as the send JavaScript helper function used to send messages.
Rate Limits: You may send a maximum of 100 messages per minute per combination of extension client ID and broadcaster ID.
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_extensions_send_extension_pubsub_message(jwt_token, target, broadcaster_id, message, optionals, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
jwt_token | String | A signed JSON Web Token (JWT) created by twitch_extensions_create_jwt_token. For signing requirements, see Signing the JWT. The signed JWT must include the role , user_id , and exp fields (see JWT Schema) along with the channel_id and pubsub_perms fields. The role field must be set to "external" .To send the message to a specific channel, set the channel_id field in the JWT to the channel's ID and set the pubsub_perms.send array to "broadcast" .To send the message to all channels on which your extension is active, set the channel_id field to "all" and set the "pubsub_perms.send" array to "global" . |
target | Array of String | The target of the message. Possible values are: "broadcast" , "global" , "whisper<user-id>" . If is_global_broadcast is true , you must set this field to "global" . The "broadcast" and "global" values are mutually exclusive; specify only one of them. |
broadcaster_id | String | The ID of the broadcaster to send the message to. Don't include this field if is_global_broadcast is set to true . |
message | String | The message to send. The message can be a plain-text string or a string-encoded JSON object. The message is limited to a maximum of 5 KB. |
optionals | Struct | The optional parameters to be passed into the function: - is_global_broadcast : Boolean : A Boolean value that determines whether the message should be sent to all channels where your extension is active. Set to true if the message should be sent to all channels. The default is false . |
callback_success | Function | Triggered if the request succeeded |
callback_failed | Function | Triggered if the request failed |
Returns:
N/A
Triggers:
This method is triggered on success. It has no response body.
This method is triggered on failure.
Twitch Endpoint: Get Extension Live Channels
This function gets a list of broadcasters that are streaming live and have installed or activated the extension.
It may take a few minutes for the list to include or remove broadcasters that have recently gone live or stopped broadcasting.
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_extensions_get_extension_live_channels(extension_id, optionals, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
extension_id | String | The ID of the extension to get. Returns the list of broadcasters that are live and that have installed or activated this extension. |
optionals | Struct | The optional parameters to be passed into the function: - first : Real : The maximum number of items to return per page in the response. The minimum page size is 1 item per page and the maximum is 100 items per page. The default is 20.- after : String : The cursor used to get the next page of results. The pagination field in the response contains the cursor's value. Read more
|
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 broadcasters that are streaming live and that have installed or activated the extension. |
├── broadcaster_id | String | The ID of the broadcaster that is streaming live and has installed or activated the extension. |
├── broadcaster_name | String | The broadcaster's display name. |
├── game_name | String | The name of the category or game being streamed. |
├── game_id | String | The ID of the category or game being streamed. |
└── title | String | The title of the broadcaster's stream. May be an empty string if not specified. |
pagination | String | This field contains the cursor used to page through the results. The field is empty if there are no more pages left to page through. Note that this field is a string compared to other endpoints that use a Pagination struct. Read More |
This method is triggered on failure.
Twitch Endpoint: Get Extension Secrets
This function gets an extension's list of shared secrets.
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_extensions_get_extension_secrets(jwt_token, extension_id, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
jwt_token | String | A signed JSON Web Token (JWT) created by twitch_extensions_create_jwt_token. For signing requirements, see Signing the JWT. The signed JWT must include the role , user_id , and exp fields (see JWT Schema). The role field must be set to "external" . |
extension_id | String | The ID of the extension whose shared secrets you want to get. |
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 shared secrets that the extension created. |
├── format_version | Real | The version number that identifies this definition of the secret's data. |
└── secrets | Array | The list of secrets. |
├── content | String | The raw secret that you use with JWT encoding. |
├── active_at | String | The UTC date and time (in RFC3339 format) that you may begin using this secret to sign a JWT. |
└── expires_at | String | The UTC date and time (in RFC3339 format) that you must stop using this secret to decode a JWT. |
This method is triggered on failure.
Twitch Endpoint: Create Extension Secret
This function creates a shared secret used to sign and verify JWT tokens. Creating a new secret removes the current secrets from service. Use this function only when you are ready to use the new secret it returns.
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_extensions_create_extension_secret(jwt_token, extension_id, optionals, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
jwt_token | String | A signed JSON Web Token (JWT) created by twitch_extensions_create_jwt_token. For signing requirements, see Signing the JWT. The signed JWT must include the role , user_id , and exp fields (see JWT Schema). The role field must be set to "external" . |
extension_id | String | The ID of the extension to apply the shared secret to. |
optionals | Struct | The optional parameters to be passed into the function: - delay : Real : The amount of time, in seconds, to delay activating the secret. The delay should provide enough time for instances of the extension to gracefully switch over to the new secret. The minimum delay is 300 seconds (5 minutes). The default is 300 seconds. |
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 | A list that contains the newly added secrets. |
├── format_version | Real | The version number that identifies this definition of the secret's data. |
└── secrets | Array | The list of secrets. |
├── content | String | The raw secret that you use with JWT encoding. |
├── active_at | String | The UTC date and time (in RFC3339 format) that you may begin using this secret to sign a JWT. |
└── expires_at | String | The UTC date and time (in RFC3339 format) that you must stop using this secret to decode a JWT. |
This method is triggered on failure.
Twitch Endpoint: Send Extension Chat Message
This function sends a message to the specified broadcaster's chat room. The extension's name is used as the username for the message in the chat room. To send a chat message, your extension must enable Chat Capabilities (under your extension's Capabilities tab).
Rate Limits: You may send a maximum of 12 messages per minute per channel.
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_extensions_send_extension_chat_message(jwt_token, broadcaster_id, text, extension_id, extension_version, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
jwt_token | String | A signed JSON Web Token (JWT) created by twitch_extensions_create_jwt_token. For signing requirements, see Signing the JWT. The signed JWT must include the role and user_id fields (see JWT Schema). The role field must be set to "external" . |
broadcaster_id | String | The ID of the broadcaster that has activated the extension. |
text | String | The message. The message may contain a maximum of 280 characters. |
extension_id | String | The ID of the extension that's sending the chat message. |
extension_version | String | The extension's version number. |
callback_success | Function | Triggered if the request succeeded |
callback_failed | Function | Triggered if the request failed |
Returns:
N/A
Triggers:
This method is triggered on success. It has no response body.
This method is triggered on failure.
Twitch Endpoint: Get Extensions
This function gets information about an extension.
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_extensions_get_extensions(jwt_token, extension_id, optionals, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
jwt_token | String | A signed JSON Web Token (JWT) created by twitch_extensions_create_jwt_token. For signing requirements, see Signing the JWT. The signed JWT must include the role field (see JWT Schema), and The role field must be set to "external" . |
extension_id | String | The ID of the extension to get. |
optionals | Struct | The optional parameters to be passed into the function: - extension_version : String : The version of the extension to get. If not specified, it returns the latest, released version. If you don't have a released version, you must specify a version; otherwise, the list is empty. |
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 | A list that contains the specified extension. |
├── author_name | String | The name of the user or organization that owns the extension. |
├── bits_enabled | Boolean | A Boolean value that determines whether the extension has features that use Bits. Is true if the extension has features that use Bits. |
├── can_install | Boolean | A Boolean value that determines whether a user can install the extension on their channel. Is true if a user can install the extension. Typically, this is set to false if the extension is currently in testing mode and requires users to be allowlisted (the allowlist is configured on Twitch's developer site under the Extensions > Extension > Version > Access). |
├── configuration_location | String | The location of where the extension's configuration is stored. Possible values are: "hosted" - The Extensions Configuration Service hosts the configuration. "custom" - The Extension Backend Service (EBS) hosts the configuration. "none" - The extension doesn't require configuration. |
├── description | String | A longer description of the extension. It appears on the details page. |
├── eula_tos_url | String | A URL to the extension's Terms of Service. |
├── has_chat_support | Boolean | A Boolean value that determines whether the extension can communicate with the installed channel's chat. Is true if the extension can communicate with the channel's chat room. |
├── icon_url | String | A URL to the default icon that's displayed in the Extensions directory. |
├── icon_urls | Struct | A dictionary that contains URLs to different sizes of the default icon. The dictionary's key identifies the icon's size (for example, "24x24" ), and the dictionary's value contains the URL to the icon. |
├── id | String | The extension's ID. |
├── name | String | The extension's name. |
├── privacy_policy_url | String | A URL to the extension's privacy policy. |
├── request_identity_link | Boolean | A Boolean value that determines whether the extension wants to explicitly ask viewers to link their Twitch identity. |
├── screenshot_urls | Array of String | A list of URLs to screenshots that are shown in the Extensions marketplace. |
├── state | String | The extension's state. Possible values are: "Approved" , "AssetsUploaded" , "Deleted" , "Deprecated" , "InReview" , "InTest" , "PendingAction" , "Rejected" , "Released"
|
├── subscriptions_support_level | String | Indicates whether the extension can view the user's subscription level on the channel that the extension is installed on. Possible values are: "none" - The extension can't view the user's subscription level. "optional" - The extension can view the user's subscription level. |
├── summary | String | A short description of the extension that streamers see when hovering over the discovery splash screen in the Extensions manager. |
├── support_email | String | The email address that users use to get support for the extension. |
├── version | String | The extension's version number. |
├── viewer_summary | String | A brief description displayed on the channel to explain how the extension works. |
├── views | Struct | Describes all views-related information such as how the extension is displayed on mobile devices. |
├── mobile | Struct | Describes how the extension is displayed on mobile devices. |
└── viewer_url | String | The HTML file that is shown to viewers on mobile devices. This page is presented to viewers as a panel behind the chat area of the mobile app. |
├── panel | Struct | Describes how the extension is rendered if the extension may be activated as a panel extension. |
├── viewer_url | String | The HTML file that is shown to viewers on the channel page when the extension is activated in a Panel slot. |
├── height | Real | The height, in pixels, of the panel component that the extension is rendered in. |
└── can_link_external_content | Boolean | A Boolean value that determines whether the extension can link to non-Twitch domains. |
├── video_overlay | Struct | Describes how the extension is rendered if the extension may be activated as a video-overlay extension. |
├── viewer_url | String | The HTML file that is shown to viewers on the channel page when the extension is activated on the Video - Overlay slot. |
└── can_link_external_content | Boolean | A Boolean value that determines whether the extension can link to non-Twitch domains. |
├── component | Struct | Describes how the extension is rendered if the extension may be activated as a video-component extension. |
├── viewer_url | String | The HTML file that is shown to viewers on the channel page when the extension is activated in a Video - Component slot. |
├── aspect_ratio_x | Real | The width value of the ratio (width : height) which determines the extension's width, and how the extension's iframe will resize in different video player environments. |
├── aspect_ratio_y | Real | The height value of the ratio (width : height) which determines the extension's height, and how the extension's iframe will resize in different video player environments. |
├── autoscale | Boolean | A Boolean value that determines whether to apply CSS zoom. If true , a CSS zoom is applied such that the size of the extension is variable but the inner dimensions are fixed based on Scale Pixels. This allows your extension to render as if it is of fixed width and height. If false , the inner dimensions of the extension iframe are variable, meaning your extension must implement responsiveness. |
├── scale_pixels | Real | The base width, in pixels, of the extension to use when scaling (see autoscale ). This value is ignored if autoscale is false . |
├── target_height | Real | The height as a percent of the maximum height of a video component extension. Values are between 1% - 100%. |
└── can_link_external_content | Boolean | A Boolean value that determines whether the extension can link to non-Twitch domains. |
├── config | Struct | Describes the view that is shown to broadcasters while they are configuring your extension within the Extension Manager. |
├── viewer_url | String | The HTML file shown to broadcasters while they are configuring your extension within the Extension Manager. |
└── can_link_external_content | Boolean | A Boolean value that determines whether the extension can link to non-Twitch domains. |
├── allowlisted_config_urls | Array of String | Allowlisted configuration URLs for displaying the extension (the allowlist is configured on Twitch's developer site under the Extensions > Extension > Version > Capabilities). |
└── allowlisted_panel_urls | Array of String | Allowlisted panel URLs for displaying the extension (the allowlist is configured on Twitch's developer site under the Extensions > Extension > Version > Capabilities). |
This method is triggered on failure.
Twitch Endpoint: Get Released Extensions
This function gets information about a released extension. Returns the extension if its state
is "Released"
.
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_extensions_get_released_extensions(extension_id, optionals, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
extension_id | String | The ID of the extension to get. |
optionals | Struct | The optional parameters to be passed into the function: - extension_version : String : The version of the extension to get. If not specified, it returns the latest version. |
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 | A list that contains the specified extension. |
├── author_name | String | The name of the user or organization that owns the extension. |
├── bits_enabled | Boolean | A Boolean value that determines whether the extension has features that use Bits. Is true if the extension has features that use Bits. |
├── can_install | Boolean | A Boolean value that determines whether a user can install the extension on their channel. Is true if a user can install the extension. Typically, this is set to false if the extension is currently in testing mode and requires users to be allowlisted (the allowlist is configured on Twitch's developer site under the Extensions > Extension > Version > Access). |
├── configuration_location | String | The location of where the extension's configuration is stored. Possible values are: "hosted" - The Extensions Configuration Service hosts the configuration. "custom" - The Extension Backend Service (EBS) hosts the configuration. "none" - The extension doesn't require configuration. |
├── description | String | A longer description of the extension. It appears on the details page. |
├── eula_tos_url | String | A URL to the extension's Terms of Service. |
├── has_chat_support | Boolean | A Boolean value that determines whether the extension can communicate with the installed channel's chat. Is true if the extension can communicate with the channel's chat room. |
├── icon_url | String | A URL to the default icon that's displayed in the Extensions directory. |
├── icon_urls | Struct | A dictionary that contains URLs to different sizes of the default icon. The dictionary's key identifies the icon's size (for example, "24x24" ), and the dictionary's value contains the URL to the icon. |
├── id | String | The extension's ID. |
├── name | String | The extension's name. |
├── privacy_policy_url | String | A URL to the extension's privacy policy. |
├── request_identity_link | Boolean | A Boolean value that determines whether the extension wants to explicitly ask viewers to link their Twitch identity. |
├── screenshot_urls | Array of String | A list of URLs to screenshots that are shown in the Extensions marketplace. |
├── state | String | The extension's state. Possible values are: "Approved" , "AssetsUploaded" , "Deleted" , "Deprecated" , "InReview" , "InTest" , "PendingAction" , "Rejected" , "Released"
|
├── subscriptions_support_level | String | Indicates whether the extension can view the user's subscription level on the channel that the extension is installed on. Possible values are: "none" - The extension can't view the user's subscription level. "optional" - The extension can view the user's subscription level. |
├── summary | String | A short description of the extension that streamers see when hovering over the discovery splash screen in the Extensions manager. |
├── support_email | String | The email address that users use to get support for the extension. |
├── version | String | The extension's version number. |
├── viewer_summary | String | A brief description displayed on the channel to explain how the extension works. |
├── views | Struct | Describes all views-related information such as how the extension is displayed on mobile devices. |
├── mobile | Struct | Describes how the extension is displayed on mobile devices. |
└── viewer_url | String | The HTML file that is shown to viewers on mobile devices. This page is presented to viewers as a panel behind the chat area of the mobile app. |
├── panel | Struct | Describes how the extension is rendered if the extension may be activated as a panel extension. |
├── viewer_url | String | The HTML file that is shown to viewers on the channel page when the extension is activated in a Panel slot. |
├── height | Real | The height, in pixels, of the panel component that the extension is rendered in. |
└── can_link_external_content | Boolean | A Boolean value that determines whether the extension can link to non-Twitch domains. |
├── video_overlay | Struct | Describes how the extension is rendered if the extension may be activated as a video-overlay extension. |
├── viewer_url | String | The HTML file that is shown to viewers on the channel page when the extension is activated on the Video - Overlay slot. |
└── can_link_external_content | Boolean | A Boolean value that determines whether the extension can link to non-Twitch domains. |
├── component | Struct | Describes how the extension is rendered if the extension may be activated as a video-component extension. |
├── viewer_url | String | The HTML file that is shown to viewers on the channel page when the extension is activated in a Video - Component slot. |
├── aspect_ratio_x | Real | The width value of the ratio (width : height) which determines the extension's width, and how the extension's iframe will resize in different video player environments. |
├── aspect_ratio_y | Real | The height value of the ratio (width : height) which determines the extension's height, and how the extension's iframe will resize in different video player environments. |
├── autoscale | Boolean | A Boolean value that determines whether to apply CSS zoom. If true , a CSS zoom is applied such that the size of the extension is variable but the inner dimensions are fixed based on Scale Pixels. This allows your extension to render as if it is of fixed width and height. If false , the inner dimensions of the extension iframe are variable, meaning your extension must implement responsiveness. |
├── scale_pixels | Real | The base width, in pixels, of the extension to use when scaling (see autoscale ). This value is ignored if autoscale is false . |
├── target_height | Real | The height as a percent of the maximum height of a video component extension. Values are between 1% - 100%. |
└── can_link_external_content | Boolean | A Boolean value that determines whether the extension can link to non-Twitch domains. |
├── config | Struct | Describes the view that is shown to broadcasters while they are configuring your extension within the Extension Manager. |
├── viewer_url | String | The HTML file shown to broadcasters while they are configuring your extension within the Extension Manager. |
└── can_link_external_content | Boolean | A Boolean value that determines whether the extension can link to non-Twitch domains. |
├── allowlisted_config_urls | Array of String | Allowlisted configuration URLs for displaying the extension (the allowlist is configured on Twitch's developer site under the Extensions > Extension > Version > Capabilities). |
└── allowlisted_panel_urls | Array of String | Allowlisted panel URLs for displaying the extension (the allowlist is configured on Twitch's developer site under the Extensions > Extension > Version > Capabilities). |
This method is triggered on failure.
Twitch Endpoint: Get Extension Bits Products
This function gets the list of Bits products that belongs to the extension. The client ID in the app access token identifies the extension.
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_extensions_get_extension_bits_products(optionals, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
optionals | Struct | The optional parameters to be passed into the function: - should_include_all : Boolean : A Boolean value that determines whether to include disabled or expired Bits products in the response. The default is false . |
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 | A list of Bits products that the extension created. The list is in ascending SKU order. The list is empty if the extension hasn't created any products or they're all expired or disabled. |
├── sku | String | The product's SKU. The SKU is unique across an extension's products. |
├── cost | Struct | a struct that contains the product's cost information. |
├── amount | Real | The product's price. |
└── type | String | The type of currency. Possible values are: "bits"
|
├── in_development | Boolean | A Boolean value that indicates whether the product is in development. If true , the product is not available for public use. |
├── display_name | String | The product's name as displayed in the extension. |
├── expiration | String | The date and time, in RFC3339 format, when the product expires. |
└── is_broadcast | Boolean | A Boolean value that determines whether Bits product purchase events are broadcast to all instances of an extension on a channel. The events are broadcast via the onTransactionComplete helper callback. Is true if the event is broadcast to all instances. |
This method is triggered on failure.
Twitch Endpoint: Update Extension Bits Product
This function adds or updates a Bits product that the extension created. If the SKU doesn't exist, the product is added. You may update all fields except the sku
field.
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_extensions_update_extension_bits_product(sku, cost, amount, type, display_name, optionals, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
sku | String | The product's SKU. The SKU must be unique within an extension. The product's SKU cannot be changed. The SKU may contain only alphanumeric characters, dashes (-), underscores (_), and periods (.) and is limited to a maximum of 255 characters. No spaces. |
cost | Struct | A struct that contains the product's cost information. |
amount | Real | The product's price. |
type | String | The type of currency. Possible values are: "bits" — The minimum price is 1 and the maximum is 10000. |
display_name | String | The product's name as displayed in the extension. The maximum length is 255 characters. |
optionals | Struct | The optional parameters to be passed into the function: - in_development : Boolean : A Boolean value that indicates whether the product is in development. Set to true if the product is in development and not available for public use. The default is false .- expiration : String : The date and time, in RFC3339 format, when the product expires. If not set, the product does not expire. To disable the product, set the expiration date to a date in the past.- is_broadcast : Boolean : A Boolean value that determines whether Bits product purchase events are broadcast to all instances of the extension on a channel. The default is false . |
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 | A list of Bits products that the extension created. The list is in ascending SKU order. The list is empty if the extension hasn't created any products or they're all expired or disabled. |
├── sku | String | The product's SKU. The SKU is unique across an extension's products. |
├── cost | Struct | A struct that contains the product's cost information. |
├── amount | Real | The product's price. |
└── type | String | The type of currency. Possible values are:"bits"
|
├── in_development | Boolean | A Boolean value that indicates whether the product is in development. If true , the product is not available for public use. |
├── display_name | String | The product's name as displayed in the extension. |
├── expiration | String | The date and time, in RFC3339 format, when the product expires. |
└── is_broadcast | Boolean | A Boolean value that determines whether Bits product purchase events are broadcast to all instances of an extension on a channel. Is true if the event is broadcast to all instances. |
This method is triggered on failure.