Activity Feeds v3 is in beta — try it out!

Members

Manage members

You can add and remove members to a feed. This is useful for building communities where a set of users can add content to the feed.

It’s not possible to set/update member role on client-side. Use server-side SDKs for this. When adding members client-side all new members will have feed_member role:

// The following methods are available to edit the members of a feed
try await feed.updateFeedMembers(
    request: .init(
        members: [.init(
            custom: ["joined": "2024-01-01"],
            userId: "john"
        )],
        operation: .upsert
    )
)
// Remove members
try await feed.updateFeedMembers(
    request: .init(
        members: [.init(userId: "john"), .init(userId: "jane")],
        operation: .remove
    )
)
// Set members (overwrites the list)
try await feed.updateFeedMembers(
    request: .init(
        members: [.init(userId: "john")],
        operation: .set
    )
)

Overview of the feed member model

FeedMemberResponse

NameTypeDescriptionConstraints
created_atnumberWhen the membership was createdRequired
customobjectCustom data for the membership-
invite_accepted_atnumberWhen the invite was accepted-
invite_rejected_atnumberWhen the invite was rejected-
membership_levelMembershipLevelResponseMembership level assigned to the member-
rolestringRole of the member in the feedRequired
statusstring (member, pending, rejected)Status of the membershipRequired
updated_atnumberWhen the membership was last updatedRequired
userUserResponseUser who is a memberRequired

Feed members vs followers

Followers and members might seem like similar concepts, but they serve two different purposes with some key differences.

Followers can only be feeds (for example the timeline feed of Alice follows the user feed of Bob). Followers’ aim is to access the content of a feed they’re interested in and interact with it.

Members can only be users (for example Alice adds Bob as a member to her feed about “Travel Hacks”). The aim of feed members is usually to help out with admin tasks (helpful if you want to build apps similar to Facebook pages) or to decide what activities a user has access to using membership levels (for example Bob becomes a premium member in Alice’s community).

Member invites

You can invite members with the invite flag, where invited users can accept or reject the membership.

// Request to become a member
try await feed.updateFeedMembers(
    request: .init(
        members: [.init(
            custom: ["reason": "community builder"],
            invite: true,
            userId: "john"
        )],
        operation: .upsert
    )
)
// Accept and reject member requests
_ = try await feed.acceptFeedMember()
_ = try await feed.rejectFeedMember()

Query Feed Members

You can query the members of a feed. This is useful for showing the list of members in a community.

val memberList = client.memberList(
    MembersQuery(
        fid = FeedId(group = "stock", id = "apple"),
        filter = MembersFilterField.role.equal("moderator"),
    )
)
memberList.get()
memberList.state.members.collect { members ->
    // Handle members
}

Feed Members Queryable Built-in Fields

nametypedescriptionsupported operationsexample
user_idstring or list of stringsThe ID of the user who is a member of the feed$in, $eq{ user_id: { $eq: 'user_123' } }
rolestring or list of stringsThe role of the member$in, $eq{ role: { $in: [ 'admin', 'moderator', 'member' ] } }
statusstring or list of stringsThe membership status$in, $eq{ status: { $in: [ 'member', 'pending', 'rejected' ] } }
created_atstring, must be formatted as an RFC3339 timestampThe time the membership was created$eq, $gt, $gte, $lt, $lte{ created_at: { $gte: '2023-12-04T09:30:20.45Z' } }
updated_atstring, must be formatted as an RFC3339 timestampThe time the membership was last updated$eq, $gt, $gte, $lt, $lte{ updated_at: { $gte: '2023-12-04T09:30:20.45Z' } }
© Getstream.io, Inc. All Rights Reserved.