Overview
Events
Methods
- addListener
- apply
- markAsReadya
- on
- onChannelAdBreakBegin
- onChannelBan
- onChannelCharityCampaignProgress
- onChannelCharityCampaignStart
- onChannelCharityCampaignStop
- onChannelCharityDonation
- onChannelChatClear
- onChannelChatClearUserMessages
- onChannelChatMessage
- onChannelChatMessageDelete
- onChannelChatNotification
- onChannelChatSettingsUpdate
- onChannelCheer
- onChannelFollow
- onChannelGoalBegin
- onChannelGoalEnd
- onChannelGoalProgress
- onChannelHypeTrainBegin
- onChannelHypeTrainEnd
- onChannelHypeTrainProgress
- onChannelModeratorAdd
- onChannelModeratorRemove
- onChannelPollBegin
- onChannelPollEnd
- onChannelPollProgress
- onChannelPredictionBegin
- onChannelPredictionEnd
- onChannelPredictionLock
- onChannelPredictionProgress
- onChannelRaidFrom
- onChannelRaidTo
- onChannelRedemptionAdd
- onChannelRedemptionAddForReward
- onChannelRedemptionUpdate
- onChannelRedemptionUpdateForReward
- onChannelRewardAdd
- onChannelRewardRemove
- onChannelRewardRemoveForReward
- onChannelRewardUpdate
- onChannelRewardUpdateForReward
- onChannelShieldModeBegin
- onChannelShieldModeEnd
- onChannelShoutoutCreate
- onChannelShoutoutReceive
- onChannelSubscription
- onChannelSubscriptionEnd
- onChannelSubscriptionGift
- onChannelSubscriptionMessage
- onChannelUnban
- onChannelUpdate
- onDropEntitlementGrant
- onExtensionBitsTransactionCreate
- onStreamOffline
- onStreamOnline
- onUserAuthorizationGrant
- onUserAuthorizationRevoke
- onUserUpdate
- registerEvent
- removeListener
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.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
config | EventSubMiddlewareConfig | none | see below | |
config.apiClient | ApiClient | none | The API client that will be used to subscribe to events. | |
config.helperRoutes | boolean | none | Whether to add additional helper routes such as the test route at the root. Enabled by default. Set this to | |
config.hostName | string | none | The host name the root application is available under. | |
config.logger | Partial<LoggerOptions> | none | Options to pass to the logger. | |
config.pathPrefix | string | none | The path your listener is mounted under. | |
config.secret | string | none | 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.strictHostCheck | boolean | none | Whether to ignore packets that are not sent with a Host header matching the configured host name. Enabled by default. Set this to | |
config.usePathPrefixInHandlers | boolean | none | Whether the path prefix will added to the mount point. Defaults to Must be |
Events
onRevoke((subscription, status) => { /* ... */ })
Fires when a subscription is revoked.
Parameter | Type | Description |
---|---|---|
subscription | EventSubSubscription<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.
Parameter | Type | Description |
---|---|---|
subscription | EventSubSubscription<unknown> | The subscription that was not successfully created. |
error | Error | The error that was thrown. |
onSubscriptionCreateSuccess((subscription, apiSubscription) => { /* ... */ })
Fires when the client successfully created a subscription.
Parameter | Type | Description |
---|---|---|
subscription | EventSubSubscription<unknown> | The subscription that was successfully created. |
apiSubscription | HelixEventSubSubscription | The subscription data from the API. |
onSubscriptionDeleteFailure((subscription, error) => { /* ... */ })
Fires when the client fails to delete a subscription.
Parameter | Type | Description |
---|---|---|
subscription | EventSubSubscription<unknown> | The subscription that was not successfully deleted. |
error | Error | The error that was thrown. |
onSubscriptionDeleteSuccess((subscription) => { /* ... */ })
Fires when the client successfully deleted a subscription.
Parameter | Type | Description |
---|---|---|
subscription | EventSubSubscription<unknown> | The subscription that was successfully deleted. |
onVerify((success, subscription) => { /* ... */ })
Fires when a subscription is successfully verified or fails to verify.
Parameter | Type | Description |
---|---|---|
success | boolean | Whether the verification succeeded. |
subscription | EventSubSubscription<unknown> | The subscription that was verified. |
Methods
addListener<Args>(event, listener)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
event | EventBinder<Args> | none | none | |
listener | EventHandler<Args> | none | none |
apply(router)
Applies middleware that handles EventSub notifications to an Express app/router.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
router | IRouter | none | The app or router the middleware should be applied to. |
markAsReady()
asyncMarks the middleware as ready to receive events.
The express app should be started before this.
on<Args>(event, listener)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
event | EventBinder<Args> | none | none | |
listener | EventHandler<Args> | none | none |
onChannelAdBreakBegin(user, handler)
Subscribes to events that represent an ad break beginning.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelBan(user, handler)
Subscribes to events that represent a user getting banned from a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelCharityCampaignProgress(user, handler)
Subscribes to events that represent progress in a charity campaign in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelCharityCampaignStart(user, handler)
Subscribes to events that represent a charity campaign starting in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelCharityCampaignStop(user, handler)
Subscribes to events that represent a charity campaign ending in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelCharityDonation(user, handler)
Subscribes to events that represent a donation to a charity campaign in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelChatClear(broadcaster, user, handler)
Subscribes to events that represent an channel's chat being cleared.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelChatClearUserMessages(broadcaster, user, handler)
Subscribes to events that represent a user's chat messages being cleared in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelChatMessage(broadcaster, user, handler)
Subscribes to events that represent a chat message being sent to a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelChatMessageDelete(broadcaster, user, handler)
Subscribes to events that represent a chat message being deleted in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelChatNotification(broadcaster, user, handler)
Subscribes to events that represent a chat notification being sent to a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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 ) => voidAliased type: EventSubChannelChatSubNotificationEvent | EventSubChannelChatResubNotificationEvent | EventSubChannelChatSubGiftNotificationEvent | EventSubChannelChatCommunitySubGiftNotificationEvent | EventSubChannelChatGiftPaidUpgradeNotificationEvent | EventSubChannelChatPrimePaidUpgradeNotificationEvent | EventSubChannelChatRaidNotificationEvent | EventSubChannelChatUnraidNotificationEvent | EventSubChannelChatPayItForwardNotificationEvent | EventSubChannelChatAnnouncementNotificationEvent | EventSubChannelChatCharityDonationNotificationEvent | EventSubChannelChatBitsBadgeTierNotificationEvent | none | The function that will be called for any new notifications. |
onChannelChatSettingsUpdate(broadcaster, user, handler)
Subscribes to events that represent chat settings being updated in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelCheer(user, handler)
Subscribes to events that represent a user cheering some bits.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelFollow(user, moderator, handler)
Subscribes to events that represent a user following a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelGoalBegin(user, handler)
Subscribes to events that represent a Goal beginning.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelGoalEnd(user, handler)
Subscribes to events that represent the end of a Goal in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelGoalProgress(user, handler)
Subscribes to events that represent progress in a Goal in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelHypeTrainBegin(user, handler)
Subscribes to events that represent a Hype Train beginning.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelHypeTrainEnd(user, handler)
Subscribes to events that represent the end of a Hype Train in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelHypeTrainProgress(user, handler)
Subscribes to events that represent progress in a Hype Train in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelModeratorAdd(user, handler)
Subscribes to events that represent a user getting moderator permissions in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelModeratorRemove(user, handler)
Subscribes to events that represent a user losing moderator permissions in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelPollBegin(user, handler)
Subscribes to events that represent a poll starting in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelPollEnd(user, handler)
Subscribes to events that represent a poll ending in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelPollProgress(user, handler)
Subscribes to events that represent a poll being voted on in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelPredictionBegin(user, handler)
Subscribes to events that represent a prediction starting in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelPredictionEnd(user, handler)
Subscribes to events that represent a prediction ending in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelPredictionLock(user, handler)
Subscribes to events that represent a prediction being locked in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelPredictionProgress(user, handler)
Subscribes to events that represent a prediction being voted on in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelRaidFrom(user, handler)
Subscribes to events that represent a broadcaster raiding another broadcaster.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelRaidTo(user, handler)
Subscribes to events that represent a broadcaster being raided by another broadcaster.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelRedemptionAdd(user, handler)
Subscribes to events that represents a Channel Points reward being redeemed.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelRedemptionAddForReward(user, rewardId, handler)
Subscribes to events that represent a specific Channel Points reward being redeemed.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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. | |
rewardId | string | none | The ID of the reward for which to get notifications when it is redeemed. | |
handler | (data: EventSubChannelRedemptionAddEvent) => void | none | The function that will be called for any new notifications. |
onChannelRedemptionUpdate(user, handler)
Subscribes to events that represent a Channel Points reward being updated by a broadcaster.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelRedemptionUpdateForReward(user, rewardId, handler)
Subscribes to events that represent a specific Channel Points reward being updated by a broadcaster.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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. | |
rewardId | string | none | The ID of the reward for which to get notifications when it gets updated. | |
handler | (data: EventSubChannelRedemptionUpdateEvent) => void | none | The function that will be called for any new notifications. |
onChannelRewardAdd(user, handler)
Subscribes to events that represent a Channel Points reward being added to a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelRewardRemove(user, handler)
Subscribes to events that represent a Channel Points reward being removed.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelRewardRemoveForReward(user, rewardId, handler)
Subscribes to events that represent a specific Channel Points reward being removed.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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. | |
rewardId | string | none | The ID of the reward to get notifications for when it is removed. | |
handler | (data: EventSubChannelRewardEvent) => void | none | The function that will be called for any new notifications. |
onChannelRewardUpdate(user, handler)
Subscribes to events that represent a Channel Points reward being updated.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelRewardUpdateForReward(user, rewardId, handler)
Subscribes to events that represent a specific Channel Points reward being updated.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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. | |
rewardId | string | none | The ID of the reward for which to get notifications when it is updated. | |
handler | (data: EventSubChannelRewardEvent) => void | none | The function that will be called for any new notifications. |
onChannelShieldModeBegin(broadcaster, moderator, handler)
Subscribes to events that represent Shield Mode being activated in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelShieldModeEnd(broadcaster, moderator, handler)
Subscribes to events that represent Shield Mode being deactivated in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelShoutoutCreate(broadcaster, moderator, handler)
Subscribes to events that represent a broadcaster shouting out another broadcaster.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelShoutoutReceive(broadcaster, moderator, handler)
Subscribes to events that represent a broadcaster being shouted out by another broadcaster.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelSubscription(user, handler)
Subscribes to events that represent a user subscribing to a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelSubscriptionEnd(user, handler)
Subscribes to events that represent a user's subscription to a channel ending.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelSubscriptionGift(user, handler)
Subscribes to events that represent a user gifting a subscription to a channel to someone else.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelSubscriptionMessage(user, handler)
Subscribes to events that represent a user's subscription to a channel being announced.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelUnban(user, handler)
Subscribes to events that represent a user getting unbanned from a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onChannelUpdate(user, handler)
Subscribes to events representing a change in channel metadata, e.g. stream title or category.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onDropEntitlementGrant(filter, handler)
Subscribes to events that represent a drop entitlement being granted.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
filter | HelixEventSubDropEntitlementGrantFilter | none | The filter to apply for the events. | |
handler | (event: EventSubDropEntitlementGrantEvent) => void | none | The function that will be called for any new notifications. |
onExtensionBitsTransactionCreate(handler)
Subscribes to events that represent a Bits transaction in an extension.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
handler | (event: EventSubExtensionBitsTransactionCreateEvent) => void | none | The function that will be called for any new notifications. |
onStreamOffline(user, handler)
Subscribes to events representing a stream going offline.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onStreamOnline(user, handler)
Subscribes to events representing a stream going live.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
onUserAuthorizationGrant(handler)
Subscribes to events that represent a user granting authorization to an application.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
handler | (data: EventSubUserAuthorizationGrantEvent) => void | none | The function that will be called for any new notifications. |
onUserAuthorizationRevoke(handler)
Subscribes to events that represent a user revoking authorization from an application.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
handler | (data: EventSubUserAuthorizationRevokeEvent) => void | none | The function that will be called for any new notifications. |
onUserUpdate(user, handler)
Subscribes to events that represent a user updating their account details.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
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) => void | none | The function that will be called for any new notifications. |
removeListener<Args>(event, listener)
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
event | EventBinder<Args> | none | none | |
listener | EventHandler<Args> | none | none |