await serverClient.feeds.createFeedView({
view_id: "<view id>",
activity_selectors: [
{
type: "following",
},
],
ranking: { type: "time" },
});
Activity Feeds V3 is in closed alpha — do not use it in production (just yet).
Feed views
When to use feed views
Feed groups let you define what activities should be included in the feed and the ranking to sort these activities.
By default all feeds in the given group will have the same settings. However, you might want to experiment with different selectors and rankings. Feed views let you do that by overriding the group’s default settings.
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 a custom feed view
viewID := "<view id>"
feedView, err := feedsClient.CreateFeedView(ctx, &getstream.CreateFeedViewRequest{
ViewId: &viewID,
ActivitySelectors: []getstream.ActivitySelector{
{
Type: getstream.PtrTo("following"),
},
},
Ranking: &getstream.Ranking{
Type: getstream.PtrTo("time"),
},
})
if err != nil {
log.Fatal(err)
}
log.Printf("Feed view created: %s", *feedView.Data.ViewId)
}
let query = FeedQuery(
group: "user",
id: "john",
view: "<id of a feed view>", // Override the default view id
)
let feed = client.feed(for: query)
try await feed.getOrCreate()
feed.getOrCreate({
// Override the default view id
view: "<id of a feed view>",
});
feed.getOrCreate({
// Override the default view id
view: "<id of a feed view>",
});
With custom feed views you can control
- Activity selectors
- Ranking
- Aggregation
Updating feed views
It’s possible to update any custom or built-in feed views.
await serverClient.feeds.updateFeedView({
view_id: "<view id to update?",
// Fields to update
});
Deleting feed views
await serverClient.feeds.deleteFeedView({
view_id: "view id to delete",
});
- I'm working with the Stream Feeds Node SDK and would like to ask questions about this documentation page: https://getstream.io/activity-feeds/docs/node/feed-views.md
- View as markdown
- Open in ChatGPT
- Open in Claude