Does getstream provide a way to retrieve the number of activities within a feed? I have a notification feed setup. I can retrieve the activities using paginated get
. However, I would like to display the number of items within the feed.
Asked
Active
Viewed 749 times
3

jgdreyes
- 169
- 1
- 6
3 Answers
0
Unfortunately not, there is no API endpoint to retrieve the amount of activities within a feed.

Matthisk
- 1,501
- 10
- 20
-
Do you know whether this is still the case as of 2021? – hannojg Jun 12 '21 at 07:54
0
At the moment there's no way to count activities directly. You can try
- Use a custom feed and use reactions. So now you call count from reactions.
- Other way is store in your app (cache/db/etc).
It worked for me:
signature = Stream::Signer.create_jwt_token('activities', '*', '<your_secret>', '*')
uri = URI("https://us-east-api.stream-io-api.com/api/v1.0/enrich/activities/?api_key=<api_key>&ids=<id1,id2,...>&withReactionCounts=true")
req = Net::HTTP::Get.new(uri)
req['Content-Type'] = "application/json"
req['Stream-Auth-Type'] = "jwt"
req['Authorization'] = signature
res = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) {|http|
http.request(req)
}
puts JSON.parse(res.body)
References:

fct
- 311
- 3
- 18