Is possible to check follow status in batches? Would be nice to have as I am checking in bot if user is or isn’t follower after while and if I can use more than one user to check it will ease api calls.
As I think (and tested) its not possible now, would be nice to have something like
GET https://api.twitch.tv/helix/users/follows?from_id=<userid1>,<userid2>,<...userid100>&to_id=<channelId>
This doesn’t seem plausible on big channels, I just want to check online users (with other conditions) if they are following, not doing unnecessary diff of thousands of objects, which with paging may take even more requests
Webhooks doesn’t work retroactively. This will solve fetching of all users, but would like to avoid it
This is what I would do and I do, do, with a big channel. That said most of the big channels I work with, don’t do anything with follower checks anyway.
But I do use the follower webhook to update certain things internally. And periodically pull the whole list, rarely.
Then check when you need to. What’s your use case for needing the follower status?
Side point: a fair few “big channels” have their chat in follower only mode, so if they can talk in chat then they are a follower.
Correct.
Webhooks are pushed from the server, to a web accessible client. Need to get around that, use a tunnel like NGROK. Or just put your follower handling on a webserver, since you are gonna be processing a lot of data and might need the grunt of a bigger box.
For example in a bot, certain commands might be used only for followers, cooldowns are enabled only for non-followers etc.But this varies in depends on bot usage.
Yeah, I am checking, also have additional rate limiting on this, but just would like to have simpler approach when I can fetch e.g. 100 user and not 1 by 1.
In my opinion it might work same as users endpoint
GET https://api.twitch.tv/helix/users?id=user1&id=user2
Then I’d fetch all followers, update via webhooks and periodically refresh the stack, if my cache of a follower is stale (last checked in 24 hours) I might consider fetching their follow status, but that mean latency in the fetch delaying the command, assuming you make the fetch block the command rather than background job it.
Latency would be worsened on the bulk fetch you propose. So on a large channel, such a thing is probably not worth the CPU cycles, which again it isn’t at all if the channel is in followers only mode.
Course this means moving the check to the background so lookup latency isn’t an issue.
You should always cooldown (in my opinion) regardless of follow state, as otherwise you might get close to your send limit even as a mod or verified bo, and then your bot gets kicked out of chat.