// More options
let query = FeedQuery(
group: "user",
id: "jack",
data: .init(
visibility: "public"
)
)
let feed = client.feed(for: query)
try await feed.getOrCreate()
Activity Feeds V3 is in closed alpha — do not use it in production (just yet).
Feed and Activity Visibility
Feed Visibility Levels
Feed groups have a default visibility. You can also override the group’s default when creating a feed. A feed’s visibility level can’t be changed after creation.
// More options
val query = FeedQuery(
group = "user",
id = "jack",
data = FeedInputData(
visibility = FeedVisibility.Public
)
)
val feed = client.feed(query = query)
feed.getOrCreate()
const feed = client.feed("user", "jack");
await feed.getOrCreate({
data: {
visibility: "public",
},
});
// More options
const feed = client.feeds.feed("user", "jack");
await feed.getOrCreate({
data: {
visibility: "public",
},
// The owner of the feed
user_id: "<user id>",
});
const response = await client.feeds.createFeedGroup({
feed_group_id: "myid",
default_visibility: "public",
// Other settings...
});
createResponse, err := feedsClient.CreateFeedGroup(ctx, &getstream.CreateFeedGroupRequest{
ID: feedGroupID,
DefaultVisibility: getstream.PtrTo("public"),
ActivityProcessors: []getstream.ActivityProcessorConfig{
{Type: "default"},
},
})
$createResponse = $this->feedsV3Client->createFeedGroup(
new \GetStream\GeneratedModels\CreateFeedGroupRequest(
id: $feedGroupId,
defaultVisibility: 'public',
activityProcessors: [
['type' => 'default']
]
)
);
var createResponse = await _feedsV3Client.CreateFeedGroupAsync(new CreateFeedGroupRequest
{
ID = feedGroupId,
DefaultVisibility = "public",
ActivityProcessors = new List<ActivityProcessorConfig>
{
new() { Type = "default" }
}
});
create_response = self.client.feeds.create_feed_group(
id= feed_group_id,
default_visibility= "public",
)
Supported visibility levels:
Level | Viewing feed (activities + metadata) | Following | Posting |
---|---|---|---|
visible | Anyone can view | Anyone can follow | Only the owner or member/follower with the post permission can post |
public | Anyone can view | Anyone can follow | Anyone can post |
followers | Only approved followers can view | Anyone can send a follow request, follow requests have to be approved | Only the owner or member/follower with the post permission can post |
members | Only members can view | Only members can follow | Only the owner or member/follower with the post permission can post |
private | Only the owner can view | Only the owner can follow | Only the owner can post |
Activity Visibility Levels
public
: marks the activity as public - everyone who can view feed content, can see itprivate
: marks the activity as private - only feed owner can see ittag: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
val privateActivity: Result<ActivityData> = feed.addActivity(
request = FeedAddActivityRequest(
text = "Premium content",
type = "post",
visibility = AddActivityRequest.Visibility.Tag,
visibilityTag = "premium"
)
)
// Premium users can see full activity, others a preview
feed.addActivity({
type: "post",
text: "Premium content",
visibility: "tag",
visibility_tag: "premium",
});
// Premium users can see full activity, others a preview
client.feeds.addActivity({
feeds: ["user:1"],
type: "post",
text: "Premium content",
visibility: "tag",
visibility_tag: "premium",
user_id: "<user id>",
});
// Premium users can see full activity, others a preview
package main
import (
"context"
"log"
"github.com/GetStream/getstream-go/v3"
)
func main() {
client, err := getstream.NewClient("<your_api_key>", "<your_api_secret>")
if err != nil {
log.Fatal(err)
}
ctx := context.Background()
feedsClient := client.Feeds()
// Create tag-based visibility activity (premium content)
premiumActivity, err := feedsClient.AddActivity(ctx, &getstream.AddActivityRequest{
Fids: []string{"user:1"},
Type: getstream.PtrTo("post"),
Text: getstream.PtrTo("Premium content"),
Visibility: getstream.PtrTo("tag"),
VisibilityTag: getstream.PtrTo("premium"),
UserID: getstream.PtrTo("<user id>"),
Custom: map[string]interface{}{
"tier": "premium",
},
})
if err != nil {
log.Fatal(err)
}
log.Printf("Premium activity created: %+v", premiumActivity.Data)
log.Println("Premium users can see full activity, others a preview")
}
For all the details on tag visibility read the Membership levels guide.