I know that this question was probably set a lot of times, but I can’t figure it out with search on Google.
Is there a way to listen to follow events with the twitch API ? I mean, when a user is following the channel, then get a json response or something like that ?
If not, how to do that ?
Thank you very much for your help !
Yes, you can use EventSub, which at time of writing only supports a HTTP POST/Webhook notification transport.
This will broacast a HTTP POST JSON payload when a follow occurs.
Okay so I have checked the documentation, but in the JSON response there is no information about the user that follow ? Or maybe I didn’t see it…
EventSub will send a noticitaion like this:
Channel Follow Webhook Notification Example on the link I linked:
The user that followed is this section of that JSON blob.
Okay thank you for this precisions.
Again, thank you so much for your time
That would be if you are long polling the Follows Endpoint.
For EventSub you need to create a Server.
That server is secured behind SSL
Then when a Follower occurs Twitch will send a HTTP Post to you. to that server
You do not have to fetch anything As Twitch will notify you when a follower occurs.
EventSub is currently a Webhooks only platform.
So you tell Twitch what topics you want via
Create EventSub Subscription which is the only/single HTTP POST you will make
Then when a follow occurs, Twitch will make a HTTP Post to your Server. So you don’t have to do any fetching at all.
Thank you so much I will check your example and comeback if I have any other questions !
Okay I see that you told me to have a server secured by SSL, but I’m working on localhost. Will it work ?
You cann’t receive WebHooks to localhost.
As Localhost to Twitch, is Twitch, not you.
If you can only work on localhost then you can either long poll the API, or determine a way to receive webhooks.
That could be via NGROK to handle the firewall bypass or you need to host your solution on a server/cloud solution.
Mmmh, and I forgot to say that my application is running with Laragon, which is a Wamp equivalent. So it will not work with those solutions ?
If you can make this server accessable to the internet then sure.
NGROK can do that for you.
Or you can get a domain name and open a hole in your firewall, which is generally not advised.
Okay, I will check NGROK then and see if I can do something with it. Well, thank you very much for your reactivity and your help, I will be back, maybe
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.