twitcheasy-twitch-bottwitch-authtwitch-auth-tmitwitch-chat-clienttwitch-eventsubtwitch-pubsub-clienttwitch-webhooks
Welcome

HelixEventSubApi

The API methods that deal with WebHooks.

Overview

Can be accessed using client.helix.eventSub on an ApiClient instance.

Before using these methods...

All of the methods in this class assume that you are already running a working EventSub listener at the given callback URL.

If you don't already have one, we recommend use of the twitch-eventsub library, which handles subscribing and unsubscribing to these topics automatically.

Example

const api = new ApiClient(new StaticAuthProvider(clientId, accessToken));
await api.helix.eventSub.subscribeToUserFollowsTo('125328655', { callbackUrl: 'https://example.com' });

Methods

createSubscription(type, version, condition, transport)

async

Sends an arbitrary request to subscribe to an event.

Requires an app access token to work; does not work with user tokens.

Parameter Type Required Default Description
type string none

The type of the event.

version string none

The version of the event.

condition Record<string, unknown> none

The condition of the subscription.

transport
HelixEventSubTransportOptions
none

The transport of the subscription.

deleteAllSubscriptions()

async

Deletes all subscriptions.

Return type: void

deleteBrokenSubscriptions()

async

Deletes all broken subscriptions, i.e. all that are not enabled or pending verification.

Return type: void

deleteSubscription(id)

async

Deletes a subscription.

Parameter Type Required Default Description
id string none

The ID of the subscription.

Return type: void

getSubscriptions()

async

Retrieves the current WebHook subscriptions for the current client.

Requires an app access token to work; does not work with user tokens.

getSubscriptionsPaginated()

Retrieves the current WebHook subscriptions for the current client.

Requires an app access token to work; does not work with user tokens.

Return type: HelixPaginatedRequestWithTotal<HelixEventSubSubscriptionData, HelixEventSubSubscription>

subscribeToChannelBanEvents(broadcaster, transport)

async

Subscribe to events that represent a user being banned in a channel.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster you want to listen to ban events for.

transport
HelixEventSubTransportOptions
none

The transport option.

subscribeToChannelCheerEvents(broadcaster, transport)

async

Subscribe to events that represent a user cheering bits to a channel.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster you want to listen to cheer events for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelFollowEvents(broadcaster, transport)

async

Subscribe to events that represent a user following a channel.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster you want to listen to follow events for.

transport
HelixEventSubTransportOptions
none

The transport options

subscribeToChannelHypeTrainBeginEvents(broadcaster, transport)

async

Subscribe to events that represent the beginning of a Hype Train event in a channel.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster you want to listen to Hype train begin events for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelHypeTrainEndEvents(broadcaster, transport)

async

Subscribe to events that represent the end of a Hype Train event.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster for which you want to listen to Hype Train end events for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelHypeTrainProgressEvents(broadcaster, transport)

async

Subscribe to events that represent progress towards the Hype Train goal.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster for which you want to listen to Hype Train progress events for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelRaidEventsFrom(broadcaster, transport)

async

Subscribe to events that represent a broadcaster raiding another broadcaster.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster you want to listen to outgoing raid events for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelRaidEventsTo(broadcaster, transport)

async

Subscribe to events that represent a broadcaster being raided by another broadcaster.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster you want to listen to incoming raid events for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelRedemptionAddEvents(broadcaster, transport)

async

Subscribe to events that represent a Channel Points reward being redeemed.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster you want to listen to redemption events for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelRedemptionAddEventsForReward(broadcaster, rewardId, transport)

async

Subscribe to events that represent a specific Channel Points reward being redeemed.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster you want to listen to redemption events for.

rewardId string none

The ID of the reward you want to listen to redemption events for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelRedemptionUpdateEvents(broadcaster, transport)

async

Subscribe to events that represent a Channel Points redemption being updated.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster you want to listen to redemption update events for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelRedemptionUpdateEventsForReward(broadcaster, rewardId, transport)

async

Subscribe to events that represent a specific Channel Points reward's redemption being updated.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster you want to listen to redemption update events for.

rewardId string none

The ID of the reward you want to listen to redemption updates for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelRewardAddEvents(broadcaster, transport)

async

Subscribe to events that represent a Channel Points reward being added to a channel.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster you want to listen to reward add events for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelRewardRemoveEvents(broadcaster, transport)

async

Subscribe to events that represent a Channel Points reward being removed from a channel.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster you want to listen to reward remove events for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelRewardRemoveEventsForReward(broadcaster, rewardId, transport)

async

Subscribe to events that represent a specific Channel Points reward being removed from a channel.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster you want to listen to reward remove events for.

rewardId string none

The ID of the reward you want to listen to remove events for.

transport
HelixEventSubTransportOptions
none

The transport events.

subscribeToChannelRewardUpdateEvents(broadcaster, transport)

async

Subscribe to events that represent a Channel Points reward being updated in a channel.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster you want to listen to reward update events for.

transport
HelixEventSubTransportOptions
none

The transport options

subscribeToChannelRewardUpdateEventsForReward(broadcaster, rewardId, transport)

async

Subscribe to events that represent a specific Channel Points reward being updated.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster you want to listen to reward update events for.

rewardId string none

The ID of the reward you want to listen to update events for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelSubscriptionEvents(broadcaster, transport)

async

Subscribe to events that represent a user subscribing to a channel.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster you want to listen to subscribe events for.

transport
HelixEventSubTransportOptions
none

The transport options

subscribeToChannelUnbanEvents(broadcaster, transport)

async

Subscribe to events that represent a user being unbanned in a channel.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster you want to listen to unban events for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelUpdateEvents(broadcaster, transport)

async

Subscribe to events that represent a channel updating their metadata.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster you want to listen to update events for.

transport
HelixEventSubTransportOptions
none

The transport options

subscribeToStreamOfflineEvents(broadcaster, transport)

async

Subscribe to events that represent a stream going offline.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster you want to listen to online events for.

transport
HelixEventSubTransportOptions
none

The transport options

subscribeToStreamOnlineEvents(broadcaster, transport)

async

Subscribe to events that represent a stream going live.

Parameter Type Required Default Description
broadcaster UserIdResolvable none

The broadcaster you want to listen to online events for.

transport
HelixEventSubTransportOptions
none

The transport options

subscribeToUserAuthorizationRevokeEvents(clientId, transport)

async

Subscribe to events that represent a user revoking their authorization from an application.

Parameter Type Required Default Description
clientId string none

The Client ID for the application you want to listen to authorization revoke events for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToUserUpdateEvents(user, transport)

async

Subscribe to events that represent a user updating their account details.

Parameter Type Required Default Description
user UserIdResolvable none

The user you want to listen to user update events for.

transport
HelixEventSubTransportOptions
none

The transport options.