2

I am trying to add an activity to many user feeds which aren't following the activity actor. I was thinking about using the "to" field, but GetStream only allows to target up to 100 feeds.

In my application I have a "promotion" activity which should be seen on every user feed, but sometimes we also want to target a "promotion" to a specific group of users, filtered by a property on them.

A promotion has a user as an actor, but the promotion should still appear on another user's feed even if that user doesn't follow the actor.

Sometimes I want to send out a promotion to 80k users.

How could I solve this?

I am using the Ruby library, and the Rails integration.

4

1 回答 1

2

正如您正确指出的那样,to目标不适合您的用例。您可以在请求中包含的目标数量限制为 100。幸运的是,Stream 的 API 公开了一个批处理操作,可以将相同的活动添加到许多提要中。

这是您可以从 API 客户端使用的高级功能,因为您使用的是 Rails 集成,您可以执行以下操作:

client = StreamRails.client
activity = self.create_activity
client.add_to_many(activity, ["flat:1", "flat:2", "flat:3"])

请注意,self代码示例中是您的活动模型的实例。

于 2015-12-15T08:27:53.830 回答