Best way to implement a live sub point counter? (API question, not coding)

Someone has asked me to implement a live sub point tracker for a subathon they’re planning to do. I can do the coding, but I want to make sure my plan is the best way to go about this. Note that I’m looking for sub points, not total sub count.

To get the initial count, I’ll have to call the get broadcaster subscriptions endpoint and loop through all of them. I then want to listen to the pubsub topic for channel subscriptions to catch new ones. A resub may or may not count toward sub points because of the grace period after it expires when it’ll still show as a resub, so to get around this I’ll have to cache the list of subscribers from the API call and check if the resub user is in that list. If they are, I won’t increment points.

I’ll have to call the endpoint and recalculate manually on a timer every 10 minutes or so because there’s no live way to catch when someone’s subscription is canceled, and also because I don’t know if the pubsub topic fires when someone resubs but chooses not to share it with chat.

I looked at the webhook topic for this, and it’s worded as though it fires when someone unsubscribes, but there’s no example payload for that. I’m also not sure how delayed those webhook calls are, so I don’t know if it would be appropriate for a live counter on stream.

Does this plan sound good? Any advice would be appreciated!


This is pretty much exactly what I do.

Webhooks also have an active bug:

otherwise I’d be pure webhooks.

Perfect, thank you, I really appreciate it!

I’ve hit a snag. I checked with the streamer to verify my numbers, but they’re off.

These are fake numbers, but the streamer’s dashboard says his breakdown of T1/2/3 subs is 15/8/4. Both the API and the raw sub list that can be downloaded as a CSV, however, say the breakdown is 14/8/5. I know that the streamer will show up in the list of subs but doesn’t count toward points, so these numbers do not include the streamer.

I’m not really sure what’s going on here.

Shot in the dark here, maybe something to do with lifetime subs given to bots/family/friends?

It happens. It’s gonna be ever so slightly out due to how thing A presents information and how thing B presents information.

Which one is correct? Neither.

Alright, I’ll just go with it then. Thank you!

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