Feed and Activity Visibility

Feed Visibility Levels

Feed groups have a default visibility (if it’s not set when creating the group, visible will be set). You can also override the group’s default when creating a feed. A feed’s visibility level can’t be changed after creation.

require 'getstream_ruby'

client = GetStreamRuby.manual(
  api_key: 'api_key',
  api_secret: 'api_secret'
)

# Create a feed with custom visibility
feed_response = client.feeds.get_or_create_feed(
  'user',
  'jack',
  GetStream::Generated::Models::GetOrCreateFeedRequest.new(
    user_id: 'jack',
    data: GetStream::Generated::Models::FeedInput.new(
      visibility: 'public'
    )
  )
)

# Create a feed group with default visibility
create_request = GetStream::Generated::Models::CreateFeedGroupRequest.new(
  id: 'myid',
  default_visibility: 'public',
  activity_processors: [
    GetStream::Generated::Models::ActivityProcessorConfig.new(type: 'default')
  ]
)
create_response = client.feeds.create_feed_group(create_request)

Supported visibility levels:

LevelViewing feed (activities + metadata)FollowingPosting
visibleAnyone can viewAnyone can followOnly the owner or member/follower with the post permission can post
publicAnyone can viewAnyone can followAnyone can post
followersOnly approved followers can viewAnyone can send a follow request,
follow requests have to be approved
Only the owner or member/follower with the post permission can post
membersOnly members can viewOnly members can followOnly the owner or member/follower with the post permission can post
privateOnly the owner can viewOnly the owner can followOnly the owner can post

Activity Visibility Levels

  • public: marks the activity as public - everyone who can view feed content, can see it
  • private: marks the activity as private - only feed owner can see it
  • tag:mytag: marks the activity as only visible to followers/members with the permission to see this tag

This visibility system is very flexible and allows you to build:

  • Apps like Patreon where only certain levels of users can see your content
  • Apps like Strava where it’s possible to share your activity with nobody, everyone or your followers
let privateActivity = try await feed.addActivity(
    request: .init(
        text: "Premium content",
        type: "post",
        visibility: .tag,
        visibilityTag: "premium"
    )
)
// Premium users can see full activity, others a preview

For all the details on tag visibility read the Membership levels guide.