How to retrieve last subs actually in Twitch API?

Hi,

I’m working on an application who’s linking prediction and subs. For that I need to get lasts subs for a given broadcaster id, or finding a way to detect a new sub and start my process.

I’m actually using the

Get Broadcaster subscriptions api reference.

I would like to know if there’s any better way to find back new subs. I would like to detect the last 3 subs for my system but I don’t really win an optimize way to do it.

If someone has a better way, or a better reference that I can use to handle that, would be appreciated.
Thank’s a lot.

Sincerelly
Voltext

The optimal way to do this is to collect in real time. Whever thats

  • chat collection
  • PubSub collection
  • EventSub collection
    it’s up to you

Since the API doesn’t have any sorting, ordering, or durastion functions.

Concerning EventSub, I’ve some trouble to run it.
Here’s how my project work :
I would like to build a module for OBS around predictions. Actually everything is working but something new has been had to the project.
The streamer wants to block prediction for 15mins and the timer would be reduce from 5 minute on every subs. So after 3 subs, the timer end and predictions are available.
Everything work but now I need to catch sub to make that timer reduced.
I document myself around the EventSub subscription endpoint but I do not really understand how it works with callback etc
So I don’t know how to use it…

Regardless of how you build the thing.

A persistent data storage would be optimal.

So that if the thing has to restart for whatever reason data is not lost whilst restarting. (OBS crashing, need to restart as the connection is being screwy etc)

A remote server that is web accessable behind SSL would be able to be online 99.9% and collect data as needed whether that is from any of the three soluitions/sources.

That is the optimal approach a server does the heavy lifting. And your thing just processes information from the server

For this you don’t need to know the last three subs, you just need to collect them in real time from one of the real time sources.

Since the API doesn’t tell you when a given user (re)subbed.

Twitch API: You call the Twitch API to get data.

EventSub: Twitch calls you (via HTTPS POST) with data when data occurs

Chat/PubSub: You connect to a socket, Twitch sends you data when data occurs

EventSub/Chat/PubSub: all trigger data when data occurs, the only difference is the delivery system.