Overview
Methods
- createSubscriptiona
 - deleteAllSubscriptionsa
 - deleteBrokenSubscriptionsa
 - deleteSubscriptiona
 - getSubscriptionsa
 - getSubscriptionsForStatusa
 - getSubscriptionsForStatusPaginated
 - getSubscriptionsForTypea
 - getSubscriptionsForTypePaginated
 - getSubscriptionsPaginated
 - subscribeToChannelBanEventsa
 - subscribeToChannelCheerEventsa
 - subscribeToChannelFollowEventsa
 - subscribeToChannelHypeTrainBeginEventsa
 - subscribeToChannelHypeTrainEndEventsa
 - subscribeToChannelHypeTrainProgressEventsa
 - subscribeToChannelModeratorAddEventsa
 - subscribeToChannelModeratorRemoveEventsa
 - subscribeToChannelPollBeginEventsa
 - subscribeToChannelPollEndEventsa
 - subscribeToChannelPollProgressEventsa
 - subscribeToChannelPredictionBeginEventsa
 - subscribeToChannelPredictionEndEventsa
 - subscribeToChannelPredictionLockEventsa
 - subscribeToChannelPredictionProgressEventsa
 - subscribeToChannelRaidEventsFroma
 - subscribeToChannelRaidEventsToa
 - subscribeToChannelRedemptionAddEventsa
 - subscribeToChannelRedemptionAddEventsForRewarda
 - subscribeToChannelRedemptionUpdateEventsa
 - subscribeToChannelRedemptionUpdateEventsForRewarda
 - subscribeToChannelRewardAddEventsa
 - subscribeToChannelRewardRemoveEventsa
 - subscribeToChannelRewardRemoveEventsForRewarda
 - subscribeToChannelRewardUpdateEventsa
 - subscribeToChannelRewardUpdateEventsForRewarda
 - subscribeToChannelSubscriptionEndEventsa
 - subscribeToChannelSubscriptionEventsa
 - subscribeToChannelSubscriptionGiftEventsa
 - subscribeToChannelSubscriptionMessageEventsa
 - subscribeToChannelUnbanEventsa
 - subscribeToChannelUpdateEventsa
 - subscribeToExtensionBitsTransactionCreateEventsa
 - subscribeToStreamOfflineEventsa
 - subscribeToStreamOnlineEventsa
 - subscribeToUserAuthorizationRevokeEventsa
 - subscribeToUserUpdateEventsa
 
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)
asyncSends 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport of the subscription.  | 
deleteBrokenSubscriptions()
asyncDeletes all broken subscriptions, i.e. all that are not enabled or pending verification.
deleteSubscription(id)
asyncDeletes a subscription.
| Parameter | Type | Required | Default | Description | 
|---|---|---|---|---|
| id | string | none | The ID of the subscription.  | 
getSubscriptions(pagination)
asyncRetrieves the current WebHook subscriptions for the current client.
Requires an app access token to work; does not work with user tokens.
| Parameter | Type | Required | Default | Description | 
|---|---|---|---|---|
| pagination | HelixPagination | none | ||
| pagination.after | string | none | A cursor to get the following page of.  | |
| pagination.before | string | none | A cursor to get the previous page of.  | |
| pagination.limit | string | none | The number of results per page.  | 
getSubscriptionsForStatus(status, pagination)
asyncRetrieves the current WebHook subscriptions with the given status for the current client.
Requires an app access token to work; does not work with user tokens.
| Parameter | Type | Required | Default | Description | 
|---|---|---|---|---|
| status | HelixEventSubSubscriptionStatus Aliased type: "enabled" | "webhook_callback_verification_pending" | "webhook_callback_verification_failed" | "notification_failures_exceeded" | "authorization_revoked" | "user_removed"  | none | The status of the subscriptions to retrieve.  | |
| pagination | HelixPagination | none | ||
| pagination.after | string | none | A cursor to get the following page of.  | |
| pagination.before | string | none | A cursor to get the previous page of.  | |
| pagination.limit | string | none | The number of results per page.  | 
getSubscriptionsForStatusPaginated(status)
Creates a paginator for the current WebHook subscriptions with the given status for the current client.
Requires an app access token to work; does not work with user tokens.
| Parameter | Type | Required | Default | Description | 
|---|---|---|---|---|
| status | HelixEventSubSubscriptionStatus Aliased type: "enabled" | "webhook_callback_verification_pending" | "webhook_callback_verification_failed" | "notification_failures_exceeded" | "authorization_revoked" | "user_removed"  | none | The status of the subscriptions to retrieve.  | 
getSubscriptionsForType(type, pagination)
asyncRetrieves the current WebHook subscriptions with the given type for the current client.
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 subscriptions to retrieve.  | |
| pagination | HelixPagination | none | ||
| pagination.after | string | none | A cursor to get the following page of.  | |
| pagination.before | string | none | A cursor to get the previous page of.  | |
| pagination.limit | string | none | The number of results per page.  | 
getSubscriptionsForTypePaginated(type)
Creates a paginator for the current WebHook subscriptions with the given type for the current client.
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 subscriptions to retrieve.  | 
getSubscriptionsPaginated()
Creates a paginator for the current WebHook subscriptions for the current client.
Requires an app access token to work; does not work with user tokens.
subscribeToChannelBanEvents(broadcaster, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport option.  | 
subscribeToChannelCheerEvents(broadcaster, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelFollowEvents(broadcaster, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options  | 
subscribeToChannelHypeTrainBeginEvents(broadcaster, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelHypeTrainEndEvents(broadcaster, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelHypeTrainProgressEvents(broadcaster, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelModeratorAddEvents(broadcaster, transport)
asyncSubscribe to events that represent a moderator being added to a channel.
| Parameter | Type | Required | Default | Description | 
|---|---|---|---|---|
| broadcaster | UserIdResolvable | none | The broadcaster you want to listen for moderator add events for.  | |
| transport | HelixEventSubTransportOptions Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelModeratorRemoveEvents(broadcaster, transport)
asyncSubscribe to events that represent a moderator being removed from a channel.
| Parameter | Type | Required | Default | Description | 
|---|---|---|---|---|
| broadcaster | UserIdResolvable | none | The broadcaster you want to listen for moderator remove events for.  | |
| transport | HelixEventSubTransportOptions Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelPollBeginEvents(broadcaster, transport)
asyncSubscribe to events that represent a poll starting in a channel.
| Parameter | Type | Required | Default | Description | 
|---|---|---|---|---|
| broadcaster | UserIdResolvable | none | The broadcaster you want to listen to poll begin events for.  | |
| transport | HelixEventSubTransportOptions Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelPollEndEvents(broadcaster, transport)
asyncSubscribe to events that represent a poll ending in a channel.
| Parameter | Type | Required | Default | Description | 
|---|---|---|---|---|
| broadcaster | UserIdResolvable | none | The broadcaster you want to listen to poll end events for.  | |
| transport | HelixEventSubTransportOptions Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelPollProgressEvents(broadcaster, transport)
asyncSubscribe to events that represent a poll being voted on in a channel.
| Parameter | Type | Required | Default | Description | 
|---|---|---|---|---|
| broadcaster | UserIdResolvable | none | The broadcaster you want to listen to poll progress events for.  | |
| transport | HelixEventSubTransportOptions Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelPredictionBeginEvents(broadcaster, transport)
asyncSubscribe to events that represent a prediction starting in a channel.
| Parameter | Type | Required | Default | Description | 
|---|---|---|---|---|
| broadcaster | UserIdResolvable | none | The broadcaster you want to listen to prediction begin events for.  | |
| transport | HelixEventSubTransportOptions Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelPredictionEndEvents(broadcaster, transport)
asyncSubscribe to events that represent a prediction ending in a channel.
| Parameter | Type | Required | Default | Description | 
|---|---|---|---|---|
| broadcaster | UserIdResolvable | none | The broadcaster you want to listen to prediction end events for.  | |
| transport | HelixEventSubTransportOptions Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelPredictionLockEvents(broadcaster, transport)
asyncSubscribe to events that represent a prediction being locked in a channel.
| Parameter | Type | Required | Default | Description | 
|---|---|---|---|---|
| broadcaster | UserIdResolvable | none | The broadcaster you want to listen to prediction lock events for.  | |
| transport | HelixEventSubTransportOptions Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelPredictionProgressEvents(broadcaster, transport)
asyncSubscribe to events that represent a prediction being voted on in a channel.
| Parameter | Type | Required | Default | Description | 
|---|---|---|---|---|
| broadcaster | UserIdResolvable | none | The broadcaster you want to listen to prediction preogress events for.  | |
| transport | HelixEventSubTransportOptions Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelRaidEventsFrom(broadcaster, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelRaidEventsTo(broadcaster, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelRedemptionAddEvents(broadcaster, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelRedemptionAddEventsForReward(broadcaster, rewardId, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelRedemptionUpdateEvents(broadcaster, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelRedemptionUpdateEventsForReward(broadcaster, rewardId, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelRewardAddEvents(broadcaster, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelRewardRemoveEvents(broadcaster, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelRewardRemoveEventsForReward(broadcaster, rewardId, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelRewardUpdateEvents(broadcaster, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelRewardUpdateEventsForReward(broadcaster, rewardId, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelSubscriptionEndEvents(broadcaster, transport)
asyncSubscribe to events that represent a user's subscription to a channel ending.
| Parameter | Type | Required | Default | Description | 
|---|---|---|---|---|
| broadcaster | UserIdResolvable | none | The broadcaster you want to listen to subscription end events for.  | |
| transport | HelixEventSubTransportOptions Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options  | 
subscribeToChannelSubscriptionEvents(broadcaster, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options  | 
subscribeToChannelSubscriptionGiftEvents(broadcaster, transport)
asyncSubscribe to events that represent a user gifting another user a subscription to a channel.
| Parameter | Type | Required | Default | Description | 
|---|---|---|---|---|
| broadcaster | UserIdResolvable | none | The broadcaster you want to listen to subscription gift events for.  | |
| transport | HelixEventSubTransportOptions Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options  | 
subscribeToChannelSubscriptionMessageEvents(broadcaster, transport)
asyncSubscribe to events that represent a user's subscription to a channel being announced.
| Parameter | Type | Required | Default | Description | 
|---|---|---|---|---|
| broadcaster | UserIdResolvable | none | The broadcaster you want to listen to subscription message events for.  | |
| transport | HelixEventSubTransportOptions Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options  | 
subscribeToChannelUnbanEvents(broadcaster, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToChannelUpdateEvents(broadcaster, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options  | 
subscribeToExtensionBitsTransactionCreateEvents(clientId, transport)
asyncSubscribe to events that represent a extension Bits transaction.
| Parameter | Type | Required | Default | Description | 
|---|---|---|---|---|
| clientId | string | none | The Client ID for the extension you want to listen to Bits transactions for.  | |
| transport | HelixEventSubTransportOptions Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToStreamOfflineEvents(broadcaster, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options  | 
subscribeToStreamOnlineEvents(broadcaster, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options  | 
subscribeToUserAuthorizationRevokeEvents(clientId, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  | 
subscribeToUserUpdateEvents(user, transport)
asyncSubscribe 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 Aliased type: HelixEventSubWebHookTransportOptions  | none | The transport options.  |