Reference / API groups
twitch.conduits
Conduits: the EventSub transport that spreads events over several shards.
Every method of twitch.conduits, with its parameters, what it returns and the token it needs.
twitch.conduits.list(options?): Promise<Conduit[]>Lists the conduits of your application.
Token: app.
Parameters
Section titled “Parameters”This method takes no parameters of its own.
options: Request options for this call: as, token, signal, timeout, retries.
Returns
Section titled “Returns”Promise<Conduit[]>
Fields of Conduit
| Name | Type | Description |
|---|---|---|
id | string | ID of the conduit. |
shard_count | number | Number of shards the conduit has. |
Example
Section titled “Example”const conduits = await twitch.conduits.list();create
Section titled “create”twitch.conduits.create(params, options?): Promise<Conduit>Creates a conduit with the given number of shards.
Token: app.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
shard_count required | number | Number of shards to create. |
options: Request options for this call: as, token, signal, timeout, retries.
Returns
Section titled “Returns”Promise<Conduit>
Fields of Conduit
| Name | Type | Description |
|---|---|---|
id | string | ID of the conduit. |
shard_count | number | Number of shards the conduit has. |
Example
Section titled “Example”const conduit = await twitch.conduits.create({ shard_count: 2 });update
Section titled “update”twitch.conduits.update(params, options?): Promise<Conduit>Changes the number of shards of a conduit.
Token: app.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
id required | string | ID of the conduit. |
shard_count required | number | New number of shards. Lowering it removes the shards with the highest IDs. |
options: Request options for this call: as, token, signal, timeout, retries.
Returns
Section titled “Returns”Promise<Conduit>
Fields of Conduit
| Name | Type | Description |
|---|---|---|
id | string | ID of the conduit. |
shard_count | number | Number of shards the conduit has. |
Example
Section titled “Example”await twitch.conduits.update({ id: conduit.id, shard_count: 5 });delete
Section titled “delete”twitch.conduits.delete(id, options?): Promise<void>Deletes a conduit. Its subscriptions stop shortly after.
Token: app.
Parameters
Section titled “Parameters”id: string
options: Request options for this call: as, token, signal, timeout, retries.
Returns
Section titled “Returns”Promise<void>
Example
Section titled “Example”await twitch.conduits.delete(conduit.id);shards
Section titled “shards”twitch.conduits.shards(params, options?): Paginator<ConduitShard>Lists the shards of a conduit and where each one delivers events.
Token: app.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
conduit_id required | string | ID of the conduit. |
status | ConduitShardStatus | Only shards in this state. |
after | string | Cursor of the next page. |
options: Request options for this call: as, token, signal, timeout, retries.
Returns
Section titled “Returns”Paginator<ConduitShard>
Fields of ConduitShard
| Name | Type | Description |
|---|---|---|
id | string | ID of the shard: its index, starting at "0". |
status | ConduitShardStatus | Current state of the shard. |
transport | ConduitShardTransport | Where the shard delivers events. |
Example
Section titled “Example”const shards = await twitch.conduits.shards({ conduit_id: conduit.id }).all();updateShards
Section titled “updateShards”twitch.conduits.updateShards(params, options?): Promise<UpdateConduitShardsResult>Points shards at a webhook callback or a WebSocket session. Shards that
could not be updated are reported in errors instead of throwing.
Token: app.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
conduit_id required | string | ID of the conduit. |
shards required | readonly { id: string; transport: ConduitShardTransportInput; }[] | Shards to update. Any number: long lists are split for you. |
options: Request options for this call: as, token, signal, timeout, retries.
Returns
Section titled “Returns”Promise<UpdateConduitShardsResult>
Fields of UpdateConduitShardsResult
| Name | Type | Description |
|---|---|---|
data | ConduitShard[] | Shards that were updated. |
errors | ConduitShardError[] | Shards that could not be updated. |
Example
Section titled “Example”const { errors } = await twitch.conduits.updateShards({ conduit_id: conduit.id, shards: [{ id: "0", transport: { method: "websocket", session_id } }],});