Skip to main content

Topic - Sub Gift Events

Description​

This topic can be used to monitor sub gift activity in a specified channel.

Unlike the documented Channel Subscriptions topic (fires many events upon a multi-target gift), this allows one to know how many subs were gifted in a single event. The documented analog to this topic is in the TwitchChat module.

With all undocumented topics, use at your own risk.

Method Definition​

NameTypeDescription
credentialOAuth2CredentialAuth Token (may not necessarily be required)
channelIdStringTarget Channel Id

Code-Snippets​

Subscribe to all sub gift events in channel twitch4j and register a listener that prints all messages to console

twitchClient.getPubSub().listenForChannelSubGiftsEvents(credential, "149223493");

twitchClient.getEventManager().onEvent(ChannelSubGiftEvent.class, System.out::println);