Hello,
If I wanted to create a button off-site that shows a users’ Twitch follower count (that gets updated periodically), what would be the best way to go about it?
The button would need a backend to go and fetch the follow count from the API.
As the backend will need to generate an app access token in order to go do the call to the API
The backend would peridoically fetch the total from https://dev.twitch.tv/docs/api/reference/#get-channel-followers and store in a cache/database for the button to display.
But the button won’t be able to do the follow action on click as there is no method for that and twitch doesn’t provide an embedded follow button
So the best thing the button can do is link to the channel in question for the user to do the ofllow action manually.
The button wouldn’t need a follow action on click, just a show number count. My plan was indeed to add in a link to the channel in question.
So would I need to add the request and response to my code and then use the “total” as a displayed variable?
To a backend somewhre as all API calls need a token and you don’t want to have a website visitor login to see a followr count.
I think I understand. So making a separate file with the request and response, then call in that backend file into the file with HTML, am I understanding that correctly? No, I wouldn’t want visitors to log in to see that number.
Sounds correct
my answering is based of the phrase “embedded follower count button” which suggests to me you are trying to put an iframe on website (a) which loads the button from website (b)
if you just want to display the follower count then you just server side render the page using whatever language you are building your website in
I think we can proceed with setting up a backend to handle the API calls and store the follower count. This approach should meet the requirements effectively. Thanks again for the guidance!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.