### Example Response for Get User Installed Extensions Source: https://dev.twitch.tv/docs/api/reference This is an example JSON response when successfully retrieving a user's installed extensions. It includes details like extension ID, version, name, activation status, and types. ```json { "data": [ { "id": "wi08ebtatdc7oj83wtl9uxwz807l8b", "version": "1.1.8", "name": "Streamlabs Leaderboard", "can_activate": true, "type": [ "panel" ] }, { "id": "d4uvtfdr04uq6raoenvj7m86gdk16v", "version": "2.0.2", "name": "Prime Subscription and Loot Reminder", "can_activate": true, "type": [ "overlay" ] }, { "id": "rh6jq1q334hqc2rr1qlzqbvwlfl3x0", "version": "1.1.0", "name": "TopClip", "can_activate": true, "type": [ "mobile", "panel" ] }, { "id": "zfh2irvx2jb4s60f02jq0ajm8vwgka", "version": "1.0.19", "name": "Streamlabs", "can_activate": true, "type": [ "mobile", "overlay" ] }, { "id": "lqnf3zxk0rv0g7gq92mtmnirjz2cjj", "version": "0.0.1", "name": "Dev Experience Test", "can_activate": true, "type": [ "component", "mobile", "panel", "overlay" ] } ] } ``` -------------------------------- ### Example Response for Get Channel Guest Star Settings Source: https://dev.twitch.tv/docs/api/reference An example of the JSON response when retrieving channel Guest Star settings. ```json { "data": [ { "is_moderator_send_live_enabled": true, "slot_count": 4, "is_browser_source_audio_enabled": true, "layout": "TILED_LAYOUT", "browser_source_token": "eihq8rew7q3hgierufhi3q" } ] } ``` -------------------------------- ### Start Commercial Response Source: https://dev.twitch.tv/docs/api/reference Example response for starting a commercial. Includes the requested length, a message, and the time to wait before the next commercial. ```json { "data": [ { "length" : 60, "message" : "", "retry_after" : 480 } ] } ``` -------------------------------- ### Example Response for Get Extension Bits Products Source: https://dev.twitch.tv/docs/api/reference An example JSON response structure for the Get Extension Bits Products endpoint, showing product details. ```json { "data": [ { "sku": "1010", "cost": { "amount": 990, "type": "bits" }, "in_development": true, "display_name": "Rusty Crate 2", "expiration": "2021-05-18T09:10:13.397Z", "is_broadcast": false } ] } ``` -------------------------------- ### Example Request to Get Released Extensions Source: https://dev.twitch.tv/docs/api/reference This example shows how to make a GET request to the Twitch API to retrieve information about released extensions. Ensure you include the necessary Authorization and Client-Id headers. ```bash curl -X GET 'https://api.twitch.tv/helix/extensions/released?extension_version=0.0.9&extension_id=uo6dggojyb8d6soh92zknwmi5ej1q2' \ -H 'Authorization: Bearer cfabdegwdoklmawdzdo98xt2fo512y' \ -H 'Client-Id: uo6dggojyb8d6soh92zknwmi5ej1q2' ``` -------------------------------- ### Example Response for Starting a Raid Source: https://dev.twitch.tv/docs/api/reference This JSON object represents a successful response after requesting to start a raid. It confirms the raid was requested and provides the creation timestamp. ```json { "data": [ { "created_at": "2022-02-18T07:20:50.52Z", "is_mature": false } ] } ``` -------------------------------- ### Example Response for Get Editors Source: https://dev.twitch.tv/docs/api/reference This is an example of the JSON response when successfully retrieving a list of editors for a broadcaster. ```json { "data": [ { "user_id": "182891647", "user_name": "mauerbac", "created_at": "2019-02-15T21:19:50.380833Z" }, { "user_id": "135093069", "user_name": "BlueLava", "created_at": "2018-03-07T16:28:29.872937Z" } ] } ``` -------------------------------- ### Create Clip Response (Live Stream) Source: https://dev.twitch.tv/docs/api/reference Example response after successfully starting the clip creation process from a live stream. The 'edit_url' is valid for 24 hours. ```json { "data": [{ "id": "FiveWordsForClipSlug", "edit_url": "https://www.twitch.tv/twitchdev/clip/FiveWordsForClipSlug" }] } ``` -------------------------------- ### Start Mock Data Server Source: https://dev.twitch.tv/docs/cli/mock-api-command Use this command to start the mock data server. If mock data has not been generated, it will be created with 10 users automatically. ```bash % twitch mock-api start ``` -------------------------------- ### PART Command Example Source: https://dev.twitch.tv/docs/chat/irc This example shows a user leaving a chat room. ```irc :ronni!ronni@ronni.tmi.twitch.tv PART #dallas ``` -------------------------------- ### Users - Get User Active Extensions Source: https://dev.twitch.tv/docs/api/reference Gets the active extensions that the broadcaster has installed for each configuration. ```APIDOC ## GET /users/extensions/active ### Description Gets the active extensions that the broadcaster has installed for each configuration. ### Method GET ### Endpoint /users/extensions/active ### Parameters #### Query Parameters - **user_id** (string) - Required - The ID of the user whose active extensions are being retrieved. - **type** (string) - Optional - Filters extensions by type ('panel', 'video_overlay', 'component'). ### Response #### Success Response (200) - **data** (array) - An array of active extension objects. - **id** (string) - The ID of the extension. - **version** (string) - The version of the extension. - **name** (string) - The name of the extension. - **type** (string) - The type of the extension. - **active** (boolean) - Indicates if the extension is active. ### Response Example ```json { "data": [ { "id": "ext456", "version": "1.1.0", "name": "Another Extension", "type": "panel", "active": true } ] } ``` ``` -------------------------------- ### Create channel.shield_mode.begin Subscription Webhook Example Source: https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types Example of a request body to create a subscription for the channel.shield_mode.begin event using webhooks. ```json { "type": "channel.shield_mode.begin", "version": "1", "condition": { "broadcaster_user_id": "12345", "moderator_user_id": "98765" }, "transport": { "method": "webhook", "callback": "https://example.com/webhooks/callback", "secret": "s3cRe78s9fg8" } } ``` -------------------------------- ### Users - Get User Extensions Source: https://dev.twitch.tv/docs/api/reference Gets a list of all extensions (both active and inactive) that the broadcaster has installed. ```APIDOC ## GET /users/extensions ### Description Gets a list of all extensions (both active and inactive) that the broadcaster has installed. ### Method GET ### Endpoint /users/extensions ### Parameters #### Query Parameters - **user_id** (string) - Required - The ID of the user whose extensions are being retrieved. ### Response #### Success Response (200) - **data** (array) - An array of extension objects. - **id** (string) - The ID of the extension. - **version** (string) - The version of the extension. - **name** (string) - The name of the extension. - **active** (boolean) - Indicates if the extension is active. ### Response Example ```json { "data": [ { "id": "ext123", "version": "1.0.0", "name": "Example Extension", "active": true } ] } ``` ``` -------------------------------- ### Start Local HTTP Server with Python Source: https://dev.twitch.tv/docs/extensions Use Python to quickly start an HTTP server in your extension's directory for local testing. Ensure your base URI is set to HTTP. ```bash python3 -m http.server # python 3 python -m SimpleHTTPServer # python 2 ``` -------------------------------- ### Example Response for Get Clip by ID Source: https://dev.twitch.tv/docs/api/reference This is an example of the JSON response when successfully retrieving a clip by its ID. ```json { "data": [ { "id": "AwkwardHelplessSalamanderSwiftRage", "url": "https://clips.twitch.tv/AwkwardHelplessSalamanderSwiftRage", "embed_url": "https://clips.twitch.tv/embed?clip=AwkwardHelplessSalamanderSwiftRage", "broadcaster_id": "67955580", "broadcaster_name": "ChewieMelodies", "creator_id": "53834192", "creator_name": "BlackNova03", "video_id": "205586603", "game_id": "488191", "language": "en", "title": "babymetal", "view_count": 10, "created_at": "2017-11-30T22:34:18Z", "thumbnail_url": "https://clips-media-assets.twitch.tv/157589949-preview-480x272.jpg", "duration": 60, "vod_offset": 480, "is_featured": false } ] } ``` -------------------------------- ### Configure package.json for HTTPS and Postinstall Source: https://dev.twitch.tv/docs/extensions Modify your `package.json` to include a `postinstall` script for certificate setup and configure the `start` script to use HTTPS. This ensures your development server runs securely. ```json // ... "scripts": { "start": "HTTPS=true PORT=8080 react-scripts start", "build": "react-scripts build", "postinstall": "sh install_cert.sh" // ... ``` -------------------------------- ### Get Stream Tags Example Request (Twitch CLI) Source: https://dev.twitch.tv/docs/api/reference Examples using the Twitch CLI to get stream tags. The first command retrieves the first page of tags, while the second retrieves specific tags by ID. ```bash # Twitch CLI example that gets the first page of stream tags. twitch api get /tags/streams ``` ```bash # Twitch CLI example that gets the specified stream tags. twitch api get /tags/streams -q tag_id=39490173-ed5f-4271-96a8-26ab546ee1e9 -q tag_id=233f4789-1ad0-403c-aaf9-7d37a22264e7 ``` -------------------------------- ### Start Mock WebSocket Server Source: https://dev.twitch.tv/docs/cli/websocket-event-command Use this command to start a mock WebSocket server for testing your client. The server listens on `127.0.0.1:8080` and provides an endpoint for simulating EventSub subscriptions. ```bash twitch event websocket start-server ``` -------------------------------- ### Example Response for Get Channel Ad Schedule Source: https://dev.twitch.tv/docs/api/reference Example JSON response structure for the channel ad schedule. ```json { "data": [ { "next_ad_at" : "2023-08-01T23:08:18+00:00", "last_ad_at" : "2023-08-01T23:08:18+00:00", "duration" : "60", "preroll_free_time" : "90", "snooze_count" : "1", "snooze_refresh_at" : "2023-08-01T23:08:18+00:00" } ] } ``` -------------------------------- ### Get Chatters Response Source: https://dev.twitch.tv/docs/api/reference Example response body for the Get Chatters request, showing user data and pagination information. ```json { "data": [ { "user_id": "128393656", "user_login": "smittysmithers", "user_name": "smittysmithers" }, ... ], "pagination": { "cursor": "eyJiIjpudWxsLCJhIjp7Ik9mZnNldCI6NX19" }, "total": 8 } ``` -------------------------------- ### Example Global Configuration Segment Response (Plain Text) Source: https://dev.twitch.tv/docs/api/reference Example response body for a global configuration segment containing plain text content. ```json { "data": [ { "segment": "global", "content": "hello config!", "version": "0.0.1" } ] } ``` -------------------------------- ### Install Git Source: https://dev.twitch.tv/docs/extensions/load-testing-extensions Installs the Git version control system on an Amazon Linux instance. ```bash sudo yum install git ``` -------------------------------- ### Example API Response for Get Top Games Source: https://dev.twitch.tv/docs/api/reference This is an example of the JSON response structure when successfully retrieving a list of top games. ```json { "data": [ { "id": "493057", "name": "PUBG: BATTLEGROUNDS", "box_art_url": "https://static-cdn.jtvnw.net/ttv-boxart/493057-{width}x{height}.jpg", "igdb_id": "27789" }, ... ], "pagination":{"cursor":"eyJiIjpudWxsLCJhIjp7Ik9mZnNldCI6MjB9fQ=="} } ``` -------------------------------- ### Channel Goal Begin Notification Example Source: https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types This is an example of the notification payload received when a channel goal begins. It includes subscription details and event data. ```json { "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": "12345-cool-event", "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" } } ``` -------------------------------- ### Example User Extensions Response Source: https://dev.twitch.tv/docs/api/reference An example JSON response showing the structure of active panel, overlay, and component extensions for a user. ```json { "data": { "panel": { "1": { "active": true, "id": "rh6jq1q334hqc2rr1qlzqbvwlfl3x0", "version": "1.1.0", "name": "TopClip" }, "2": { "active": true, "id": "wi08ebtatdc7oj83wtl9uxwz807l8b", "version": "1.1.8", "name": "Streamlabs Leaderboard" }, "3": { "active": true, "id": "naty2zwfp7vecaivuve8ef1hohh6bo", "version": "1.0.9", "name": "Streamlabs Stream Schedule & Countdown" } }, "overlay": { "1": { "active": true, "id": "zfh2irvx2jb4s60f02jq0ajm8vwgka", "version": "1.0.19", "name": "Streamlabs" } }, "component": { "1": { "active": true, "id": "lqnf3zxk0rv0g7gq92mtmnirjz2cjj", "version": "0.0.1", "name": "Dev Experience Test", "x": 0, "y": 0 }, "2": { "active": false } } } } ``` -------------------------------- ### Install Twitch CLI with Scoop (Windows) Source: https://dev.twitch.tv/docs/cli Use Scoop to install the Twitch CLI on Windows. This method also helps manage versioning. ```bash scoop install twitch-cli ``` -------------------------------- ### Get User Extensions Source: https://dev.twitch.tv/docs/api/reference Gets a list of all extensions (both active and inactive) that the broadcaster has installed. The user ID in the access token identifies the broadcaster. ```APIDOC ## GET https://api.twitch.tv/helix/users/extensions/list ### Description Gets a list of all extensions (both active and inactive) that the broadcaster has installed. The user ID in the access token identifies the broadcaster. ### Authorization Requires a user access token that includes the **user:read:broadcast** or **user:edit:broadcast** scope. To include inactive extensions, you must include the **user:edit:broadcast** scope. ### Method GET ### Endpoint `https://api.twitch.tv/helix/users/extensions/list` ### Response #### Success Response (200 OK) Successfully retrieved the user's installed extensions. - **data** (Object[]) - The list of extensions that the user has installed. - **id** (String) - An ID that identifies the extension. - **version** (String) - The extension's version. - **name** (String) - The extension's name. - **can_activate** (Boolean) - A Boolean value that determines whether the extension is configured and can be activated. Is **true** if the extension is configured and can be activated. - **type** (String[]) - The extension types that you can activate for this extension. Possible values are: component, mobile, overlay, panel. ### Response Example ```json { "data": [ { "id": "wi08ebtatdc7oj83wtl9uxwz807l8b", "version": "1.1.8", "name": "Streamlabs Leaderboard", "can_activate": true, "type": [ "panel" ] }, { "id": "d4uvtfdr04uq6raoenvj7m86gdk16v", "version": "2.0.2", "name": "Prime Subscription and Loot Reminder", "can_activate": true, "type": [ "overlay" ] }, { "id": "rh6jq1q334hqc2rr1qlzqbvwlfl3x0", "version": "1.1.0", "name": "TopClip", "can_activate": true, "type": [ "mobile", "panel" ] }, { "id": "zfh2irvx2jb4s60f02jq0ajm8vwgka", "version": "1.0.19", "name": "Streamlabs", "can_activate": true, "type": [ "mobile", "overlay" ] }, { "id": "lqnf3zxk0rv0g7gq92mtmnirjz2cjj", "version": "0.0.1", "name": "Dev Experience Test", "can_activate": true, "type": [ "component", "mobile", "panel", "overlay" ] } ] } ``` ### Request Example Gets the extensions that the user has installed. ```curl curl -X GET 'https://api.twitch.tv/helix/users/extensions/list' \ -H 'Authorization: Bearer cfabdegwdoklmawdzdo98xt2fo512y' \ -H 'Client-Id: uo6dggojyb8d6soh92zknwmi5ej1q2' ``` ### Response Codes #### Error Response (401 Unauthorized) - The Authorization header is required and must contain a user access token. - The user access token must include the **user:read:broadcast** scope. - The access token is not valid. - The ID specified in the Client-Id header does not match the client ID specified in the access token. ``` -------------------------------- ### Get Channel Followers Response Example Source: https://dev.twitch.tv/docs/api/reference Example response when a user follows the specified broadcaster. The 'data' field will contain follower information. ```json { "total": 8, "data": [ { "broadcaster_id": "654321", "broadcaster_login": "basketweaver101", "broadcaster_name": "BasketWeaver101", "followed_at": "2022-05-24T22:22:08Z" } ], "pagination": {} } ``` -------------------------------- ### Example POST Request for Clips Source: https://dev.twitch.tv/docs/api/reference This example demonstrates how to make a POST request to create a clip. Ensure you include the necessary Authorization and Client-Id headers. ```curl curl -X POST 'https://api.twitch.tv/helix/videos/clips?broadcaster_id=141981764&editor_id=12826&vod_id=2277656159' \ -H 'Authorization: Bearer cfabdegwdoklmawdzdo98xt2fo512y' \ -H 'Client-Id: uo6dggojyb8d6soh92zknwmi5ej1q2' ``` -------------------------------- ### Get Chat Settings API Response Source: https://dev.twitch.tv/docs/chat/irc-migration This is an example JSON response from the Get Chat Settings API, showing the current chatroom configuration. ```json { "data": [ { "broadcaster_id": "141981764", "slow_mode": false, "slow_mode_wait_time": null, "follower_mode": true, "follower_mode_duration": 0, "subscriber_mode": false, "emote_mode": false, "unique_chat_mode": false } ] } ``` -------------------------------- ### Get Followed Streams Response Source: https://dev.twitch.tv/docs/api/reference Example response body for the Get Followed Streams request. It includes a list of live streams and pagination information. ```json { "data": [ { "id": "42170724654", "user_id": "132954738", "user_login": "aws", "user_name": "AWS", "game_id": "417752", "game_name": "Talk Shows & Podcasts", "type": "live", "title": "AWS Howdy Partner! Y'all welcome ExtraHop to the show!", "viewer_count": 20, "started_at": "2021-03-31T20:57:26Z", "language": "en", "thumbnail_url": "https://static-cdn.jtvnw.net/previews-ttv/live_user_aws-{width}x{height}.jpg", "tag_ids": [], "tags": ["English"] }, ... ], "pagination": { "cursor": "eyJiIjp7IkN1cnNvciI6ImV5SnpJam8zT0RNMk5TNDBORFF4TlRjMU1UY3hOU3dpWkNJNlptRnNjMlVzSW5RaU9uUnlkV1Y5In0sImEiOnsiQ3Vyc29yIjoiZXlKeklqb3hOVGs0TkM0MU56RXhNekExTVRZNU1ESXNJbVFpT21aaGJITmxMQ0owSWpwMGNuVmxmUT09In19" } } ``` -------------------------------- ### Start Local HTTPS Server with Python Source: https://dev.twitch.tv/docs/extensions A Python script to start an HTTPS server using locally generated certificates. This script configures the server to use the mkcert-generated certificate and key. ```python #!/usr/bin/env/python import BaseHTTPServer, SimpleHTTPServer import ssl cert_file = "./localhost.pem" key_file = "./localhost-key.pem" class RequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): def end_headers(self): self.send_header("Cache-Control", "no-cache, no-store, must-revalidate") self.send_header("Pragma", "no-cache") self.send_header("Expires", "0") SimpleHTTPServer.SimpleHTTPRequestHandler.end_headers(self) httpd = BaseHTTPServer.HTTPServer( ('', 8080), RequestHandler ) httpd.socket = ssl.wrap_socket( httpd.socket, server_side=True, keyfile=key_file, certfile=cert_file ) httpd.serve_forever() ``` -------------------------------- ### GameTaskMethodBuilder.Start Source: https://dev.twitch.tv/docs/game-engine-plugins/unity-reference Starts the state machine associated with the builder. ```APIDOC ## GameTaskMethodBuilder.Start(ref TStateMachine) ### Description Starts the state machine associated with the builder. ### Syntax ```csharp public void Start(ref TStateMachine stateMachine) where TStateMachine : IAsyncStateMachine ``` ### Parameters #### Parameters - **stateMachine** (TStateMachine) - Description: The state machine to start. ``` -------------------------------- ### Example Response for Get Channel Stream Schedule Source: https://dev.twitch.tv/docs/api/schedule This is an example response from the Get Channel Stream Schedule endpoint. It shows scheduled segments, including recurring broadcasts, a non-recurring stream, and vacation periods. Plan your pagination logic carefully as recurring segments may extend for years. ```json { "data": { "segments": [ { "id": "eyJzZWdtZW50SUQiOiIzNiM2QwLTQwOTQtYWRlMy0zNzVjYTQ0ZjA1NWQiLCJpc29ZZWFyIjoyMDIyLCJpc29XZWVrIjozNH0=", "start_time": "2022-08-24T07:00:00Z", "end_time": "2022-08-24T07:40:00Z", "title": "Emira or Cayman?", "canceled_until": null, "category": 509658, "is_recurring": true }, { "id": "eyJzZWdtZW50SUQiOiJlNjE4OTyLTQ4N2ItYWE2My03Y2I5NmNiZGU5MTgiLCJpc29ZZWFyIjoyMDIyLCJpc29XZWVrIjozNH0=", "start_time": "2022-08-24T07:45:00Z", "end_time": "2022-08-24T08:15:00Z", "title": "First Drive", "canceled_until": null, "category": 509658, "is_recurring": false }, . . . ], "broadcaster_id": "123456", "broadcaster_name": "zippydodah", "broadcaster_login": "ZippyDoDah", "vacation": { "start_time": "2020-09-01T00:00:00Z", "end_time": "2020-09-30T23:59:59Z" } }, "pagination": { "cursor": "eyJiIjpudWxsLCJhIjp7IkN1cnNvci..." } } ``` -------------------------------- ### Example Global Configuration Segment Response (JSON String) Source: https://dev.twitch.tv/docs/api/reference Example response body for a global configuration segment containing a string-encoded JSON object. ```json { "data": [ { "segment": "global", "content": "{\"foo\": \"bar\"}", "version": "0.0.1" } ] } ``` -------------------------------- ### Example User Response Source: https://dev.twitch.tv/docs/api/reference An example of the JSON response when successfully retrieving user information. ```json { "data": [ { "id": "141981764", "login": "twitchdev", "display_name": "TwitchDev", "type": "", "broadcaster_type": "partner", "description": "Supporting third-party developers building Twitch integrations from chatbots to game integrations.", "profile_image_url": "https://static-cdn.jtvnw.net/jtv_user_pictures/8a6381c7-d0c0-4576-b179-38bd5ce1d6af-profile_image-300x300.png", "offline_image_url": "https://static-cdn.jtvnw.net/jtv_user_pictures/3f13ab61-ec78-4fe6-8481-8682cb3b0ac2-channel_offline_image-1920x1080.png", "view_count": 5980557, "email": "not-real@email.com", "created_at": "2016-12-14T20:32:28Z" } ] } ``` -------------------------------- ### Example Response for Get Broadcaster Subscribers Source: https://dev.twitch.tv/docs/api/reference An example of the JSON response when retrieving a broadcaster's subscribers. It details subscriber information, total count, and points earned. ```json { "data": [ { "broadcaster_id": "141981764", "broadcaster_login": "twitchdev", "broadcaster_name": "TwitchDev", "gifter_id": "12826", "gifter_login": "twitch", "gifter_name": "Twitch", "is_gift": true, "tier": "1000", "plan_name": "Channel Subscription (twitchdev)", "user_id": "527115020", "user_name": "twitchgaming", "user_login": "twitchgaming" }, ... ], "pagination": { "cursor": "xxxx" }, "total": 13, "points": 13 } ``` -------------------------------- ### Get Channel Followers Response Example (User Not Following) Source: https://dev.twitch.tv/docs/api/reference Example response when the specified user does not follow the broadcaster, or if the 'user_id' parameter is not provided. The 'data' field will be an empty array. ```json { "total": 8, "data": [ ... ], "pagination": { "cursor": "eyJiIjpudWxsLCJhIjp7Ik9mZnNldCI6NX19" } } ``` -------------------------------- ### PRIVMSG Command Example Source: https://dev.twitch.tv/docs/chat/irc This example shows a user sending a chat message to a specific chat room. ```irc :ronni!ronni@ronni.tmi.twitch.tv PRIVMSG #dallas :Hello, chat! ``` -------------------------------- ### Install Certificates Script Source: https://dev.twitch.tv/docs/extensions Save this bash script as `install_cert.sh` to automate the installation of necessary SSL certificates for HTTPS local development. It installs mkcert and creates a server certificate. ```bash #!/usr/bin/env bash mkcert -install \ -cert-file cert.pem \ -key-file key.pem \ localhost cat cert.pem key.pem > node_modules/webpack-dev-server/ssl/server.pem rm cert.pem key.pem ``` -------------------------------- ### Get EventSub Subscriptions (Twitch CLI) Source: https://dev.twitch.tv/docs/api/reference This example demonstrates how to get a list of your EventSub subscriptions using the Twitch CLI. This is a convenient alternative to using cURL for managing EventSub. ```bash # Twitch CLI example that gets a list of EventSub subscriptions that you created. twitch api get /eventsub/subscriptions ``` -------------------------------- ### Implicit Flow Example Source: https://dev.twitch.tv/docs/authentication/getting-tokens-oidc An example URI to initiate the implicit OAuth flow, which returns tokens in the URI fragment. ```APIDOC ## Implicit Flow ### Description Initiates the implicit OAuth flow by directing the user to an authorization URI. Tokens are returned in the URI fragment upon successful authorization and consent. ### Method GET ### Endpoint https://id.twitch.tv/oauth2/authorize ### Parameters #### Query Parameters - **response_type** (string) - Required - Set to `token+id_token` for the implicit flow. - **client_id** (string) - Required - Your application's client ID. - **redirect_uri** (string) - Required - The URI to redirect to after authorization. - **scope** (string) - Required - Space-separated list of requested scopes. - **claims** (JSON string) - Optional - Specifies the claims to be included in the ID token and userinfo response. - **state** (string) - Required - An opaque value used to maintain state between the request and callback. - **nonce** (string) - Required - A value used to associate a client session with an ID token and to mitigate replay attacks. - **force_verify** (boolean) - Optional - If true, forces the user to re-authenticate and re-consent. ### Request Example ```uri https://id.twitch.tv/oauth2/authorize?response_type=token+id_token&client_id=&redirect_uri=http://localhost:3000&scope=channel%3Amanage%3Apolls+channel%3Aread%3Apolls+openid+user%3Aread%3Aemail&claims={"id_token":{"email":null,"email_verified":null},"userinfo":{"email":null,"email_verified":null,"picture":null,"updated_at":null}}&state=c3ab8aa609ea11e793ae92361f002671&nonce=c3ab8aa609ea11e793ae92361f002671 ``` ### Response Upon successful authorization, the user is redirected to the `redirect_uri` with the `access_token`, `id_token`, and other parameters in the URI fragment. #### Response Example (URI Fragment) ```uri http://localhost:3000/#access_token=zvpmzpt4mz5hceho6pgf1m9erzm1e&id_token=eyJhbGciOiJSUzI1NiIsInR5cCI6IkXVCIsImtpZCI6IjEifQ.eyJhdWQiOiJob2Y1Z3d4MHN1Nm93Zm55czBueWFuOWM4N3pyNnQiLCJleHAiOjE2NDQ1MTY4MjQsImlhdCI6MTY0NDUxNTkyNCwiaXNzIjoiaHR0cHM6Ly9pZC50d2l0Y2gudHYvb2F1dGgyIiwic3ViIjoiNzEzOTM2NzMzIiwiYXRfaGFzaCI6Inc0dHl0eEg3N0piYXpkVzBka2d4UGciLCJlbWFpbCI6InNjb3R3aHRAanVzdGluLnR2IiwiZW1haWxfdmVyaWZpZWQiOnRydWV9.S2V1ZPILEoHUYw3uQtyl_PoPDuAB6z4KjrfXwtAJtKKKOTBsQQIlLIyGVZHqeYmYNW4EG9GTdoopP4RUb_2ETGAoMbQCZsjRnqYI8SAu58yChxRR0iI7tbbC-7j4d2KPGmdSG651uWQHCtRHd1fBfxCrFuaiwH_PoPkI6YQUB6-moscqr7hpHM_3SSP4Nzts9OeSIS52FawcMbeLXKROZDj7MhsktwVhNaQBAdNRJjqeUEL_V6RF_VhxY8iZbv73YJxfcA7O-fjHzEy00Lq7y-pjd_5TSLvkdheNUCdtKEI4tA_9IZzqrOtmy20pGKF4ovKy-HtASH_qEvswmMxD7A&scope=channel%253Amanage%253Apolls+channel%253Aread%253Apolls+openid+user%253Aread%253Aemail&state=c3ab8aa609ea11e793ae92361f002671&token_type=bearer ``` ``` -------------------------------- ### Get Channel Stream Tags Example Request (cURL) Source: https://dev.twitch.tv/docs/api/reference Use this cURL command to get the stream tags for a specific broadcaster. Ensure your Authorization and Client-Id headers are correctly set. ```bash curl -X GET 'https://api.twitch.tv/helix/streams/tags?broadcaster_id=527115020' \ -H 'Authorization: Bearer cfabdegwdoklmawdzdo98xt2fo512y' \ -H 'Client-Id: uo6dggojyb8d6soh92zknwmi5ej1q2' ``` -------------------------------- ### Create a Poll with Channel Points Voting Source: https://dev.twitch.tv/docs/api/polls This example demonstrates creating a poll where viewers can use Channel Points for additional votes. Each extra vote incurs a specified Channel Points cost. ```bash curl -X POST 'https://api.twitch.tv/helix/polls' \ -H 'Authorization: Bearer vpx9etxs8bbii29krls1ljai1kdr' \ -H 'Client-Id: dt4z41sa8uexdkjvt7uu9jjqm575' \ -H 'Content-Type: application/json' \ -d '{"broadcaster_id":"123456","title":"Streaming next Tuesday. Which time works best for you?","choices":[{"title":"9AM"},{"title":"10AM"},{"title":"7PM"},{"title":"8PM"},{"title":"9PM"}],"duration":300,"channel_points_voting_enabled":true,"channel_points_per_vote":200}' ``` -------------------------------- ### Get User Extensions Source: https://dev.twitch.tv/docs/api/reference Retrieves the active extensions installed by a broadcaster. The user is identified by the access token. ```APIDOC ## GET /users/extensions ### Description Retrieves the active extensions installed by a broadcaster. The user is identified by the access token. ### Method GET ### Endpoint https://api.twitch.tv/helix/users/extensions ### Query Parameters - **user_id** (string) - Optional - The ID of the user whose active extensions you want to retrieve. Required if you specify an app access token. ### Response #### Success Response (200 OK) - **data** (Object) - The active extensions that the broadcaster has installed. - **panel** (map[string]Object) - Data for panel extensions. - **overlay** (map[string]Object) - Data for video-overlay extensions. - **component** (map[string]Object) - Data for video-component extensions. ### Response Example ```json { "data": { "panel": { "1": { "active": true, "id": "rh6jq1q334hqc2rr1qlzqbvwlfl3x0", "version": "1.1.0", "name": "TopClip" }, "2": { "active": true, "id": "wi08ebtatdc7oj83wtl9uxwz807l8b", "version": "1.1.8", "name": "Streamlabs Leaderboard" }, "3": { "active": true, "id": "naty2zwfp7vecaivuve8ef1hohh6bo", "version": "1.0.9", "name": "Streamlabs Stream Schedule & Countdown" } }, "overlay": { "1": { "active": true, "id": "zfh2irvx2jb4s60f02jq0ajm8vwgka", "version": "1.0.19", "name": "Streamlabs" } }, "component": { "1": { "active": true, "id": "lqnf3zxk0rv0g7gq92mtmnirjz2cjj", "version": "0.0.1", "name": "Dev Experience Test", "x": 0, "y": 0 }, "2": { "active": false } } } } ``` ``` -------------------------------- ### Get Twitch CLI Version Source: https://dev.twitch.tv/docs/cli/version-command Use the `version` command to display the currently installed version of the Twitch CLI. ```bash twitch version ``` -------------------------------- ### Initialize() Source: https://dev.twitch.tv/docs/game-engine-plugins/unreal-reference Initialize the Twitch API. This is the entry point to the library and starts background tasks. ```APIDOC ## Initialize() ### Description Initialize the Twitch API. This is the entry point to the library. This immediately starts several background tasks, e.g., loading credentials from disk, connecting to EventSub, etc. To stop the library, you need to drop all shared_ptr instances. Then, you also need to transition your platform abstraction layer implementation into a state where it rejects all incoming calls. This is necessary to ensure that all background tasks are terminated and the shared_ptr references inside these callbacks are released. ### Syntax ```cpp static std::shared_ptr< TwitchApi > TwitchSDK::TwitchApi::Initialize(std::shared_ptr< PAL::PlatformAbstractionLayer > pal, string_view clientId, string_view clientSecret, bool useEventSubProxy = false) ``` ### Parameters #### Path Parameters - **pal** (std::shared_ptr< PAL::PlatformAbstractionLayer >) - Required - The platform abstraction layer implementation to use. - **clientId** (string_view) - Required - OAuth Client Id - **clientSecret** (string_view) - Required - OAuth Secret - **useEventSubProxy** (bool) - Optional - Do not enable this in releases. This option instructs the plugin to connect to a local EventSubProxy instead of directly to Twitch. ### Returns An object describing the stream, or an empty object if the channel is offline or does not exist. ```