Follow / Unfollow

Following relationships are a fundamental part of social networks. This creates a relationship between users in social features. The connection between users will be used to determine the visibility and the accessibility of data in User Feed and Global feed.

User relationship concept

In the current state, our SDK provides a one-direction relationship. For example, when user A has followed User B, in this case, the system will know that user A has connected with B.

‌User connection method concept

In the current state, our SDK provides two ways for users to create relationships with other users. This connection method will be applied to every user in the network.

  1. With request process This means that once a user sends the Follow action to the target userId , the system will send the request to the target user. Until the target user accepts the follow request, the connection will not be established yet.

  2. Without Request process This means that once a user sends the Follow action to the target userId, the system will automatically establish the connection between 2 users.

The default connection method is the With request process. If you wish to change the connection method, you can contact our support team.

Get follow status and connection counter

The first step to start following other users is to know the connection status of the target user. You can follow this sample code.

Our SDK does provide 3 statuses:

  1. accepted This status means the target user has already connected to the SDK method caller.

  2. pending This status means the target user has already received the follow request from the SDK method caller. This status will only be available when the connection method setting is With request process.

  3. none This status means the target user has not connected to the SDK caller.

With the getFollowInfo method, you can get the total count of :

  1. followerCount This is the total number of users that the target user is following.

  2. followingCount This is the total number of users who followed the target user.

  3. pendingCount This is the total number of follow requests the target user has received

Follow other user

To start following other users, you can simply pass the userId of the user that you want to follow and we will do the rest. Use the following code:

Withdraw your follow request or Unfollow other user

If you want to withdraw the follow request, you may use this code:

Get the list of followers

To see the followers user list, you can use this code:

We currently do not support sorting of the follower user list.

Get the list of the following users

To see the Following user list, you can try this code:

We currently do not support sorting of the following user list.

Get the list of follow requests

To see the follow request list, you can try this code:

We currently do not support sorting of the follow request user list.

Accept follow request

To accept the follow request, you can try this code:

Decline follow request

To decline the follow request , you can try this code.

If the Follower request is no longer available (either the follower request sender has withdrawn the request or the request has been accepted or declined before) SDK will return the error message.

‌Observe follow status and connection counter

As well as getting the follow status, you may also interact with a it using an observer pattern through observeFollowInfo.

Observe the list of followers

Observe the list of following users

To implement Realtime events on Follow changes, refer to Follow Topics.

Last updated