I am working on a Twitch bot (It will be open source, but I want to work on it for another week or two before I publicize it. Written in NodeJS). I already have it using tmi.js to interact with chat and doing all sorts of things in response to chat messages.
I would like to get notified of follows/subs/channel points/bits/etc. It looks like the right tool for that is EventSub. Looking at the documentation, though, I think your EventSub bot needs to be running on a server that Twitch can reach for callbacks. Currently my bot runs on my streaming computer so it can do things like play sounds that will be heard on stream, which is of course not publicly accessible.
- Am I understanding the documentation right about that requirement?
- Are there any other way of getting alerted about this kinds of events?
Currently EventSub only supports the webhook transport medium, which requires you to host a publicly accessibly HTTPS server that Twitch can send the events to.
A websocket transport method is currently in development, which would allow you to make an outbound connection rather than needing to host a server, but this is not yet available.
There will also be more transport methods in the future which may or may not require hosting a server, but none other than the previously mentioned websockets have been announced.
Poll the applicable endpoints once a minute. For example, if you want to know of new followers you use the Get Users Follows endpoint, cache the results, then in a minute make another request and look for changes to see if there have been new followers. Many other things like subs can be tracked in a similar way.
Bits usage, such as Cheers, can be tracked by your connection to chat, as you mention already using tmi.js so you can use that library to listen for when Cheers happen.
There’s some overlap with the PubSub API as well, and that works via a websocket connection. I’m currently using it for whispers, subs, and chat moderator actions, but there are events there for bits and channel points as well.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.