Preferred way of detecting a new follower

I’m writing an IRC bot, and I was surprised to see there were no “new_follower” msg-id. What then is the preferred way of detecting a new follow?

I can preemptively hammer https://api.twitch.tv/helix/users/follows?to_id= and look at the “totals” field, monitoring it for changes, but even with a few seconds in between that’s a lot of requests.

Is there a better way?

Twitch chat doesn’t show new follows, so there’s no reason for Twitch to send those events over TMI.

The API is cached, requesting the same endpoint with the same params more frequently than once a minute is excessive, and can actually lead to bad responses.

As for the best way to handle this, you could use webhooks https://dev.twitch.tv/docs/api/webhooks-guide and subscribe to the follows topic and get a notification each new follow (it’ll send a notification regardless of if the user had previously followed, so it’s still up to you to detect and handle a user spamming follow/unfollow)

Yes, as @Dist suggested the webhook would be the best way to listen for new followers. Specifically, the below topic. There is a sample implementation at github.com

https://api.twitch.tv/helix/users/follows?first=1&to_id=1337

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.