# Twitch API Get Followers

**URL:** <https://discuss.dev.twitch.com/t/twitch-api-get-followers/25949>\
**Category:** API\
**Created:** [May 27, 2020, 6:29pm UTC](https://discuss.dev.twitch.com/t/twitch-api-get-followers/25949 "2020-05-27T18:29:04Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emircan\_Aksu](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/emircan_aksu/32/8835_2.png) [@Emircan\_Aksu](https://discuss.dev.twitch.com/u/Emircan_Aksu)\
**Post date:** [May 27, 2020, 6:29pm UTC](https://discuss.dev.twitch.com/t/twitch-api-get-followers/25949/1 "2020-05-27T18:29:04Z")

</div>

I’m trying to attract the last people watching that channel with a specific user ID, but users seem to be object console log Screenshot: [https://imgur.com/a/sm4E6Qq](https://imgur.com/a/sm4E6Qq)  
Code Link: [http://dpaste.com/1CCKYRB](http://dpaste.com/1CCKYRB)

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [May 27, 2020, 8:22pm UTC](https://discuss.dev.twitch.com/t/twitch-api-get-followers/25949/2 "2020-05-27T20:22:59Z")

</div>

Why are you using a chatbot to load the followers endpoint?

There is no endpoint to get “the last people watching a channel”

```auto
client.api({
    url: "https://api.twitch.tv/kraken/channels/115307371/follows",
    headers: {
        "Accept": "application/vnd.twitchtv.v5+json",
        "Authorization": "oauth:key",
        "Client-ID": "client-id"
    }
}, function(err, res, body) {
    console.log(body);
});

```

should be

```auto
client.api({
    url: "https://api.twitch.tv/kraken/channels/115307371/follows",
    headers: {
        "Accept": "application/vnd.twitchtv.v5+json",
        "Authorization": "OAuth key",
        "Client-ID": "client-id"
    }
}, function(err, res, body) {
    console.log(body);
});

```

For kraken

But you first screenshot shows the helix data model

I’m _really_ not sure what you are trying to do here

---

<div class="post-metadata">

**Author:** ![Emircan\_Aksu](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/emircan_aksu/32/8835_2.png) [@Emircan\_Aksu](https://discuss.dev.twitch.com/u/Emircan_Aksu)\
**Post date:** [May 28, 2020, 1:15pm UTC](https://discuss.dev.twitch.com/t/twitch-api-get-followers/25949/3 "2020-05-28T13:15:21Z")

</div>

In fact, this file only stands inside chatbot files, it doesn’t work with it. When I want to see the last followers, I run the file by saying the node file name in the visual studio console and looking at the responses on the console. But now usernames only appear as objects

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [May 28, 2020, 1:20pm UTC](https://discuss.dev.twitch.com/t/twitch-api-get-followers/25949/4 "2020-05-28T13:20:30Z")

</div>

> [@Emircan\_Aksu](#):
>
> But now usernames only appear as objects

Then iterate the object

Console.log will do blind dump out everything, it only goes to a certain depth, by default

 ![image](https://d2opxh93rbxzdn.cloudfront.net/original/2X/4/4e187280b5d318ec4db9d8fe25058805db848387.png)

> [@Emircan\_Aksu](#):
>
> In fact, this file only stands inside chatbot files, it doesn’t work with it.

using nodejs, for example

```
const got = require('got');

got({
    url: 'https://api.twitch.tv/kraken/channels/115307371/follows',
    headers: {
        "Client-ID": "yourclient",
        "Accept": "application/vnd.twitchtv.v5+json",
    },
    responseType: 'json'
})
.then(resp => {
    for (var x=0;x<resp.body.follows.length;x++) {
        console.log(resp.body.follows[x]);
    }
})
.catch(err => {
    console.log(err);
})

```

You are using bot code for no sane reason.

---

<div class="post-metadata">

**Author:** ![Emircan\_Aksu](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/emircan_aksu/32/8835_2.png) [@Emircan\_Aksu](https://discuss.dev.twitch.com/u/Emircan_Aksu)\
**Post date:** [May 28, 2020, 1:30pm UTC](https://discuss.dev.twitch.com/t/twitch-api-get-followers/25949/5 "2020-05-28T13:30:36Z")

</div>

> [@BarryCarlyon](#):
>
> const got = require(‘got’); got({ url: ‘[https://api.twitch.tv/kraken/channels/115307371/follows](https://api.twitch.tv/kraken/channels/115307371/follows)’, headers: { “Client-ID”: “yourclient”, “Accept”: “application/vnd.twitchtv.v5+json”, }, responseType: ‘json’ }) .then(resp =\> { for (var x=0;x\<resp.body.follows.length;x++) { console.log(resp.body.follows); } }) .catch(err =\> { console.log(err); })

Thank you. After downloading the module, the results improved. I was able to see username, profile photos and other information on the console

---

<div class="post-metadata">

**Author:** ![Emircan\_Aksu](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/emircan_aksu/32/8835_2.png) [@Emircan\_Aksu](https://discuss.dev.twitch.com/u/Emircan_Aksu)\
**Post date:** [May 29, 2020, 5:47pm UTC](https://discuss.dev.twitch.com/t/twitch-api-get-followers/25949/6 "2020-05-29T17:47:46Z")

</div>

I have one more question. How can I just get display\_name in response? I don’t want identity, species and others to appear. I just want display\_name to appear  
Code: \<?php  
$headers = array(  
‘Accept: application/vnd.twitchtv.v5+json’,  
‘Authorization: OAuth key’,  
);

$url = ‘[https://api.twitch.tv/kraken/users/user-id](https://api.twitch.tv/kraken/users/user-id)’;

$ch = curl\_init($url);  
curl\_setopt($ch, CURLOPT\_HTTPHEADER, $headers);  
curl\_setopt($ch, CURLOPT\_RETURNTRANSFER, true);  
curl\_setopt($ch, CURLOPT\_TIMEOUT, 3);

$result = curl\_exec($ch);  
curl\_close($ch);

echo $result;  
?\>

Response: [https://imgur.com/BjMNqCP](https://imgur.com/BjMNqCP)

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [May 29, 2020, 5:48pm UTC](https://discuss.dev.twitch.com/t/twitch-api-get-followers/25949/7 "2020-05-29T17:48:18Z")

</div>

```auto
const got = require('got');

got({
    url: 'https://api.twitch.tv/kraken/channels/115307371/follows',
    headers: {
        "Client-ID": "yourclient",
        "Accept": "application/vnd.twitchtv.v5+json",
    },
    responseType: 'json'
})
.then(resp => {
    for (var x=0;x<resp.body.follows.length;x++) {
        console.log(resp.body.follows[x].user.display_name);
    }
})
.catch(err => {
    console.log(err);
})

```

---

<div class="post-metadata">

**Author:** ![Emircan\_Aksu](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/emircan_aksu/32/8835_2.png) [@Emircan\_Aksu](https://discuss.dev.twitch.com/u/Emircan_Aksu)\
**Post date:** [May 29, 2020, 5:52pm UTC](https://discuss.dev.twitch.com/t/twitch-api-get-followers/25949/8 "2020-05-29T17:52:15Z")

</div>

Thank you for help

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [May 29, 2020, 5:53pm UTC](https://discuss.dev.twitch.com/t/twitch-api-get-followers/25949/9 "2020-05-29T17:53:48Z")

</div>

Oh you switched from the followers endpoint to the users endpoint and changed languages.

Thats what happens when you delete the reply whilst I was reading it…

```auto
$result = curl_exec($ch);
curl_close($ch);

$result = json_decode($result);
echo $result->display_name;

```

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [June 28, 2020, 5:54pm UTC](https://discuss.dev.twitch.com/t/twitch-api-get-followers/25949/10 "2020-06-28T17:54:56Z")

</div>

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