Get list of subscribers watching the stream

Hi, I’m looking to start building a Streamelements widget that helps the Broadcaster choosing a random subscriber that is currently watching the stream. I didn’t find anything into the documentation, but I’ve seen widgets that are working with current viewers so there must be something somewhere.

How can I retrieve a list of current viewers? If not possible via official Twitch APIs, is there another method?

There are no API endpoints to see who is watching the stream. There are some apps that use the list of chatters and assume they are viewing the stream, but really that list only represents users connected to chat and logged in to Twitch, it does not mean that they are actually watching the stream as they could be connected to chat through a 3rd party chat client, or Twitch’s popout chat, or have the stream paused, or even be a bot and not capable of watching the stream at all.

Pull a subscriber whom has written a message in chat in the last 15/20 minutes

Then you reward active stream paticipation and increase the likelyhood a selected victim will see their name being used on stream

I’ve heard about Twitch APIs that are not documented and not official Twitch APIs.
Which are them? Is it legal to use them? Any of these is actually reliable?

In order do to so, should I store all the messages sent into the chat or is there any API for that?
Because you second sentece seems like “that’s the best way but it will not always work properly”.

Technically no

They should not be considered stable/safe

Any not listed in the documentation Twitch Developer Documentation | Twitch Developers

No Just “user x last sent a message at time y” then when you want to pick a user
Grab all users whom have a time > z stored.

Or just keep a list of recent chatters and remove people from the list whose last message was x time ago.

It works “properly” what I meant was that a subscriber could write a message in chat.

Then leave the stream.

So why would you want to pick a subscriber whom “appears” to not be there as they have not paticipated in chat.

No point picking Fred 1 hour into the stream if Fred only said hello at the start of the stream. Fred probably left, so Fred might never see that Fred got picked. As Fred then “dies on stream” at 2 hours in the Fred starts watching the strem at 3 hours in (and writes messages in chat) Then Fred is unhappy as Fred missed Fred’s character being played on stream.

So

Mechanically it works fine.
But depending on your “how long ago someone wrote a message” window is, you could still theoretically pick a user whom has left the stream. So 5/10/15 minutes is a good rule of thumb for victim selection based on last message sent to chat.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.