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

Classes

ApiClientBadgesApiBitsApiChannelChannelApiChannelFollowChannelPlaceholderChannelSubscriptionChatApiChatBadgeListChatBadgeSetChatBadgeVersionChatEmoteChatEmoteListChattersListCheermoteListConfigErrorCreatedVideoEmoteSetListHelixApiGroupHelixBanHelixBanEventHelixBitsApiHelixBitsLeaderboardHelixBitsLeaderboardEntryHelixChannelHelixChannelApiHelixChannelEditorHelixChannelEmoteHelixChannelPointsApiHelixChannelSearchResultHelixChatApiHelixChatBadgeSetHelixChatBadgeVersionHelixCheermoteListHelixClipHelixClipApiHelixCustomRewardHelixCustomRewardRedemptionHelixEmoteHelixEmoteFromSetHelixEventSubApiHelixEventSubSubscriptionHelixExtensionsApiHelixExtensionTransactionHelixFollowHelixGameHelixGameApiHelixHypeTrainApiHelixHypeTrainContributionHelixHypeTrainEventHelixInstalledExtensionHelixInstalledExtensionListHelixModerationApiHelixModeratorHelixModeratorEventHelixPaginatedRequestHelixPaginatedRequestWithTotalHelixPaginatedScheduleSegmentRequestHelixPollHelixPollApiHelixPollChoiceHelixPredictionHelixPredictionApiHelixPredictionOutcomeHelixPredictorHelixPrivilegedUserHelixScheduleHelixScheduleApiHelixScheduleSegmentHelixSearchApiHelixStreamHelixStreamApiHelixStreamMarkerHelixStreamMarkerWithVideoHelixSubscriptionHelixSubscriptionApiHelixSubscriptionEventHelixTagHelixTagApiHelixTeamHelixTeamApiHelixTeamWithUsersHelixUserHelixUserApiHelixUserBlockHelixUserExtensionHelixUserRelationHelixUserSubscriptionHelixVideoHelixVideoApiHelixWebHooksApiHelixWebHookSubscriptionKrakenApiGroupNoSubscriptionProgramErrorPrivilegedChannelPrivilegedUserSearchApiStreamStreamApiStreamNotLiveErrorSubscriptionTeamTeamApiTeamWithUsersUnsupportedApiUserUserApiUserBlockUserChatInfoUserFollowUserSubscriptionVideoVideoApi

HelixEventSubApi

The API methods that deal with WebHooks.

Overview

Methods

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.

ParameterTypeRequiredDefaultDescription
typestringnone

The type of the event.

versionstringnone

The version of the event.

conditionRecord<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.

ParameterTypeRequiredDefaultDescription
idstringnone

The ID of the subscription.

Return type: void

getSubscriptions(pagination)

async

Retrieves the current WebHook subscriptions for the current client.

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

ParameterTypeRequiredDefaultDescription
paginationHelixPaginationnone
pagination.afterstringnone

A cursor to get the following page of.

pagination.beforestringnone

A cursor to get the previous page of.

pagination.limitstringnone

The number of results per page.

getSubscriptionsForStatus(status, pagination)

async

Retrieves 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.

ParameterTypeRequiredDefaultDescription
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.

paginationHelixPaginationnone
pagination.afterstringnone

A cursor to get the following page of.

pagination.beforestringnone

A cursor to get the previous page of.

pagination.limitstringnone

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.

ParameterTypeRequiredDefaultDescription
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.

Return type: HelixPaginatedRequestWithTotal<HelixEventSubSubscriptionData, HelixEventSubSubscription>

getSubscriptionsForType(type, pagination)

async

Retrieves 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.

ParameterTypeRequiredDefaultDescription
typestringnone

The type of the subscriptions to retrieve.

paginationHelixPaginationnone
pagination.afterstringnone

A cursor to get the following page of.

pagination.beforestringnone

A cursor to get the previous page of.

pagination.limitstringnone

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.

ParameterTypeRequiredDefaultDescription
typestringnone

The type of the subscriptions to retrieve.

Return type: HelixPaginatedRequestWithTotal<HelixEventSubSubscriptionData, HelixEventSubSubscription>

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.

Return type: HelixPaginatedRequestWithTotal<HelixEventSubSubscriptionData, HelixEventSubSubscription>

subscribeToChannelBanEvents(broadcaster, transport)

async

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

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

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.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

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.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

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.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

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.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

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.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

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

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelModeratorAddEvents(broadcaster, transport)

async

Subscribe to events that represent a moderator being added to a channel.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

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

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelModeratorRemoveEvents(broadcaster, transport)

async

Subscribe to events that represent a moderator being removed from a channel.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

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

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelPollBeginEvents(broadcaster, transport)

async

Subscribe to events that represent a poll starting in a channel.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster you want to listen to poll begin events for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelPollEndEvents(broadcaster, transport)

async

Subscribe to events that represent a poll ending in a channel.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster you want to listen to poll end events for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelPollProgressEvents(broadcaster, transport)

async

Subscribe to events that represent a poll being voted on in a channel.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster you want to listen to poll progress events for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelPredictionBeginEvents(broadcaster, transport)

async

Subscribe to events that represent a prediction starting in a channel.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster you want to listen to prediction begin events for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelPredictionEndEvents(broadcaster, transport)

async

Subscribe to events that represent a prediction ending in a channel.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster you want to listen to prediction end events for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelPredictionLockEvents(broadcaster, transport)

async

Subscribe to events that represent a prediction being locked in a channel.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster you want to listen to prediction lock events for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelPredictionProgressEvents(broadcaster, transport)

async

Subscribe to events that represent a prediction being voted on in a channel.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster you want to listen to prediction preogress events for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelRaidEventsFrom(broadcaster, transport)

async

Subscribe to events that represent a broadcaster raiding another broadcaster.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

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.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

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.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

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.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster you want to listen to redemption events for.

rewardIdstringnone

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.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

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.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

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

rewardIdstringnone

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.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

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.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

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.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

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

rewardIdstringnone

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

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelRewardUpdateEvents(broadcaster, transport)

async

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

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

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.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

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

rewardIdstringnone

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

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToChannelSubscriptionEndEvents(broadcaster, transport)

async

Subscribe to events that represent a user's subscription to a channel ending.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster you want to listen to subscription end events for.

transport
HelixEventSubTransportOptions
none

The transport options

subscribeToChannelSubscriptionEvents(broadcaster, transport)

async

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

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster you want to listen to subscribe events for.

transport
HelixEventSubTransportOptions
none

The transport options

subscribeToChannelSubscriptionGiftEvents(broadcaster, transport)

async

Subscribe to events that represent a user gifting another user a subscription to a channel.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster you want to listen to subscription gift events for.

transport
HelixEventSubTransportOptions
none

The transport options

subscribeToChannelSubscriptionMessageEvents(broadcaster, transport)

async

Subscribe to events that represent a user's subscription to a channel being announced.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster you want to listen to subscription message events for.

transport
HelixEventSubTransportOptions
none

The transport options

subscribeToChannelUnbanEvents(broadcaster, transport)

async

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

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

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.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster you want to listen to update events for.

transport
HelixEventSubTransportOptions
none

The transport options

subscribeToExtensionBitsTransactionCreateEvents(clientId, transport)

async

Subscribe to events that represent a extension Bits transaction.

ParameterTypeRequiredDefaultDescription
clientIdstringnone

The Client ID for the extension you want to listen to Bits transactions for.

transport
HelixEventSubTransportOptions
none

The transport options.

subscribeToStreamOfflineEvents(broadcaster, transport)

async

Subscribe to events that represent a stream going offline.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

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.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

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.

ParameterTypeRequiredDefaultDescription
clientIdstringnone

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.

ParameterTypeRequiredDefaultDescription
userUserIdResolvablenone

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

transport
HelixEventSubTransportOptions
none

The transport options.