require 'getstream_ruby'
# Initialize the client
client = GetStreamRuby.manual(
api_key: 'your_api_key',
api_secret: 'your_api_secret'
)
# Create a feed (or get its data if exists)
feed_response = client.feeds.get_or_create_feed(
'user',
'john',
GetStream::Generated::Models::GetOrCreateFeedRequest.new(user_id: 'john')
)
# Add activity
activity_request = GetStream::Generated::Models::AddActivityRequest.new(
type: 'post',
text: 'Hello, Stream Feeds!',
user_id: 'john',
feeds: ['user:john']
)
response = client.feeds.add_activity(activity_request)Quick Start
Stream lets you build activity feeds at scale. The largest apps on Stream have over 100 M+ users. V3 keeps that scalability while giving you more flexibility over the content shown in your feed.
What’s new in V3
-
For-You feed: Most modern apps combine a “For You” feed with a regular “Following” feed. V3 introduces activity selectors so you can:
- surface popular activities
- show activities near the user
- match activities to a user’s interests
- mix-and-match these selectors to build an engaging personalized feed.
-
Performance: 20–30 % faster flat feeds. Major speedups for aggregation & ranking (full benchmarks coming soon)
-
Client-side SDKs: Swift/Kotlin/React/Flutter & React Native are in progress
-
Activity filtering: Filter activity feeds with almost no hit to performance
-
Comments: Voting, ranking, threading, images, URL previews, @mentions & notifications. Basically all the features of Reddit style commenting systems.
-
Advanced feed features: Activity expiration • visibility controls • feed visibility levels • feed members • bookmarking • follow-approval flow • stories support.
-
Search & queries: Activity search, query activities, and query feeds endpoints.
-
Modern essentials: Permissions • OpenAPI spec • GDPR endpoints • realtime WebSocket events • push notifications • “own capabilities” API.
-
Coming soon: User-engagement stats • Campaign API • V2 → V3 migration tools.
What's coming for feeds V3?
- Android and Flutter SDKs to extend the existing JavaScript, React, React Native and iOS SDKs ✅
- Python, Java, PHP and .NET SDKs to extend the existing Go and Node SDKs ✅
- Ruby SDK ✅
- Dashboard support (in the meantime you can use server-side SDKs for admin tasks, for example, creating feed groups) - Beta Dashboard
- Migration system from V2 to V3 ✅
- Benchmarking ✅
- User-engagement stats ⏳
- Campaign API ⏳
Server side VS Client side
- Most API calls can be done client side
- Client side API calls use the permission system. Server side API calls have full access
Most apps will default to making API calls client side, and server side do the following:
- Updating feed groups or feed views for ranking and aggregation
- Syncing users
- Returning tokens for authenticating users
- Writing to feeds that don't belong to the current user (since the user doens't have access client side to do this)
Getting Started
import io.getstream.services.framework.StreamSDKClient;
import io.getstream.services.FeedsImpl;
import io.getstream.services.Feed;
import io.getstream.services.framework.StreamHTTPClient;
import io.getstream.models.*;
StreamSDKClient client = new StreamSDKClient("<API key>", "<API secret>");
FeedsImpl feedsClient = new FeedsImpl(new StreamHTTPClient("<API key>", "<API secret>"));
// Create a feed (or get its data if exists)
Feed feed = new Feed("user", "john", feedsClient);
GetOrCreateFeedRequest feedRequest = GetOrCreateFeedRequest.builder().userID("john").build();
feed.getOrCreate(feedRequest);
// Add activity
AddActivityRequest activity = AddActivityRequest.builder()
.type("post")
.text("Hello, Stream Feeds!")
.userID("john")
.build();
feedsClient.addActivity(activity).execute();Key Concepts
Activities
Activities are the core content units in Stream Feeds. They can represent posts, photos, videos, polls, and any custom content type you define.
Feeds
Feeds are collections of activities. They can be personal feeds, timeline feeds, notification feeds, or custom feeds for your specific use case.
Real-time Updates
Stream Feeds provides real-time updates through WebSocket connections, ensuring your app stays synchronized with the latest content.
Social Features
Built-in support for reactions, comments, bookmarks, and polls makes it easy to build engaging social experiences.
Common Use Cases
Social Media Feed
import io.getstream.services.framework.StreamSDKClient;
import io.getstream.services.FeedsImpl;
import io.getstream.services.Feed;
import io.getstream.services.framework.StreamHTTPClient;
import io.getstream.models.*;
StreamSDKClient client = new StreamSDKClient("<API key>", "<API secret>");
FeedsImpl feedsClient = new FeedsImpl(new StreamHTTPClient("<API key>", "<API secret>"));
// Create a feed (or get its data if exists)
Feed feed = new Feed("user", "john", feedsClient);
GetOrCreateFeedRequest feedRequest = GetOrCreateFeedRequest.builder().userID("john").build();
feed.getOrCreate(feedRequest);
// Add activity
AddActivityRequest activity = AddActivityRequest.builder()
.type("post")
.text("Hello, Stream Feeds!")
.userID("john")
.build();
feedsClient.addActivity(activity).execute();
// Please refer to the JavaScript examples above for the API structureNotification Feed
import io.getstream.services.framework.StreamSDKClient;
import io.getstream.services.FeedsImpl;
import io.getstream.services.Feed;
import io.getstream.services.framework.StreamHTTPClient;
import io.getstream.models.*;
StreamSDKClient client = new StreamSDKClient("<API key>", "<API secret>");
FeedsImpl feedsClient = new FeedsImpl(new StreamHTTPClient("<API key>", "<API secret>"));
// Create a notification feed
Feed notifications = new Feed("notification", "john", feedsClient);
GetOrCreateFeedRequest feedRequest = GetOrCreateFeedRequest.builder().userID("john").build();
notifications.getOrCreate(feedRequest);Polls
import io.getstream.services.framework.StreamSDKClient;
import io.getstream.services.FeedsImpl;
import io.getstream.services.Feed;
import io.getstream.services.framework.StreamHTTPClient;
import io.getstream.models.*;
StreamSDKClient client = new StreamSDKClient("<API key>", "<API secret>");
FeedsImpl feedsClient = new FeedsImpl(new StreamHTTPClient("<API key>", "<API secret>"));
// Create a feed (or get its data if exists)
Feed feed = new Feed("user", "john", feedsClient);
GetOrCreateFeedRequest feedRequest = GetOrCreateFeedRequest.builder().userID("john").build();
feed.getOrCreate(feedRequest);
// Add activity
AddActivityRequest activity = AddActivityRequest.builder()
.type("post")
.text("Hello, Stream Feeds!")
.userID("john")
.build();
feedsClient.addActivity(activity).execute();
// Please refer to the JavaScript examples above for the API structureAdvanced Features
Custom Activity Types
Create custom activity types to represent your app's specific content:
import io.getstream.services.framework.StreamSDKClient;
import io.getstream.services.FeedsImpl;
import io.getstream.services.Feed;
import io.getstream.services.framework.StreamHTTPClient;
import io.getstream.models.*;
StreamSDKClient client = new StreamSDKClient("<API key>", "<API secret>");
FeedsImpl feedsClient = new FeedsImpl(new StreamHTTPClient("<API key>", "<API secret>"));
// Create a feed (or get its data if exists)
Feed feed = new Feed("user", "john", feedsClient);
GetOrCreateFeedRequest feedRequest = GetOrCreateFeedRequest.builder().userID("john").build();
feed.getOrCreate(feedRequest);
// Add activity
AddActivityRequest activity = AddActivityRequest.builder()
.type("post")
.text("Hello, Stream Feeds!")
.userID("john")
.build();
feedsClient.addActivity(activity).execute();
// Please refer to the JavaScript examples above for the API structureReal-time Updates with State Layer
Only for client-side SDKs
@MainActor class FeedViewModel: ObservableObject {
private var cancellables = Set<AnyCancellable>()
private let feed: Feed
@Published var activities: [ActivityData] = []
init(feed: Feed) {
self.feed = feed
setupRealtimeUpdates()
}
private func setupRealtimeUpdates() {
feed.state.$activities
.sink { [weak self] activities in
self?.activities = activities
}
.store(in: &cancellables)
}
}