Activity Feeds v3 is in beta — try it out!

Search for Feeds

The query feeds endpoint lets you search for feeds.

Examples

Querying My Feeds

// First page query
var firstPage = await _feedsV3Client.QueryFeedsAsync(
    request: new QueryFeedsRequest
    {
        Filter = new { created_by_id = "john" },
        Limit = 10,
        Sort = new List<SortParamRequest>
        {
            new SortParamRequest
            {
                Field = "created_at",
                Direction = -1
            }
        }
    }
);

// Second page using next cursor from first page
var secondPage = await _feedsV3Client.QueryFeedsAsync(
    request: new QueryFeedsRequest
    {
        Filter = new { created_by_id = "john" },
        Limit = 10,
        Sort = new List<SortParamRequest>
        {
            new SortParamRequest
            {
                Field = "created_at",
                Direction = -1
            }
        },
        Next = firstPage.Next
    }
);

Querying Feeds Where I Am a Member

var response = await _feedsV3Client.QueryFeedsAsync(
    request: new QueryFeedsRequest
    {
        Filter = new
        {
            members = new { __in = new[] { "john" } }
        }
    }
);

Querying feeds by name or description

// Search public feeds by name
var response1 = await _feedsV3Client.QueryFeedsAsync(
    request: new QueryFeedsRequest
    {
        Filter = new
        {
            visibility = new { __eq = "public" },
            name = new { __q = "Sports" }
        }
    }
);

// Search public feeds by description
var response2 = await _feedsV3Client.QueryFeedsAsync(
    request: new QueryFeedsRequest
    {
        Filter = new
        {
            visibility = "public",
            description = new { __q = "tech" }
        }
    }
);

Querying feeds by creator name

var response = await _feedsV3Client.QueryFeedsAsync(
    request: new QueryFeedsRequest
    {
        Filter = new
        {
            visibility = "public",
            created_by = new { name = new { __q = "Thompson" } }
        }
    }
);

A complex example

Search for user feeds where text matches the feed’s name, description or creator’s name:

var response = await _feedsV3Client.QueryFeedsAsync(
    request: new QueryFeedsRequest
    {
        Filter = new
        {
            group_id = "user",
            __or = new[]
            {
                new { name = new { __q = searchQuery } },
                new { description = new { __q = searchQuery } },
                new { created_by = new { email = new { __q = searchQuery } } }
            }
        }
    }
);

Feeds Queryable Built-in Fields

nametypedescriptionsupported operationsexample
idstring or list of stringsThe ID of the feed$in, $eq{ id: { $in: [ 'abc', 'xyz' ] } }
group_idstring or list of stringsThe ID of the group this feed belongs to$in, $eq{ group_id: { $in: [ 'abc', 'xyz' ] } }
feedstring or list of stringsThe fully qualified feed ID (group_id:id)$in, $eq{ fid: { $in: [ 'abc', 'xyz' ] } }
visibilitystring or list of stringsThe visibility setting of the feed$in, $eq{ visibility: { $eq: 'public' } }
created_by_idstring or list of stringsThe ID of the user who created the feed$in, $eq{ created_by_id: { $in: [ 'abc', 'xyz' ] } }
created_by.namestringThe name of the user who created the feed$eq, $q, $autocomplete{ 'created_by.name': { $autocomplete: 'Frank' } }
namestringThe name of the feed$eq, $q, $autocomplete{ name: { $q: 'Sports' } }
descriptionstringThe description of the feed$eq, $q, $autocomplete{ description: { $autocomplete: 'tech' } }
member_countnumberThe number of members in this feed$eq, $ne, $gt, $lt, $gte, $lte{ member_count: { $gt: 100 } }
memberslist of stringsThe list of members in this feed$in{ members: { $in: [ 'bob', 'alice' ] } }
following_countnumberThe number of feeds this feed follows$eq, $ne, $gt, $lt, $gte, $lte{ following_count: { $gt: 100 } }
following_feedslist of stringsThe list of feeds this feed follows$in{ following_feeds: { $in: [ 'feed1', 'feed2' ] } }
follower_countnumberThe number of followers of this feed$eq, $ne, $gt, $lt, $gte, $lte{ follower_count: { $gt: 100 } }
created_atstring, RFC3339 timestampThe time the feed was created$eq, $gt, $lt, $gte, $lte{ created_at: { $gte: '2023-12-04T09:30:20.45Z' } }
updated_atstring, RFC3339 timestampThe time the feed was updated$eq, $gt, $lt, $gte, $lte{ updated_at: { $gte: '2023-12-04T09:30:20.45Z' } }
filter_tagslist of stringsTags for filtering the feed$eq, $contains, $in{ filter_tags: { $in: [ 'sports', 'news' ] } }

Filter expressions can be combined using $or and $and operators as well.

Feeds can be sorted by created_at, updated_at, member_count, follower_count, and following_count.

Be sure to reach out to support if you need additional query feed capabilities.

© Getstream.io, Inc. All Rights Reserved.