Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can we get all activity without user ID in getstream

Can we get stream without user id i.e. without $results = $user_feed_1->getActivities(5, 10);

I want to get all streams for all users. Is it possible ?

like image 920
Ankesh Kumar Avatar asked Jan 28 '26 10:01

Ankesh Kumar


1 Answers

It is currently not possible to retrieve activities stored on many feeds in a single request. You can only read activities from one feed at the time.

You can achieve that by sending all activities to a global feed. The suggested way to do this, is to use the to targeting field as documented here: http://getstream.io/docs/#targetting

For example:

$userOneFeed = $client->feed('user', '1');
$data = [
    "actor"=>"user:tommaso",
    "verb"=>"reply",
    "object"=>"question:35312059",
    "to"=>["flat:global"]
];
$userFeedOne->addActivity($data);

this code adds an activity to $userOneFeed and to the global feed. If you add the to field every time you add an activity, you will be able to fetch all activities by reading from the global feed.

$globalFeed = $client->feed('flat', 'global');
$globalFeed->getActivities(5, 10);
like image 149
Tommaso Barbugli Avatar answered Jan 31 '26 00:01

Tommaso Barbugli



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!