TwurpleAuthenticationGetting dataExamplesFAQMigration

EventSubMiddleware

An Express middleware for the Twitch EventSub event distribution mechanism.

Overview

You can find an extensive example on how to use this class in the documentation.

Constructor

new EventSubMiddleware(config)

Creates a new EventSub middleware wrapper.

ParameterTypeRequiredDefaultDescription
configEventSubMiddlewareConfignonesee below
config.apiClientApiClientnone

The API client that will be used to subscribe to events.

config.helperRoutesbooleannone

Whether to add additional helper routes such as the test route at the root.

Enabled by default. Set this to false to disable it.

config.hostNamestringnone

The host name the root application is available under.

config.loggerPartial<LoggerOptions>none

Options to pass to the logger.

config.pathPrefixstringnone

The path your listener is mounted under.

config.secretstringnone

Your EventSub secret.

This should be a randomly generated string, but it should be the same between restarts.

WARNING: Please do not use your application's client secret!

config.strictHostCheckbooleannone

Whether to ignore packets that are not sent with a Host header matching the configured host name.

Enabled by default. Set this to false to disable it.

config.usePathPrefixInHandlersbooleannone

Whether the path prefix will added to the mount point. Defaults to true.

Must be false if you use this with subrouters.

Events

onRevoke((subscription, status) => { /* ... */ })

Fires when a subscription is revoked.

ParameterTypeDescription
subscriptionEventSubSubscription<unknown>

The subscription that was revoked.

status
HelixEventSubSubscriptionStatus

Aliased type: "enabled" | "webhook_callback_verification_pending" | "webhook_callback_verification_failed" | "notification_failures_exceeded" | "authorization_revoked" | "moderator_removed" | "user_removed" | "version_removed" | "beta_maintenance" | "websocket_disconnected" | "websocket_failed_ping_pong" | "websocket_received_inbound_traffic" | "websocket_connection_unused" | "websocket_internal_error" | "websocket_network_timeout" | "websocket_network_error" | "conduit_deleted"

none

onSubscriptionCreateFailure((subscription, error) => { /* ... */ })

Fires when the client fails to create a subscription.

ParameterTypeDescription
subscriptionEventSubSubscription<unknown>

The subscription that was not successfully created.

errorError

The error that was thrown.

onSubscriptionCreateSuccess((subscription, apiSubscription) => { /* ... */ })

Fires when the client successfully created a subscription.

ParameterTypeDescription
subscriptionEventSubSubscription<unknown>

The subscription that was successfully created.

apiSubscriptionHelixEventSubSubscription

The subscription data from the API.

onSubscriptionDeleteFailure((subscription, error) => { /* ... */ })

Fires when the client fails to delete a subscription.

ParameterTypeDescription
subscriptionEventSubSubscription<unknown>

The subscription that was not successfully deleted.

errorError

The error that was thrown.

onSubscriptionDeleteSuccess((subscription) => { /* ... */ })

Fires when the client successfully deleted a subscription.

ParameterTypeDescription
subscriptionEventSubSubscription<unknown>

The subscription that was successfully deleted.

onVerify((success, subscription) => { /* ... */ })

Fires when a subscription is successfully verified or fails to verify.

ParameterTypeDescription
successboolean

Whether the verification succeeded.

subscriptionEventSubSubscription<unknown>

The subscription that was verified.

Methods

addListener<Args>(event, listener)

ParameterTypeRequiredDefaultDescription
event EventBinder<Args>nonenone
listener EventHandler<Args>nonenone
Return type: Listener

apply(router)

Applies middleware that handles EventSub notifications to an Express app/router.

ParameterTypeRequiredDefaultDescription
routerIRouternone

The app or router the middleware should be applied to.

Return type: void

markAsReady()

async

Marks the middleware as ready to receive events.

The express app should be started before this.

Return type: void

on<Args>(event, listener)

ParameterTypeRequiredDefaultDescription
event EventBinder<Args>nonenone
listener EventHandler<Args>nonenone
Return type: Listener

onChannelAdBreakBegin(user, handler)

Subscribes to events that represent an ad break beginning.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications about ad breaks in their channel.

handler(data: EventSubChannelAdBreakBeginEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelBan(user, handler)

Subscribes to events that represent a user getting banned from a channel.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications for when users get banned in their channel.

handler(event: EventSubChannelBanEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelCharityCampaignProgress(user, handler)

Subscribes to events that represent progress in a charity campaign in a channel.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications about charity campaign progress.

handler(event: EventSubChannelCharityCampaignProgressEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelCharityCampaignStart(user, handler)

Subscribes to events that represent a charity campaign starting in a channel.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications about charity campaigns starting.

handler(event: EventSubChannelCharityCampaignStartEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelCharityCampaignStop(user, handler)

Subscribes to events that represent a charity campaign ending in a channel.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications about charity campaigns ending.

handler(event: EventSubChannelCharityCampaignStopEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelCharityDonation(user, handler)

Subscribes to events that represent a donation to a charity campaign in a channel.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications about charity campaign donations.

handler(event: EventSubChannelCharityDonationEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelChatClear(broadcaster, user, handler)

Subscribes to events that represent an channel's chat being cleared.

ParameterTypeRequiredDefaultDescription
broadcaster
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications about chat being cleared in their channel.

user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user to use for reading the channel's chat.

handler(data: EventSubChannelChatClearEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelChatClearUserMessages(broadcaster, user, handler)

Subscribes to events that represent a user's chat messages being cleared in a channel.

ParameterTypeRequiredDefaultDescription
broadcaster
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications about a user's chat messages being cleared in their channel.

user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user to use for reading the channel's chat.

handler(data: EventSubChannelChatClearUserMessagesEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelChatMessage(broadcaster, user, handler)

Subscribes to events that represent a chat message being sent to a channel.

ParameterTypeRequiredDefaultDescription
broadcaster
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get chat message notifications in their channel.

user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user to use for reading the channel's chat.

handler(data: EventSubChannelChatMessageEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelChatMessageDelete(broadcaster, user, handler)

Subscribes to events that represent a chat message being deleted in a channel.

ParameterTypeRequiredDefaultDescription
broadcaster
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications about a chat message being deleted in their channel.

user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user to use for reading the channel's chat.

handler(data: EventSubChannelChatMessageDeleteEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelChatNotification(broadcaster, user, handler)

Subscribes to events that represent a chat notification being sent to a channel.

ParameterTypeRequiredDefaultDescription
broadcaster
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get chat notifications in their channel.

user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user to use for reading the channel's chat.

handler(data:
EventSubChannelChatNotificationEvent

Aliased type: EventSubChannelChatSubNotificationEvent | EventSubChannelChatResubNotificationEvent | EventSubChannelChatSubGiftNotificationEvent | EventSubChannelChatCommunitySubGiftNotificationEvent | EventSubChannelChatGiftPaidUpgradeNotificationEvent | EventSubChannelChatPrimePaidUpgradeNotificationEvent | EventSubChannelChatRaidNotificationEvent | EventSubChannelChatUnraidNotificationEvent | EventSubChannelChatPayItForwardNotificationEvent | EventSubChannelChatAnnouncementNotificationEvent | EventSubChannelChatCharityDonationNotificationEvent | EventSubChannelChatBitsBadgeTierNotificationEvent

) => void
none

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelChatSettingsUpdate(broadcaster, user, handler)

Subscribes to events that represent chat settings being updated in a channel.

ParameterTypeRequiredDefaultDescription
broadcaster
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications about chat settings being updated in their channel.

user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user to use for reading the channel's chat.

handler(data: EventSubChannelChatSettingsUpdateEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelCheer(user, handler)

Subscribes to events that represent a user cheering some bits.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications for about cheers they get.

handler(event: EventSubChannelCheerEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelFollow(user, moderator, handler)

Subscribes to events that represent a user following a channel.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications about their followers.

moderator
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

A user that has permission to read followers in the broadcaster's channel.

handler(event: EventSubChannelFollowEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelGoalBegin(user, handler)

Subscribes to events that represent a Goal beginning.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications about Goals in their channel.

handler(data: EventSubChannelGoalBeginEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelGoalEnd(user, handler)

Subscribes to events that represent the end of a Goal in a channel.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications about Goals in their channel.

handler(data: EventSubChannelGoalEndEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelGoalProgress(user, handler)

Subscribes to events that represent progress in a Goal in a channel.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications about Goals in their channel.

handler(data: EventSubChannelGoalProgressEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelHypeTrainBegin(user, handler)

Subscribes to events that represent a Hype Train beginning.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications about Hype Trains in their channel.

handler(data: EventSubChannelHypeTrainBeginEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelHypeTrainEnd(user, handler)

Subscribes to events that represent the end of a Hype Train in a channel.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications about Hype Trains in their channel.

handler(data: EventSubChannelHypeTrainEndEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelHypeTrainProgress(user, handler)

Subscribes to events that represent progress in a Hype Train in a channel.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications about Hype Trains in their channel.

handler(data: EventSubChannelHypeTrainProgressEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelModeratorAdd(user, handler)

Subscribes to events that represent a user getting moderator permissions in a channel.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications for when users get moderator permissions in their channel.

handler(event: EventSubChannelModeratorEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelModeratorRemove(user, handler)

Subscribes to events that represent a user losing moderator permissions in a channel.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications for when users lose moderator permissions in their channel.

handler(event: EventSubChannelModeratorEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelPollBegin(user, handler)

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

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The broadcaster for which to receive poll begin events.

handler(data: EventSubChannelPollBeginEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelPollEnd(user, handler)

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

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The broadcaster for which to receive poll end events.

handler(data: EventSubChannelPollEndEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelPollProgress(user, handler)

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

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The broadcaster for which to receive poll progress events.

handler(data: EventSubChannelPollProgressEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelPredictionBegin(user, handler)

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

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The broadcaster for which to receive prediction begin events.

handler(data: EventSubChannelPredictionBeginEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelPredictionEnd(user, handler)

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

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The broadcaster for which to receive prediction end events.

handler(data: EventSubChannelPredictionEndEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelPredictionLock(user, handler)

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

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The broadcaster for which to receive prediction lock events.

handler(data: EventSubChannelPredictionLockEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelPredictionProgress(user, handler)

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

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The broadcaster for which to receive prediction progress events.

handler(data: EventSubChannelPredictionProgressEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelRaidFrom(user, handler)

Subscribes to events that represent a broadcaster raiding another broadcaster.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The broadcaster for which to get outgoing raid notifications.

handler(event: EventSubChannelRaidEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelRaidTo(user, handler)

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

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The broadcaster for which to get incoming raid notifications.

handler(event: EventSubChannelRaidEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelRedemptionAdd(user, handler)

Subscribes to events that represents a Channel Points reward being redeemed.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications for when their rewards are redeemed.

handler(data: EventSubChannelRedemptionAddEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelRedemptionAddForReward(user, rewardId, handler)

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

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications when their reward is redeemed.

rewardIdstringnone

The ID of the reward for which to get notifications when it is redeemed.

handler(data: EventSubChannelRedemptionAddEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelRedemptionUpdate(user, handler)

Subscribes to events that represent a Channel Points reward being updated by a broadcaster.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications for when they update a reward.

handler(data: EventSubChannelRedemptionUpdateEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelRedemptionUpdateForReward(user, rewardId, handler)

Subscribes to events that represent a specific Channel Points reward being updated by a broadcaster.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications for when they update the reward.

rewardIdstringnone

The ID of the reward for which to get notifications when it gets updated.

handler(data: EventSubChannelRedemptionUpdateEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelRewardAdd(user, handler)

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

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications for when they add a reward to their channel.

handler(data: EventSubChannelRewardEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelRewardRemove(user, handler)

Subscribes to events that represent a Channel Points reward being removed.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications for when they remove a reward.

handler(data: EventSubChannelRewardEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelRewardRemoveForReward(user, rewardId, handler)

Subscribes to events that represent a specific Channel Points reward being removed.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications for when they remove the reward.

rewardIdstringnone

The ID of the reward to get notifications for when it is removed.

handler(data: EventSubChannelRewardEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelRewardUpdate(user, handler)

Subscribes to events that represent a Channel Points reward being updated.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications for when they update a reward.

handler(data: EventSubChannelRewardEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelRewardUpdateForReward(user, rewardId, handler)

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

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications for when they update the reward.

rewardIdstringnone

The ID of the reward for which to get notifications when it is updated.

handler(data: EventSubChannelRewardEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelShieldModeBegin(broadcaster, moderator, handler)

Subscribes to events that represent Shield Mode being activated in a channel.

ParameterTypeRequiredDefaultDescription
broadcaster
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications for when Shield Mode is activated in their channel.

moderator
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

A user that has permission to read Shield Mode status in the broadcaster's channel.

handler(event: EventSubChannelShieldModeBeginEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelShieldModeEnd(broadcaster, moderator, handler)

Subscribes to events that represent Shield Mode being deactivated in a channel.

ParameterTypeRequiredDefaultDescription
broadcaster
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications for when Shield Mode is deactivated in their channel.

moderator
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

A user that has permission to read Shield Mode status in the broadcaster's channel.

handler(event: EventSubChannelShieldModeEndEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelShoutoutCreate(broadcaster, moderator, handler)

Subscribes to events that represent a broadcaster shouting out another broadcaster.

ParameterTypeRequiredDefaultDescription
broadcaster
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The broadcaster for which you want to listen to outgoing shoutout events.

moderator
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

A user that has permission to see or manage shoutout events in the broadcaster's channel.

handler(event: EventSubChannelShoutoutCreateEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelShoutoutReceive(broadcaster, moderator, handler)

Subscribes to events that represent a broadcaster being shouted out by another broadcaster.

ParameterTypeRequiredDefaultDescription
broadcaster
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The broadcaster for which you want to listen to incoming shoutout events.

moderator
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

A user that has permission to see or manage shoutout events in the broadcaster's channel.

handler(event: EventSubChannelShoutoutReceiveEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelSubscription(user, handler)

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

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications for about their subscribers.

handler(event: EventSubChannelSubscriptionEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelSubscriptionEnd(user, handler)

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

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications for about ending subscriptions.

handler(event: EventSubChannelSubscriptionEndEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelSubscriptionGift(user, handler)

Subscribes to events that represent a user gifting a subscription to a channel to someone else.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications for about subscriptions people gift in their channel.

handler(event: EventSubChannelSubscriptionGiftEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelSubscriptionMessage(user, handler)

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

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications for about announced subscriptions.

handler(event: EventSubChannelSubscriptionMessageEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelUnban(user, handler)

Subscribes to events that represent a user getting unbanned from a channel.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications for when users get unbanned in their channel.

handler(event: EventSubChannelUnbanEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onChannelUpdate(user, handler)

Subscribes to events representing a change in channel metadata, e.g. stream title or category.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications about updates.

handler(event: EventSubChannelUpdateEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onDropEntitlementGrant(filter, handler)

Subscribes to events that represent a drop entitlement being granted.

ParameterTypeRequiredDefaultDescription
filterHelixEventSubDropEntitlementGrantFilternone

The filter to apply for the events.

handler(event: EventSubDropEntitlementGrantEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onExtensionBitsTransactionCreate(handler)

Subscribes to events that represent a Bits transaction in an extension.

ParameterTypeRequiredDefaultDescription
handler(event: EventSubExtensionBitsTransactionCreateEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onStreamOffline(user, handler)

Subscribes to events representing a stream going offline.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications about their streams going offline.

handler(event: EventSubStreamOfflineEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onStreamOnline(user, handler)

Subscribes to events representing a stream going live.

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications about their streams going live.

handler(event: EventSubStreamOnlineEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onUserAuthorizationGrant(handler)

Subscribes to events that represent a user granting authorization to an application.

ParameterTypeRequiredDefaultDescription
handler(data: EventSubUserAuthorizationGrantEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onUserAuthorizationRevoke(handler)

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

ParameterTypeRequiredDefaultDescription
handler(data: EventSubUserAuthorizationRevokeEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

onUserUpdate(user, handler)

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

ParameterTypeRequiredDefaultDescription
user
UserIdResolvable

A user ID or a user or channel object.

This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name.

Aliased type: string | number | UserIdResolvableType

none

The user for which to get notifications about account updates.

handler(data: EventSubUserUpdateEvent) => voidnone

The function that will be called for any new notifications.

Return type: EventSubSubscription<unknown>

registerEvent<Args>()

Return type: EventBinder<Args>

removeListener(id)

ParameterTypeRequiredDefaultDescription
id Listenernonenone
Return type: void

removeListener<Args>(event, listener)

ParameterTypeRequiredDefaultDescription
event EventBinder<Args>nonenone
listener EventHandler<Args>nonenone
Return type: void