Indicate if streamer online

Is there a streamlined piece of javascript/jquery that I can use to embed on a simple webpage that returns just returns “Online” when they’re online? Nothing fancy.

<p id="streamstatus"></p>

<script>
  var streamer = 1 //variable

  if (streamer == 1) {
    document.getElementById("streamstatus").innerHTML = "Online";
  } else {
    document.getElementById("streamstatus").innerHTML = "Offline";
  }
</script>

I’m new to APIs but hoping to get some help implementing both the authorisation of the request and the retrieval of data.

Thanks.

No since all Helix requests will soon require the use of an oAuth token.

So the best solution is a Cron Job on the server itself and cache it, and you then either use that in your templates, or write an internal API.

Also means you can utilize webhooks rather than long polling the API instead

I had a suspicion it might come to something like that. Too convoluted for such as simple requirement. I appreciate the insight :+1:

Not really, but personal opinion.

If you can do it in your website via templates/prerender, then your frontend/webpage doesn’t have to load, then load from Twitch.

It has it all loaded in one go, from just you. Twitch API could be down, but you have the online status cached on your webserver for example. It’s up to you, but you can’t do it pure front end any more

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