Yes, EventSub unfortunately doesn’t provide the viewer count. I will try to look into a better way to do this. I have quickly created a short draft of the steps that you can follow to connect Twitch with the Webhook node.
- Create a Twitch app on the developer console.
- You can add
http:localhost:3000 as the OAuth redirect.
- Install the Twitch CLI. We need to get this to get the App Access Token. (This is the easiest way to get the tokens, in my experience. If you have a simpler way, I would love to learn that!)
twitch configure command. Enter the Client ID and the Client Secret that got generated after you created the Twitch app (Step 1 and 2).
- I used Postman to make a POST request to register my Webhook. You can use a similar tool or the cURL command.
- Make a post request to
https://api.twitch.tv/helix/eventsub/subscriptions. You need to pass on Client ID and Authorization in the headers. The value for Authorization will be similar to
- Use the following JSON in the Body of the request
"type": "stream.online", // the type you want to subscribe to. You can find more about the types on their documentation
"broadcaster_user_id": "YOUR BROADCASTER ID" // you can get this by using the command mentioned below
"callback": "YOUR WEBHOOK URL", // you will get this from the Webhook node
"secret": "SECRET" // has to be min 10 characters
Get Broadcaster ID:
Execute the command
twitch api get users -q login=harshil1712 (Replace harshil1712 with your Twitch username).
Let me know if you face any issues with the steps mentioned above. I am working on a blog-post and will try to publish it by Sunday