Hello! I’m creating a personal web and would like to add a section of my streams, so I thought it would be a good idea to use the twitch API to display the iframe of my stream when I’m online and display a message like “Not online” when I’m not. But I can’t find the right way to do this so I would really appreciate if someone could give me at least an idea how it could be done. Thanks!
- On your backend/cron job generate an App Access/Client Creds token
- Call Get Streams
- Store the Result in a db/cache/something
or
- Create an EventSub handler/listener
- On your backend/cron job generate an App Access/Client Creds token
- Subscribe to Stream Online/Offline
- When your Stream State changes, Twitch will tell you via a HTTP Post Store the Result in a db/cache/something
THEN
Your Front End will use the valud from your db/cache/something to decide if to show the iFrame or a message instead.
This will also give you access to the Stream Title and Game
With EventSub you would use channel.update, with Long Polling the API yoru Cron Job would grab it from it’s Get Streams Check
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.