Adrian Cruz
Adrian Cruz

Reputation: 21

How to create public activities in getstream-io

I want to broadcast some activities such as "User joined" for all members to see. Currently I have a flat user feed. Is there a way to push an activity so that it's visible by everyone?

Upvotes: 2

Views: 235

Answers (1)

Thierry
Thierry

Reputation: 3155

You could use the TO field to add an activity to a global feed. For example:

// Instantiate a feed using feed class 'user' and user id '1'
var user1 = client.feed('user', '1');
// Add an activity to the feed
var activity = {"to": ["user:global"], "actor": "User:1", "verb": "pin", "object": "Place:42", "target": "Board:1"};
user1.addActivity(activity)
// activity is added to both user:1 as well as user:global

Alternatively you could have 1 editorial account, that is followed by all your users.

Upvotes: 3

Related Questions