Skip to content
twitch.apiv2.0

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.

This method takes no parameters of its own.

options: Request options for this call: as, token, signal, timeout, retries.

Promise<Conduit[]>

Fields of Conduit
NameTypeDescription
idstringID of the conduit.
shard_countnumberNumber of shards the conduit has.
const conduits = await twitch.conduits.list();

Twitch reference

twitch.conduits.create(params, options?): Promise<Conduit>

Creates a conduit with the given number of shards.

Token: app.

NameTypeDescription
shard_count requirednumberNumber of shards to create.

options: Request options for this call: as, token, signal, timeout, retries.

Promise<Conduit>

Fields of Conduit
NameTypeDescription
idstringID of the conduit.
shard_countnumberNumber of shards the conduit has.
const conduit = await twitch.conduits.create({ shard_count: 2 });

Twitch reference

twitch.conduits.update(params, options?): Promise<Conduit>

Changes the number of shards of a conduit.

Token: app.

NameTypeDescription
id requiredstringID of the conduit.
shard_count requirednumberNew number of shards. Lowering it removes the shards with the highest IDs.

options: Request options for this call: as, token, signal, timeout, retries.

Promise<Conduit>

Fields of Conduit
NameTypeDescription
idstringID of the conduit.
shard_countnumberNumber of shards the conduit has.
await twitch.conduits.update({ id: conduit.id, shard_count: 5 });

Twitch reference

twitch.conduits.delete(id, options?): Promise<void>

Deletes a conduit. Its subscriptions stop shortly after.

Token: app.

id: string

options: Request options for this call: as, token, signal, timeout, retries.

Promise<void>

await twitch.conduits.delete(conduit.id);

Twitch reference

twitch.conduits.shards(params, options?): Paginator<ConduitShard>

Lists the shards of a conduit and where each one delivers events.

Token: app.

NameTypeDescription
conduit_id requiredstringID of the conduit.
statusConduitShardStatusOnly shards in this state.
afterstringCursor of the next page.

options: Request options for this call: as, token, signal, timeout, retries.

Paginator<ConduitShard>

Fields of ConduitShard
NameTypeDescription
idstringID of the shard: its index, starting at "0".
statusConduitShardStatusCurrent state of the shard.
transportConduitShardTransportWhere the shard delivers events.
const shards = await twitch.conduits.shards({ conduit_id: conduit.id }).all();

Twitch reference

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.

NameTypeDescription
conduit_id requiredstringID of the conduit.
shards requiredreadonly { 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.

Promise<UpdateConduitShardsResult>

Fields of UpdateConduitShardsResult
NameTypeDescription
dataConduitShard[]Shards that were updated.
errorsConduitShardError[]Shards that could not be updated.
const { errors } = await twitch.conduits.updateShards({
conduit_id: conduit.id,
shards: [{ id: "0", transport: { method: "websocket", session_id } }],
});

Twitch reference