Following Feeds Confused about "Following Feeds"?
Let us know how we can improve our documentation:
Confused about "Following Feeds"?
Let us know how we can improve our documentation:
Following relationships are a fundamental part of social networks and many other apps that feature feeds. They link one Feed to another and cause Activities added to a feed to appear in any other feeds that follow it.
When an Activity is added to a feed, it is automatically added to any other feeds that follow the feed. This does not propagate further through the graph of following relationships. If your app requires that the Activity be added to other feeds, "to" field targeting or a batch activity add may be suitable.
The code example below shows you how to follow a feed:
1
2
3
4
5
// timeline:timeline_feed_1 follows user:user_42:
await timeline_feed_1.follow('user', 'user_42');
// Follow feed without copying the activities:
await timeline_feed_1.follow('user', 'user_42', { limit: 0 });
1
2
3
4
5
# timeline:timeline_feed_1 follows user:user_42
timeline_feed_1.follow("user", "user_42")
# Follow feed without copying the activities
timeline_feed_1.follow("user", "user_42", activity_copy_limit=0)
1
2
3
4
5
6
# timeline:timeline_feed_1 follows user:user_42
timeline_feed_1 = client.feed('timeline', 'timeline_feed_1')
timeline_feed_1.follow('user', 'user_42')
# follow feed without copying the activities:
timeline_feed_1.follow('user', 'user_42', activity_copy_limit=0)
1
2
3
4
5
6
// timeline:timeline_feed_1 follows user:user_42
$timeline1 = $client->feed('timeline', 'timeline_1');
$timeline1->follow('user', 'user_42');
// follow feed without copying the activities:
$timeline1->follow('user', 'user_42', 0)
1
2
3
4
5
6
7
// timeline:timeline_feed_1 follows user:user_42
FlatFeed user = client.flatFeed("user", "user_42");
FlatFeed timeline = client.flatFeed("timeline", "timeline_feed_1");
timeline.follow(user);
// follow feed without copying the activities:
timeline.follow(user, 0);
1
2
3
4
5
6
7
8
9
10
// timeline:timeline_feed_1 follows user:user_42
user := client.FlatFeed("user", "user_42")
timeline := client.FlatFeed("timeline", "timeline_feed_1")
err := timeline.Follow(user)
if err != nil {
panic(err)
}
// follow feed without copying the activities:
timeline.Follow(user, stream.WithFollowFeedActivityCopyLimit(20))
1
2
3
4
5
6
7
8
// A timeline feed for the current user.
let timelineFeed = Client.shared.flatFeed(feedSlug: "timeline")
// `timeline:current_user_id` follows `user:user_42`:
timelineFeed?.follow(toTarget: FeedId(feedSlug: "user", userId: "user_42")) { result in /* ... */ }
// Follow feed without copying the activities:
timelineFeed?.follow(toTarget: FeedId(feedSlug: "user", userId: "user_42"), activityCopyLimit: 0) { result in /* ... */ }
1
2
3
4
5
6
// timeline:timeline_feed_1 follows user:user_42
var timelineFeed1 = client.Feed("timeline", "timeline_feed_1");
await timelineFeed1.FollowFeed("user", "user_42");
// follow feed without copying the activities:
await timelineFeed1.FollowFeed("user", "user_42", 0);
Also take note that:
By default, the most recent 100 existing activities in the target feed will be added to the follower feed, but this can be changed via the activity_copy_limit
parameter.
ParametersCopied!Confused about "Parameters"?
Let us know how we can improve our documentation:
Confused about "Parameters"?
Let us know how we can improve our documentation:
name | type | description | default | optional |
---|---|---|---|---|
feed | string | The feed id | - | |
target | string | The feed is of the target feed | - | |
activity_copy_limit | string | How many activities should be copied from the target feed. max 1000 | - | ✓ |
If you need to follow many feeds at once have a look at how to batch follow later in this document. If you need to run large imports, use our JSON import format.
Unfollowing FeedsCopied!Confused about "Unfollowing Feeds"?
Let us know how we can improve our documentation:
Confused about "Unfollowing Feeds"?
Let us know how we can improve our documentation:
Unfollowing a feed removes the following relationship with the feed specified in the target parameter. See the following examples:
1
2
3
4
5
// Stop following feed user_42 - purging history:
await timeline_feed_1.unfollow('user', 'user_42');
// Stop following feed user_42 but keep history of activities:
await timeline_feed_1.unfollow('user', 'user_42', { keepHistory: true });
1
2
3
4
5
# Stop following feed user_42
timeline_feed_1.unfollow("user", "user_42")
# Stop following feed user_42 but keep history of activities
timeline_feed_1.unfollow("user", "user_42", keep_history=True)
1
2
3
4
5
# Stop following feed user_42
timeline_feed_1.unfollow('user', 'user_42')
# Stop following feed 42 but keep history of activities
timeline_feed_1.unfollow('user', 'user_42', keep_history=true)
1
2
3
4
5
// Stop following feed user_42
$timelineFeed1->unfollow('user', 'user_42');
// Stop following feed user_42 but keep history of activities:
$timelineFeed1->unfollow('user', 'user_42', true);
1
2
3
4
5
// Stop following feed user:user_42
timeline.unfollow(user);
// Stop following feed user:user_42 but keep history of activities
timeline.unfollow(user, KeepHistory.YES);
1
2
3
4
5
6
7
8
9
10
11
12
// user := client.FlatFeed("user", "42")
// Stop following feed user:user_42
err := timeline.Unfollow(user)
if err != nil {
panic(err)
}
// Stop following feed user:user_42 but keep history of activities
err = timeline.Unfollow(user, stream.WithUnfollowKeepHistory(true))
if err != nil {
panic(err)
}
1
2
3
4
5
// Stop following feed user_42 - purging history:
timelineFeed?.unfollow(fromTarget: FeedId(feedSlug: "user", userId: "user_42")) { result in /* ... */ }
// Stop following feed user_42 but keep history of activities:
timelineFeed?.unfollow(fromTarget: FeedId(feedSlug: "user", userId: "user_42"), keepHistory: true) { result in /* ... */ }
1
2
3
4
5
6
var timelineFeed1 = client.Feed("timeline", "timeline_feed_1");
// stop following feed user_42
await timelineFeed1.UnfollowFeed("user", "user_42");
// stop following feed 42 but keep history of activity
Existing Activities in the feed that originated in a no longer followed target feed will be purged unless the keep_history
parameter is provided.
ParametersCopied!Confused about "Parameters"?
Let us know how we can improve our documentation:
Confused about "Parameters"?
Let us know how we can improve our documentation:
name | type | description | default | optional |
---|---|---|---|---|
feed | string | The feed id | - | |
target | string | The feed id of the target feed | - | |
keep_history | boolean | Whether the activities from the unfollowed feeds should be removed | false | ✓ |
Reading Feed FollowersCopied!Confused about "Reading Feed Followers"?
Let us know how we can improve our documentation:
Confused about "Reading Feed Followers"?
Let us know how we can improve our documentation:
Returns a paginated list of the given feed's followers. See the following example:
1
2
// List followers
const response = await user1.followers({limit: '10', offset: '10'});
1
2
# list followers
user_feed_1.followers(offset=0, limit=10)
1
2
# list followers
user_feed_1.followers(0, 10)
1
2
// list followers
$userFeed1->followers(0, 10);
1
2
3
4
5
6
// list followers
List<followrelation> followers = userFeed.getFollowers(new Limit(10), new Offset(0)).get();
for (FollowRelation follow : followers) {
System.out.format("%s -> %s", follow.getSource(), follow.getTarget());
// ...
}</followrelation>
1
2
3
4
5
6
// list followers
resp, err := userFeed.GetFollowers(stream.WithFollowersOffset(0), stream.WithFollowersLimit(10))
for _, follower := range resp.Results {
fmt.Println(follower.FeedID, "->", follower.TargetID)
// ...
}
1
2
3
4
5
// The current user feed.
let userFeed = Client.shared.flatFeed(feedSlug: "user")
// List followers.
userFeed?.followers(offset: 10, limit: 10) { result in /* ... */ }
1
await userFeed1.Followers(0, 10);
The followers returned by the API are sorted reverse chronologically, according to the time the follow relationship was created.
ParametersCopied!Confused about "Parameters"?
Let us know how we can improve our documentation:
Confused about "Parameters"?
Let us know how we can improve our documentation:
name | type | description | default | optional |
---|---|---|---|---|
limit | integer | Amount of results per request, max 100 | 25 | ✓ |
offset | integer | Number of rows to skip before returning results, max 999 | 0 | ✓ |
Response DataCopied!Confused about "
Response Data"?
Let us know how we can improve our documentation:
Confused about " Response Data"?
Let us know how we can improve our documentation:
1
2
3
4
5
6
7
8
9
10
{
"results": [
{
"feed_id": "conversation2:test",
"target_id": "conversation2:user_2",
"created_at": "2018-01-19T09:35:17.817332Z"
}
],
"duration": "1.92ms"
}
Reading Followed FeedsCopied!Confused about "Reading Followed Feeds"?
Let us know how we can improve our documentation:
Confused about "Reading Followed Feeds"?
Let us know how we can improve our documentation:
Returns a paginated list of the feeds which are followed by the feed. See the following example:
1
2
3
4
5
6
7
8
// Retrieve last 10 feeds followed by user_feed_1
let response = await user1.following({ offset: 0, limit: 10 });
// Retrieve 10 feeds followed by user_feed_1 starting from the 11th
response = await user1.following({ offset: 10, limit: 10 });
// Check if user1 follows specific feeds
response = await user1.following({ offset: 0, limit: 2, filter: ['user:42', 'user:43'] })
1
2
3
4
5
6
7
8
# Retrieve last 10 feeds followed by user_feed_1
user_feed_1.following(offset=0, limit=10)
# Retrieve 10 feeds followed by user_feed_1 starting from the 11th
user_feed_1.following(offset=10, limit=10)
# Check if user_feed_1 follows specific feeds
user_feed_1.following(offset=0, limit=2, feeds=['user:42', 'user:43'])
1
2
3
4
5
6
7
8
# Retrieve 10 feeds followed by user_feed_1
user_feed_1.following(10)
# Retrieve 10 feeds followed by user_feed_1 starting from the 11th
user_feed_1.following(10, 10)
# Check if user_feed_1 follows specific feeds
user_feed_1.following(0, 2, filter=['user:42', 'user:43'])
1
2
3
4
5
6
7
8
// Retrieve 10 feeds followed by $userFeed1
$userFeed1->following(0, 10);
// Retrieve 10 feeds followed by $userFeed1 starting from the 10th (2nd page)
$userFeed1->following(10, 10);
// Check if $userFeed1 follows specific feeds
$userFeed1->following(0, 2, ['user:42', 'user:43']);
1
2
3
4
5
6
7
8
// Retrieve last 10 feeds followed by user_feed_1
List<followrelation> followed = userFeed.getFollowed(new Limit(10), new Offset(0)).get();
// Retrieve 10 feeds followed by user_feed_1 starting from the 11th
followed = userFeed.getFollowed(new Limit(10), new Offset(10)).get();
// Check if user_feed_1 follows specific feeds
followed = userFeed.getFollowed(new Limit(2), new Offset(0), new FeedID("user:42"), new FeedID("user", "43")).get();</followrelation>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Retrieve last 10 feeds followed by user_feed_1
resp, err := userFeed.GetFollowing(stream.WithFollowingOffset(0), stream.WithFollowingLimit(10))
if err != nil {
panic(err)
}
// Retrieve 10 feeds followed by user_feed_1 starting from the 11th
resp, err = userFeed.GetFollowing(stream.WithFollowingOffset(10), stream.WithFollowingLimit(10))
if err != nil {
panic(err)
}
// Check if user_feed_1 follows specific feeds
resp, err = userFeed.GetFollowing(
stream.WithFollowingOffset(0),
stream.WithFollowingLimit(2),
stream.WithFollowingFilter("user:42", "user:43"),
)
if err != nil {
panic(err)
}
1
2
3
4
5
6
7
8
9
// Retrieve last 10 feeds followed by the current user.
userFeed?.following(limit: 10) { result in /* ... */ }
// Retrieve 10 feeds followed by the current user starting from the 11th.
userFeed?.following(offset: 10, limit: 10) { result in /* ... */ }
// Check if the current user follows specific feeds.
userFeed?.following(filter: [FeedId(feedSlug: "user", userId: "42"),
FeedId(feedSlug: "user", userId: "43")], limit: 2) { result in /* ... */ }
1
2
3
4
5
6
7
8
// Retrieve last 10 feeds followed by userFeed1
await userFeed1.Following(0, 10);
// Retrieve 10 feeds followed by userFeed1 starting from the 11th
await userFeed1.Following(10, 10);
// Check if user1 follows specific feeds
await userFeed1.Following(0, 2, new string[] { "user:42", "user:43" })
The followed feeds returned by the API are sorted reverse chronologically, according to the time the follow relationship was created.
ParametersCopied!Confused about "Parameters"?
Let us know how we can improve our documentation:
Confused about "Parameters"?
Let us know how we can improve our documentation:
name | type | description | default | optional |
---|---|---|---|---|
limit | integer | Amount of results per request, max 100 | 25 | ✓ |
offset | integer | Number of rows to skip before returning results, max 999 | 0 | ✓ |
filter | string | The comma-separated list of feeds to filter results on | - | ✓ |
Response DataCopied!Confused about "Response Data"?
Let us know how we can improve our documentation:
Confused about "Response Data"?
Let us know how we can improve our documentation:
1
2
3
4
5
6
7
8
9
10
11
{
results: [
{
feed_id: 'conversation2:test',
target_id: 'conversation2:user_2',
created_at: '2018-01-19T09:35:17.817332Z',
updated_at: null
}
],
duration: '1.92ms'
}
Reading follow statsCopied!Confused about "Reading follow stats"?
Let us know how we can improve our documentation:
Confused about "Reading follow stats"?
Let us know how we can improve our documentation:
Paginating followers and/or followings is sometimes not the answer and only counts are needed. In this case, stats can be retrieved directly too. With default permissions, it works automatically for server side auth. For client-side auth, please contact support to add it to your required feed groups.
1
2
3
4
5
6
7
// get follower and following stats of the feed
client.feed('user', 'me').followStats()
// get follower and following stats of the feed but also filter with given slugs
// count by how many timelines follow me
// count by how many markets are followed
client.feed.followStats({followerSlugs: ['timeline'], followingSlugs: ['market']})
Response DataCopied!Confused about "Response Data"?
Let us know how we can improve our documentation:
Confused about "Response Data"?
Let us know how we can improve our documentation:
1
2
3
4
5
6
7
{
results: {
followers: { count: 1529, feed: 'user:me' },
followings: { count: 81, feed: 'user:me' }
},
duration: '1.92ms'
}