conduits - YoYoGames/GMEXT-Twitch GitHub Wiki

Conduits

Functions

These are the functions of this module:



Back To Top

twitch_conduits_get_conduits

Twitch Endpoint: Get Conduits

This function gets the conduits for a client 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_conduits_get_conduits(callback_success, callback_failed)
Argument Type Description
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 List of information about the client's conduits.
 ├── id String Conduit ID.
 └── shard_count Real Number of shards associated with this conduit.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_conduits_create_conduits

Twitch Endpoint: Create Conduits

This function creates a new conduit.

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_conduits_create_conduits(shard_count, callback_success, callback_failed)
Argument Type Description
shard_count Real The number of shards to create for this conduit.
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 List of information about the client's conduits.
 ├── id String Conduit ID.
 └── shard_count Real Number of shards created for this conduit.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_conduits_update_conduits

Twitch Endpoint: Update Conduits

This function updates a conduit's shard count. To delete shards, update the count to a lower number, and the shards above the count will be deleted. For example, if the existing shard count is 100, by resetting shard count to 50, shards 50-99 are disabled.

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_conduits_update_conduits(id, shard_count, callback_success, callback_failed)
Argument Type Description
id String Conduit ID.
shard_count Real The new number of shards for this conduit.
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 List of information about the client's conduits.
 ├── id String Conduit ID.
 └── shard_count Real Number of shards associated with this conduit after the update.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_conduits_delete_conduit

Twitch Endpoint: Delete Conduit

This function deletes a specified conduit. Note that it may take some time for Eventsub subscriptions on a deleted conduit to show as disabled when calling Get Eventsub Subscriptions.

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_conduits_delete_conduit(id, callback_success, callback_failed)
Argument Type Description
id String Conduit ID.
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. It has no response body.


Failure Callback

This method is triggered on failure.




Back To Top

twitch_conduits_get_conduit_shards

Twitch Endpoint: Get Conduit Shards

This function gets a lists of all shards for a conduit.

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_conduits_get_conduit_shards(conduit_id, optionals, callback_success, callback_failed)
Argument Type Description
conduit_id String Conduit ID.
optionals Struct The optional parameters to be passed into the function:

- status : String : Status to filter by.
- after : String : The cursor used to get the next page of results. The Pagination struct in the response contains the cursor's value.
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 List of information about a conduit's shards.
 ├── id String Shard ID.
 ├── status String The shard status. The subscriber receives events only for enabled shards. Possible values are: "enabled" — The shard is enabled, "webhook_callback_verification_pending" — The shard is pending verification of the specified callback URL, "webhook_callback_verification_failed" — The specified callback URL failed verification, "notification_failures_exceeded" — The notification delivery failure rate was too high, "websocket_disconnected" — The client closed the connection, "websocket_failed_ping_pong" — The client failed to respond to a ping message, "websocket_received_inbound_traffic" — The client sent a non-pong message. Clients may only send pong messages (and only in response to a ping message), "websocket_internal_error" — The Twitch WebSocket server experienced an unexpected error, "websocket_network_timeout" — The Twitch WebSocket server timed out writing the message to the client, "websocket_network_error" — The Twitch WebSocket server experienced a network error writing the message to the client, "websocket_failed_to_reconnect" - The client failed to reconnect to the Twitch WebSocket server within the required time after a Reconnect Message.
 └── transport Struct The transport details used to send the notifications.
         ├── method String The transport method. Possible values are: "webhook", "websocket"
         ├── callback String The callback URL where the notifications are sent. Included only if method is set to webhook.
         ├── session_id String An ID that identifies the WebSocket that notifications are sent to. Included only if method is set to websocket.
         ├── connected_at String The UTC date and time that the WebSocket connection was established. Included only if method is set to websocket.
         └── disconnected_at String The UTC date and time that the WebSocket connection was lost. Included only if method is set to websocket.
pagination Struct Contains information used to page through a list of results. The struct is empty if there are no more pages left to page through.
 └── cursor String The cursor used to get the next page of results. Use the cursor to set the request's after parameter.

Failure Callback

This method is triggered on failure.




Back To Top

twitch_conduits_update_conduit_shards

Twitch Endpoint: Update Conduit Shards

This function updates shard(s) for a conduit.

Note

 Shard IDs are indexed starting at 0, so a conduit with a shard_count of 5 will have shards with IDs 0 through 4.

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_conduits_update_conduit_shards(conduit_id, shards, id, transport, optionals, callback_success, callback_failed)
Argument Type Description
conduit_id String Conduit ID.
shards Array of Struct List of shards to update.
id String Shard ID.
transport Struct The transport details that you want Twitch to use when sending you notifications.
optionals Struct The optional parameters to be passed into the function:

- method : String : The transport method. Possible values are: "webhook", "websocket"
- callback : String : The callback URL where the notifications are sent. The URL must use the HTTPS protocol and port 443. See Processing an event. Specify this field only if method is set to webhook. NOTE: Redirects are not followed.
- secret : String : The secret used to verify the signature. The secret must be an ASCII string that's a minimum of 10 characters long and a maximum of 100 characters long. For information about how the secret is used, see Verifying the event message. Specify this field only if method is set to webhook.
- session_id : String : An ID that identifies the WebSocket to send notifications to. When you connect to EventSub using WebSockets, the server returns the ID in the Welcome message. Specify this field only if method is set to websocket.
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 List of successful shard updates.
 ├── id String Shard ID.
 ├── status String The shard status. The subscriber receives events only for enabled shards. Possible values are: "enabled" — The shard is enabled, "webhook_callback_verification_pending" — The shard is pending verification of the specified callback URL, "webhook_callback_verification_failed" — The specified callback URL failed verification, "notification_failures_exceeded" — The notification delivery failure rate was too high, "websocket_disconnected" — The client closed the connection, "websocket_failed_ping_pong" — The client failed to respond to a ping message, "websocket_received_inbound_traffic" — The client sent a non-pong message. Clients may only send pong messages (and only in response to a ping message), "websocket_internal_error" — The Twitch WebSocket server experienced an unexpected error, "websocket_network_timeout" — The Twitch WebSocket server timed out writing the message to the client, "websocket_network_error" — The Twitch WebSocket server experienced a network error writing the message to the client, "websocket_failed_to_reconnect" - The client failed to reconnect to the Twitch WebSocket server within the required time after a Reconnect Message.
 └── transport Struct The transport details used to send the notifications.
         ├── method String The transport method. Possible values are: "webhook", "websocket"
         ├── callback String The callback URL where the notifications are sent. Included only if method is set to webhook.
         ├── session_id String An ID that identifies the WebSocket that notifications are sent to. Included only if method is set to websocket.
         ├── connected_at String The UTC date and time that the WebSocket connection was established. Included only if method is set to websocket.
         └── disconnected_at String The UTC date and time that the WebSocket connection was lost. Included only if method is set to websocket.
errors Array List of unsuccessful updates.
 ├── id String Shard ID.
 ├── message String The error that occurred while updating the shard. Possible errors: - The length of the string in the secret field is not valid. - The URL in the transport's callback field is not valid. The URL must use the HTTPS protocol and the 443 port number. - The value specified in the method field is not valid. - The callback field is required if you specify the webhook transport method. - The session_id field is required if you specify the WebSocket transport method. - The websocket session is not connected. - The shard id is outside of the conduit's range.
 └── code String Error codes used to represent a specific error condition while attempting to update shards.

Failure Callback

This method is triggered on failure.



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