How to properly calculate sub points?

TLDR:

  • Why is the /channels/(id)/subscriptions inconsistent for calculating subpoints compared to dashboard?
  • Is there an endpoint giving me a more accurate number?

I tried to calculate subpoints (for unlocking emotes with the new tiers) to be used for unlocking different goals/events during an anniversary stream.

I used the https://api.twitch.tv/kraken/channels/(id)/subscriptions endpoint for this purpose. I started by only reading the unique last entry for each user, hence ignoring not older and not yet expired double subscription remaining after upgrading tiers, and then simply adding one point for 1000-sub 2 points for 2000 and 6 points for 3000.

This worked just fine at first, but the day before the stream the script was intended to be used for, we noticed that the dashboard was showing one less than this calculation ended up with, and I just manually corrected it. However, during the stream, while people were upgrading and subscribing, the number started to deviate even more, ending up with a 12 points gap between this calculation from the API compared to the dashboard, where the dashboard was showing more than this calculation from the channels/(id)/subscriptions endpoint.

Is there a preferred method to calculate this that I didn’t find, or is there any endpoint simply showing the correct number, matching the current one in the dashboard? And how come these numbers differ this much?

1 Like

There is no endpoint at the moment to get the sub points, although it’s in the works (no ETA).

The best way is what you’re doing, i.e. iterating on all the subscriptions. You do not have to ignore any entry returned to get an accurate number.

But I do have to ignore some, if someone upgrades their sub to 9.99 from 4.99 it will still show both of these until the original tier expires, and when I tried without excluding the old tier the numbers were way off, as soon as I removed all old tiers, the numbers were somewhat correct.

However, the numbers are still off…

I’m currently summing all subscriptions and getting an accurate count.

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