when I call https://api.twitch.tv/helix/subscriptions?broadcaster_id=257128796&first=90
It should give me 1 subscription but the server responds with http status code 200 and body:
{ data: [],
pagination: { cursor: ‘eyJiIjpudWxsLCJhIjp7Ik9mZnNldCI6OTB9fQ’ } }
I thought that it may be due to cache but I have subscribed to 1 streamer 2 days ago.
Any idea what is wrong?
You’re misunderstanding the endpoint, it’s not for seeing a list of who you’re subscribed to, it’s returning a list of users who are subscribed to the channel you specify.
This means that if you are using it on your own channel, it wont return any users unless you are an affiliate or partnered streamer and have users that are subscribed to your channel.
I cannot use ?broadcaster_id=them&user_id=me because then broadcaster_id does not match ID in token. I can use only ?broadcaster_id=me&user_id=them but the streamer is not subscribed to me so it does not make sense
Authentication
OAuth Token (e.g. User Access Token)
The current user is determined by the OAuth token provided in the Authorization header.
Authorization
Required OAuth Scope: channel:read:subscriptions
Users can only request their own subscriptions.
The Get Broadcaster's Subscribers and Get Broadcaster Subscriptions endpoints do the exact same thing (they shouldn’t even be 2 separate entries on the reference, they are the same endpoint, just one uses an extra querystring param).
All you can do in Helix is get a list of subscriptions to a channel, and optionally use a querystring param to filter the results to see if specific users are subscribed to a channel. It is not possible with the currently documented endpoints to see who a user is subscribed to.
I hope that they are going to add that feature. I wanted to create website which would be available only for the streamer’s subscribers but it seems like it is not possible to do with the current api.
It’s more practical since then you only need to show a oAuth screen full of /!\ warnings to the broadcaster and “not regular people”.
And then you are only handling the singular oAuth.
Also means, for example, you can use a cronjob to periodically cache the subscribers list and perform actions if the subscriber is no longer a subscriber and so on.
And straight forward to make it a setup step for broadcasters wanting to use your tool to create a sub only access thing, and the streamer needs to login first to create the content to be sub protected…