Question on How to lookup what game a streaming is playing in the new API

Question I have started looking at switching from the old API to the New API. I was wondering how do I find what StreamerX is currently Streaming? I mean you can what their current Stream Title is but what about the Game they are currently Streaming?

You can use the Get Streams endpoint which will return their stream, this will include a game_id. You can then use that game_id as the id querystring param for the Get Games endpoint which will return the game name and boxart for that id.

Depending on your use case, it may be beneficial to cache results from the Get Games request so that you don’t have to make as many repeated lookups.

I have a related question for the new API. One issue with the GetStreams endpoint is that it only returns the game for a channel in the new API only if the stream is currently live. In v5, we can lookup what game/category the streamer was in even after they had finished streams and therefore create things like a shoutout chatbot command that retrieves the game they were playing, but there doesn’t seem to be a way to do this using Helix endpoints. Is this a use-case that will be supported in the new API?

I don’t believe there are any plans to show historical stream information through the new API. While there may be valid use cases for this data they can easily be accomplished by just caching the last stream state on your end.

I’m not sure that’s so easy. To shoutout a streamer along with the game they were playing, especially if they are newcomers, would mean the bot would have to cache the last stream state of every stream on Twitch.

I’m still not quite sure why you’d want to shoutout with out of date information that may no longer be of any relevance (the last stream could potentially be a long time ago, or of a game they no longer play), but if that’s what you want to do and want to have that old information for every single streamer on Twitch then yes you’ll have to cache every single streamer on Twitch (and be careful of potential developer agreement issues you may run in to if you want to store this sort of data)

Perhaps you may want to use this as an opportunity to rethink your shoutout system as in most cases these sort of things can benefit from being short and to the point, rather than bloated with information users don’t really need if all they want to do is be able to follow a link to their channel.

Sorry for the late reply. I don’t mean to try and cache all of Twitch and neither would I want to. Mainly the ability to know what game / activity they were streaming in a shoutout command is a great conversation starter and can also give people a bigger reason to follow that person (e.g. “oh that person played Rocket League. I love Rocket League!”)

It’s pretty common for shoutout commands (e.g. with StreamElements or Nightbot) to say something like “Hey check out Streamer_X at ! They were last seen playing SomeGameXYZ” and with v5, it’s possible to do this and retrieve what game the person was streaming because it’s returned with the info, but with the New API, even if someone hosts / raids you and a few minutes later you try to shoutout the streamer’s channel to folks in chat, the game they were last playing is already gone because they’re no longer live. Or if there’s a regular in the stream and he/she had just streamed the previous day, can’t retrieve their game. I really think this is a scenario that should be possible in the New API as well.

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