Search code examples
getstream-io

GetStream: Only "share" an activity with certain user


we were fostering through the docs but couldn't find anything that would help us to implement the following feature request:

"Privacy settings for an activity", a user wants to create an activity which is only visible to selected users in their content feed.

Our feed structure looks like this:
User - flat feed, and a
ContentFeed - flat feed

Now, for example:

The ContentFeed of user B and C are following the User feed of user A. User A creates an activity which the user only wants to share with user C. After creation the activity should not appear in user B's ContentFeed but only in user C's.

Facebook has a similar feature, where you can select who should be able to see a post you create.

Any recommendation on how to implement this using getstream.io?

Thank you in advance!


Solution

  • You can use to targeting to add activities to specific feeds in write time according to permission levels you want to support.

    A adds an activity to its feed, global. If C can see it, mark its to target as A-visible-C and when C follows A, it would follow A-visible-C, not A (because it's global).

    This is just a suggestion, with to targeting you can copy the same thing multiple places easily.

    To specify it, just add to: ["privacy:A-visible-C"] into your activity.