Check if a user follow a channel API

Hi there, I know this a topic that maybe have been discussed early, but, I cannot find any answer to my issue which is:

I’d like to check if a specific user follow me on a specific channel.
this the api I know that exist

GET https://api.twitch.tv/kraken/users/user ID/follows/channels/channel ID

the thing is this API only accepts User ID as a int and channel ID as well, but I want to check this information only with the username and channel name like this:

GET https://api.twitch.tv/kraken/users/userpepito/follows/channels/channeltest

is this possible? I haven’t found any reference to this on the api documentation.

Thanks in advance.

  1. Look up the users via login e.g. GET /helix/users?login=3v&login=ohbot
  2. Check if one is following the other e.g. GET /helix/users/follows?from_id=17089325&to_id=62809083
2 Likes

thank you so much, this helps, the only thing I see with this solution is we have to do at least two request to the api one: to get the user id of the username you want to check and two: to check the relationship between that userid and yours, so, if you want to check a bunch of username maybe your application will be a little be slow

but that is something that I have to handle, right?

Regards.

You can check up to 100 user’s IDs at a time, so it’s significantly less than 2 requests for each follow relationship check as the number of users checked grows.

If you really can’t spare the extra request, you could always use Kraken v3 until it gets removed at the end of the year. Although the existing documentation has since been removed from the github repository.

I would do what @3ventic suggested, and then cache the id/login pair for future requests.

Yes, I would do that too,
I had that issue because I have to check at least 5 users at the same time, so it will be 5 requests, nothing that my app can handle, so it is OK

Thanks.

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