Overview
Methods
- createSubscriptiona
- deleteAllSubscriptionsa
- deleteBrokenSubscriptionsa
- deleteSubscriptiona
- getSubscriptionsa
- getSubscriptionsPaginated
- subscribeToChannelBanEventsa
- subscribeToChannelCheerEventsa
- subscribeToChannelFollowEventsa
- subscribeToChannelHypeTrainBeginEventsa
- subscribeToChannelHypeTrainEndEventsa
- subscribeToChannelHypeTrainProgressEventsa
- subscribeToChannelRaidEventsFroma
- subscribeToChannelRaidEventsToa
- subscribeToChannelRedemptionAddEventsa
- subscribeToChannelRedemptionAddEventsForRewarda
- subscribeToChannelRedemptionUpdateEventsa
- subscribeToChannelRedemptionUpdateEventsForRewarda
- subscribeToChannelRewardAddEventsa
- subscribeToChannelRewardRemoveEventsa
- subscribeToChannelRewardRemoveEventsForRewarda
- subscribeToChannelRewardUpdateEventsa
- subscribeToChannelRewardUpdateEventsForRewarda
- subscribeToChannelSubscriptionEventsa
- subscribeToChannelUnbanEventsa
- subscribeToChannelUpdateEventsa
- subscribeToStreamOfflineEventsa
- subscribeToStreamOnlineEventsa
- subscribeToUserAuthorizationRevokeEventsa
- subscribeToUserUpdateEventsa
Can be accessed using client.helix.eventSub
on an
ApiClient
instance.
Before using these methods...
All of the methods in this class assume that you are already running a working EventSub listener at the given callback URL.
If you don't already have one, we recommend use of the
twitch-eventsub
library, which handles subscribing
and unsubscribing to these topics automatically.
Example
const api = new ApiClient(new StaticAuthProvider(clientId, accessToken));
await api.helix.eventSub.subscribeToUserFollowsTo('125328655', { callbackUrl: 'https://example.com' });
Methods
createSubscription(type, version, condition, transport)
asyncSends an arbitrary request to subscribe to an event.
Requires an app access token to work; does not work with user tokens.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
type | string | none | The type of the event. |
|
version | string | none | The version of the event. |
|
condition | Record<string, unknown> | none |
The condition of the subscription. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none |
The transport of the subscription. |
deleteBrokenSubscriptions()
asyncDeletes all broken subscriptions, i.e. all that are not enabled or pending verification.
deleteSubscription(id)
asyncDeletes a subscription.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
id | string | none | The ID of the subscription. |
getSubscriptions()
asyncRetrieves the current WebHook subscriptions for the current client.
Requires an app access token to work; does not work with user tokens.
getSubscriptionsPaginated()
Retrieves the current WebHook subscriptions for the current client.
Requires an app access token to work; does not work with user tokens.
subscribeToChannelBanEvents(broadcaster, transport)
asyncSubscribe to events that represent a user being banned in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster you want to listen to ban events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport option. |
subscribeToChannelCheerEvents(broadcaster, transport)
asyncSubscribe to events that represent a user cheering bits to a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster you want to listen to cheer events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options. |
subscribeToChannelFollowEvents(broadcaster, transport)
asyncSubscribe to events that represent a user following a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster you want to listen to follow events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options |
subscribeToChannelHypeTrainBeginEvents(broadcaster, transport)
asyncSubscribe to events that represent the beginning of a Hype Train event in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster you want to listen to Hype train begin events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options. |
subscribeToChannelHypeTrainEndEvents(broadcaster, transport)
asyncSubscribe to events that represent the end of a Hype Train event.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster for which you want to listen to Hype Train end events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options. |
subscribeToChannelHypeTrainProgressEvents(broadcaster, transport)
asyncSubscribe to events that represent progress towards the Hype Train goal.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster for which you want to listen to Hype Train progress events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options. |
subscribeToChannelRaidEventsFrom(broadcaster, transport)
asyncSubscribe to events that represent a broadcaster raiding another broadcaster.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster you want to listen to outgoing raid events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options. |
subscribeToChannelRaidEventsTo(broadcaster, transport)
asyncSubscribe to events that represent a broadcaster being raided by another broadcaster.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster you want to listen to incoming raid events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options. |
subscribeToChannelRedemptionAddEvents(broadcaster, transport)
asyncSubscribe to events that represent a Channel Points reward being redeemed.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster you want to listen to redemption events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options. |
subscribeToChannelRedemptionAddEventsForReward(broadcaster, rewardId, transport)
asyncSubscribe to events that represent a specific Channel Points reward being redeemed.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster you want to listen to redemption events for. |
|
rewardId | string | none |
The ID of the reward you want to listen to redemption events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options. |
subscribeToChannelRedemptionUpdateEvents(broadcaster, transport)
asyncSubscribe to events that represent a Channel Points redemption being updated.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster you want to listen to redemption update events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options. |
subscribeToChannelRedemptionUpdateEventsForReward(broadcaster, rewardId, transport)
asyncSubscribe to events that represent a specific Channel Points reward's redemption being updated.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster you want to listen to redemption update events for. |
|
rewardId | string | none |
The ID of the reward you want to listen to redemption updates for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options. |
subscribeToChannelRewardAddEvents(broadcaster, transport)
asyncSubscribe to events that represent a Channel Points reward being added to a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster you want to listen to reward add events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options. |
subscribeToChannelRewardRemoveEvents(broadcaster, transport)
asyncSubscribe to events that represent a Channel Points reward being removed from a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster you want to listen to reward remove events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options. |
subscribeToChannelRewardRemoveEventsForReward(broadcaster, rewardId, transport)
asyncSubscribe to events that represent a specific Channel Points reward being removed from a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster you want to listen to reward remove events for. |
|
rewardId | string | none |
The ID of the reward you want to listen to remove events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport events. |
subscribeToChannelRewardUpdateEvents(broadcaster, transport)
asyncSubscribe to events that represent a Channel Points reward being updated in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster you want to listen to reward update events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options |
subscribeToChannelRewardUpdateEventsForReward(broadcaster, rewardId, transport)
asyncSubscribe to events that represent a specific Channel Points reward being updated.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster you want to listen to reward update events for. |
|
rewardId | string | none |
The ID of the reward you want to listen to update events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options. |
subscribeToChannelSubscriptionEvents(broadcaster, transport)
asyncSubscribe to events that represent a user subscribing to a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster you want to listen to subscribe events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options |
subscribeToChannelUnbanEvents(broadcaster, transport)
asyncSubscribe to events that represent a user being unbanned in a channel.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster you want to listen to unban events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options. |
subscribeToChannelUpdateEvents(broadcaster, transport)
asyncSubscribe to events that represent a channel updating their metadata.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster you want to listen to update events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options |
subscribeToStreamOfflineEvents(broadcaster, transport)
asyncSubscribe to events that represent a stream going offline.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster you want to listen to online events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options |
subscribeToStreamOnlineEvents(broadcaster, transport)
asyncSubscribe to events that represent a stream going live.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none |
The broadcaster you want to listen to online events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options |
subscribeToUserAuthorizationRevokeEvents(clientId, transport)
asyncSubscribe to events that represent a user revoking their authorization from an application.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
clientId | string | none |
The Client ID for the application you want to listen to authorization revoke events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options. |
subscribeToUserUpdateEvents(user, transport)
asyncSubscribe to events that represent a user updating their account details.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
user | UserIdResolvable | none |
The user you want to listen to user update events for. |
|
transport |
HelixEventSubTransportOptions
Aliased type: HelixEventSubWebHookTransportOptions |
none | The transport options. |