Skip to content

followUser(sourceUserId_targetUserId_)

daneden edited this page Apr 3, 2022 · 5 revisions

followUser(sourceUserId:targetUserId:)

Allows a user ID to follow another user.

public func followUser(
    sourceUserId: User.ID,
    targetUserId: User.ID
  )

Equivalent to POST /2/user/:user_id/following.

If the target user does not have public Tweets, this endpoint will send a follow request.

The request succeeds with no action when the authenticated user sends a request to a user they're already following, or if they're sending a follower request to a user that does not have public Tweets.

Parameters

  • sourceUserId: The authenticated user ID who you would like to initiate the follow on behalf of.
  • targetUserId: The user ID of the user that you would like the sourceUserId to follow.

Returns

A FollowResponse indicating whether the source user is now following the target user, and whether the follow request is pending

Types
Global Variables
Global Functions
Extensions
Clone this wiki locally