TwitchApi.EventSub (twitch_api v0.2.1)

Start using Twitch EventSub

You can test all your subscriptions using:

https://github.com/twitchdev/twitch-cli/blob/main/docs/event.md#verify-subscription

Link to this section Summary

Link to this section Functions

Link to this function

list_event_subs(client_id, app_access_token, cursor \\ nil)

List all event sub listeners

There is a maximum, so make sure to stop listening at some point

Link to this function

listen_to_channel_points_used(client_id, app_access_token, callback_url, secret, channel)

Start listening to channel points usage

https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types#channelchannel_points_custom_reward_redemptionadd

Scopes required: channel:read:redemptions or channel:manage:redemptions

Link to this function

listen_to_follows(client_id, app_access_token, callback_url, secret, channel)

Start listening to follows

https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types#channelfollow

Link to this function

listen_to_stream_offline(client_id, app_access_token, callback_url, secret, channel)

Start listening to when the streamer goes offline

https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types#streamoffline

Link to this function

listen_to_stream_online(client_id, app_access_token, callback_url, secret, channel)

Start listening to when the streamer comes online

https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types#streamonline

Link to this function

listen_to_subscriptions(client_id, app_access_token, callback_url, secret, channel)

Start listening to subscriptions

https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types#channelsubscribe

Scopes required: channel:read:subscriptions

Test using the twitch cli: twitch event verify-subscription subscribe -F https://localhost:4001/webhooks/listen-to-subscriptions

Link to this function

stop_listening(client_id, app_access_token, subscription_id)

Stop listening to certain events

Link to this function

stop_listening_to_event_subs_for_uninstalled_channels(client_id, token, after_stop_listening_closure, cursor \\ nil)

Stop listening to all the event sub channels that have no longer installed the extension

Use after_stop_listening_closure(channel) to add additional logic after we've stopped listening to an event sub