Been searching for this a few hours now, and it seems hard for me to wrap my head around.
What I want is to obtain the subscribers to my own channel. I have a channel_id, client_id, client_secret and all other info needed.
It’ll only be for my own channel! I want my PHP script to automatically authorize this request (with any credentials needed) and then return to me a response with subscriptions.
I use the ‘new API’, but I’m willing and able to use the v5 one, I don’t really care at this point ;-).
Just: subscriptions, no manual actions by me, all automated through PHP.
I already know how to obtain an ‘app access token’, but that doesn’t give me the right to obtain subscriptions. So what I need is to obtain a ‘user access token’. Everything from there on won’t be a problem!
That’ll take you through the auth process to create a User Access Token, and a Refresh Token. This step can’t be automated, you have to go through this process once so that you can grant your app the specific permissions you need, which in this case will be the channel:read:subscriptions scope to grant you access the list of subscribers to your channel.
Once you’ve got the tokens, you can automatically refresh them as they expire so from this point on you can automate it all, it’s just that initial auth step that requires the user to actually go through Twitch to grant you the permission to access the data.
Refreshing is a similar request to the code to token exchange.
You can use
To validate/check your token and decide if you need to renew. But I have code that does sub fetching every three hours, (and a User token is usually good for four hours), so I always refresh before I start my run(s)
OK, so I got it working with Kraken…
Works nice too, image, name, etc.
Just the ‘is_gift’ is broken… it’s always False, even if the sub was gifted.
So I thought, let’s give Helix a spin.
Works too, except that one doesn’t give me ‘created_at’ or user-image.
Who thought that was a good idea? To not include the datetime a sub was created / started?!
With every sub the ‘broadcaster id’ and ‘broadcaster name’ are included… but not when it was created…
Yes… the above is a bit salty… but I feel that implementing things with this API is a struggle.
Documentation is dubious, there’s multiple ways to do things, but every way has a disadvantage, somehow.
Is there any way, to get my own subscriptions, with Helix (because, new api) including all relevant data. Especially date-created (of the sub), the type of sub, the user info (incl image url) and if it was gifted?
Date Created: no. Since the date created in kraken is actually the date that the current payment period started, it’s not the number of cumulative months the sub is. it’s the streak. Helix doesn’t (currently) have tenure data but it is something a lot of us have asked for.
Take the user_id and look them up on the users API
Thanks so much for all your replies. They’re very thorough. I appreciate it a lot!
But I have to say, this stuff is broken!
In many posts I read the remark ‘but helix is just different from kraken’ but that is in no way a reason ;-).
Twitch knows exactly when a sub initially started, when it was paid for, when it expires and when it was prolonged. No data-model stands in the way of that.
It’s just a different look on things by different people developing the API’s. And that’s what bothers me somewhat. Getting datetimes with each sub is probably what a lot of people are looking for (I’m generalising now, I know).
Storing this data with webhooks is an option (I do it through / with Streamlabs already), but that also doesn’t excuse the fact that it should simply be in this API.
Let us close this issue ;-).
Thanks again for all your help!! I hope you have a nice weekend.