danieldevine/bird-elephant

Query user list tweets

Closed this issue · 2 comments

I couldn't find this anywhere in the documentation and/or find the corresponding endpoint, but I would like to grab the users list(s) and output tweets.

Endpoint: https://developer.twitter.com/en/docs/twitter-api/lists/list-tweets/introduction

Is there a way to grab the tweets from a list?

Thanks for pointing this out. If you update to v0.4.3 you can now get Tweets from a list like so:

$twitter->lists()->tweets()->lookup($list_id);

a full working example:

$twitter = new \Coderjerk\BirdElephant\BirdElephant($credentials);

try {
    $user = $twitter->user('coderjerk');
    $user_lists = $user->lists()->owned();
    $list_id = $user_lists->data[0]->id;
    $tweets = $twitter->lists()->tweets()->lookup($list_id);
    var_dump($tweets);
} catch (Exception $e) {
    dump($e->getResponse()->getBody()->getContents());
}

I'll update the documentation to reflect this shortly.

Just tested it out - Worked perfectly! Thanks for the quick fix and I can go ahead and implement this today.