Know if my channel is live and send back the info to all users of my website (React/Node)

I’m doing a website where I need to send back to the client if my Twitch channel is in live,

I want to know some things :

  1. Is it with this [Reference | Twitch Developers] ?
  2. Can every Twitch account get this data for any channel ?
  3. If the request can only be done by the channel we ask the data, any ideas to allow other users of my website to know if my channel is live even if they do the request to the Twitch API from their account ?

Thanks,

That tis the API to Get Streams and will return a stream if the channel is live and nothing if not.

Another alternative is to use EventSub and use Stream.online/offline to store your status in a DB/somewhere instead of calling the API each time someone loads your website. (If API-ing then you want to be using a cronjob and storing in DB/somewhere so you don’t run out out rate limit if 1000 people load your website at the same time)

Yes this is a public data endpoint.
Any ClientID and any token type can fetch this data on the Get Streams endpoint you have indicated

1 Like

But for using a cronjob, it would mean that my server can do automatically a request without me doing a manual action ? So I would need like a refresh token ?

A cronjob or server task would use an App Access/Client Credentials token.

This kind of token doesn’t come with a refresh token.

When it expires just get a new token.

If running a user token in a cronjob then you would use the refresh token to get a new token, but if the refresh fails you’ll need to seed a new user/refresh token. (This applies for when keeping sub data in sync or something)

1 Like