Hi Twitch devs,
Let me preface this by saying I’m by no means a dev, and I’m just doing this for fun and learning. I recently became really interested in making custom Twitch overlays and alerts. I’ve been using AS3 and the Streamlabels (TwitchAlert) desktop app to make a simple sliding panel with recent follower/subscriber/donator/cheerer which it reads from the locally generated text files. I also included a v5 API call to retrieve the person’s profile picture which works nicely. I then embed into HTML and put it into OBS.
However, now I’m trying to make an animation that triggers for an event such as a follow. I have so far done this by constantly polling the local text file (although updating the file twice a few seconds apart makes the animation play twice over each other… so I guess I need to make some kind of queuing system?), but I’m aware that v5 is being removed next year and so I wanted to try and get to grips with using webhooks in advance, and not having to poll the file constantly looks better performance wise.
Can anyone point me in the right direction to actually subscribe to a webhook? I Am I able to use AS3? If not, what language should I be looking at? From my understanding, I basically need to set up a reverse API where Twitch can send me data when events happen, so do I need to have a VPS, or are there any free options? I’ve been over the documentation multiple times and tried a bunch of things but I think I’m just barking up the wrong tree so I’m just trying to start from scratch. Oh, one more question - when v5 is removed, does this mean things like retrieving profile pictures can only be done through webhooks?
Thanks for reading, any help would be much appreciated!
Listening to webhooks requires you to run a publicly accessible web server. This may be difficult on a private network.
The subscription handshake goes as follows.
- your application starts listening to HTTP requests
- your application sends subscription request to Twitch API
- Twitch API sends a confirmation challenge to your application (HTTP server started in step 1)
- your application replies to the challenge completing the handshake
Thank you. I read through the WebSub spec and it mostly makes sense, but where can I put this into practice? Which language do you recommend and are there any suitable VPS services you can recommend? Thanks again.
Would be nice
Not reliable ones, maybe heroku. Even that at the free level only runs 16 hours a day (last time I looked at the pricing for it)  . There are a few other options but you NEED to have a web accessible callback in order to have twitch send you data.
The webhooks documentation is here https://dev.twitch.tv/docs/api/webhooks-guide
Did you set
hub.lease_seconds to a non zero positive integer? You must set a lease time, a lease time of 0 results in the Webhook subscription, instantly expiring.
Helix/New Api is missing many things that will hopefully have ally the things before v5 is removed
There are some free options for running a web server, as you’re doing this for fun and learning then just running a little service locally on your own machine might work for you, or another option is AWS, which has a 12 month free tier that would allow you to run a t2.micro instance, which is more than enough for what you’re looking at doing.
I am at little bias towards AWS as I have all my instances running there and it has been perfect for my stream analytics, but if you look around there are other providers that offer limited time free servers which if you’re just looking to learn and not go into production then they should all fit your needs.
Yes, basically you’ll have an endpoint where you receive the data and then you use that data however you want.
If it’s a small learning project I’d just host it locally and run ngrok [https://ngrok.com/] and like the other replies said Heroku or AWS are also fine choices. I personally prefer Heroku but that’s offtopic.
Thanks for the replies everyone! I think for now I’ll look into the free options since I’d only need it running when I’m testing stuff, then if I feel confident about deploying I can look at a paid one. I’m sure I’ll back soon with more questions
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.