Helix is not sending my subscriptions


#1

Hello,

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?


#2

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.


#3

Is there any endpoint in the new API where I can check if user is subscribed to specific channel?
Old api has this: https://dev.twitch.tv/docs/v5/reference/users/#check-user-subscription-by-channel
I can get follows in the new api (https://dev.twitch.tv/docs/api/reference/#get-users-follows) so I guess there must be a way to get subscriptions?


#4

Broadcaster -> User

https://api.twitch.tv/helix/subscriptions?broadcaster_id=them&user_id=me

#5

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


#6
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.

Documentation is a bit weirdly worded on these


#7

Course I jsut tested this. And this endpoint is very confusing.

The docs don’t match what it does.

So it looks like helix doesn’t have a “lookup subscribers when specify a users user token as apposed to a broadcasters user token”


#8

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.


#9

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.


#10

It is if you have a user access token from the broadcaster.

You get a key from the broadcaster with the relevant oAuth scope(s)

Viewer logs in that gives you their userID

Then call

https://api.twitch.tv/helix/subscriptions?broadcaster_id=broadcaster_id&user_id=userID

And specify the broadcasters auth key you collected earlier (using the refresh token if you need to refresh).

You don’t need to request “subscription read” from the user if you have the broadcasters key with “subscription read” attached.

This is how I do it.


#11

So the streamer must log in before anyone else to make it work. I guess I will try that but it sounds so cumbersome.


#12

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…