Skip to main content

Friend List

The friend list interface fetches a player's in-game friends for the active login channel, providing developers with the friend's OpenID and profile details. It also retrieves a complete list of platform friends for the active login channel, regardless of whether they are participating in the same game. However, the interface can only access friends from the currently active login channel. For example, players logged in via Facebook will be able to view their Facebook friends. On the other hand, players who log in with LI PASS, even if it's linked to their Facebook account, will not have access to their Facebook friends list.

The in-game friend list enables players to interact in various ways, such as exchanging in-game items, chatting, forming alliances to accomplish tasks, and more, limited only by the game's features.

Process the friend list request

Developers can register the following callback functions to receive notifications regarding friend list events. This allows developers to detect and process requests to query the friend list.

APIFunction
AddFriendResultObserverAdd the FriendResult callback to manage QueryFriends callback.
RemoveFriendResultObserverDelete the FriendResult callback.

After registering the callbacks, follow the below instructions to query the friend list for each login channel.

Query the friend list for Discord

The friend list feature on Player Network for Discord requires the identify, relationships.read, and activities.write permissions from Discord. For more information, see OAuth2 Scopes.

Once the permission has been granted, Player Network supports querying platform friends for Discord.

For the friend list feature to function properly, the player must have Discord installed and running on their devices with a valid login state. Call the QueryFriends function, specifying the active login channel, an integer for the page of friends to retrieve, another integer for the number of friends per page, a boolean to determine if only in-game friends should be retrieved, and an optional parameter for any additional data.

INTLAPI.QueryFriends(1, 10, false, INTLChannel.Discord); //Organizes platform friends to 10 per page, returns to page 1 

Query the friend list for Epic

The Epic friend list supports platform friends and friend pagination. Epic does not support getting in-game friends.

Call the QueryFriends function, specifying the active login channel, an integer for the page of friends to retrieve, another integer for the number of friends per page, a boolean set to false to retrieve platform friends, and an optional parameter for any additional data.

INTLAPI.QueryFriends(1, 10, false, INTLChannel.Epic); //Organizes platform friends to 10 per page, returns to page 1 

Query the friend list for Facebook

The friend list feature on Player Network for Facebook requires the user_friends permission from Facebook, granted only after undergoing Facebook's verification process. For more information, reach out to the Player Network representative.

Photo

Once the permission has been granted, you can retrieve your Facebook friend list via the HTTP API endpoint at /v2/friend/friend_list.

Query the friend list for Kakao

The Kakao friend list supports querying in-game friends.

Call the QueryFriends function, specifying the active login channel, an integer for the page of friends to retrieve, another integer for the number of friends per page, a boolean set to true to retrieve in-game friends, and an optional parameter for any additional data.

INTLAPI.QueryFriends(1, 10, true, INTLChannel.KaKao);
Kakao Error Codes

The following table shows some common error codes for Kakao.

Error codeError messageDescription
200SuccessSuccess
400BadRequestBad request. An invalid request has been sent to the server. Unparsed data. Missing required parameters or parameter type error.
401AuthFailureAuthentication failure. The access token of the IDP delivered during automatic or manual login is not valid.
403ForbiddenForbidden request. The request was sent by an unauthorized user.
404NotFoundUnsupported function. A server API that does not exist was called.
406NotExistDataThe requested data does not exist or the request is out of the authorized scope. For example, actions such as registration of a coupon that does not exist. (Example) The account which requested account conversion is already registered in the game.
406AlreadyUsedIdpAccountAccount conversion was attempted using an account that has already been authenticated by someone else.
409ConflictDataData overlap. An attempt was made to register again data which cannot be overridden.
461PunishmentUser punishment
473ServiceUnavailableService unavailable (maintenance). Platform service is not available. For example, platform server maintenance, etc.
483NotAllowedNot allowed
500InternalErrorServer system internal error
1001NetworkFailureNetwork error. The device is not connected to a network (3G/LTE/WiFi)
2001ServerTimeoutServer timeout. No response from the server for a certain period (currently 10 seconds).
2002ServerExceptionException in server action. An exception occurred while the server response is being processed.
2003InvalidResponseInvalid response from the server. The server sent an invalid response.
3000InitializationFailedInitialization failed. Platform initialization failed. It means that there is an issue with the platform environment setting, and the issue can be checked from the error message description.
3001NotInitializedNot initialized. An API other than initialize/start is called when the platform is not initialized.
3002NotAuthorizedNot authorized. An API other than lifecycle/authentication API is called without authentication.
4000InvalidParameterParameter error. The parameter which is delivered when the API is called has an error.
4001ClientExceptionError in client action. An error occurred in the client SDK action.
4002InvalidStateRequest cannot be processed. For example, the current authentication is not set up for device authentication when an account conversion is requested; or the user calls the KakaoStory API although the user is not a KakaoStory user.
4003InProgressRequest in progress. Start API is called while start API is in progress. Login API is called while login API is in progress.
4010IdpAuthFailureKakaoTalk authentication failed.
5001NotSupportedNot supported.
6001APINotExistsThe requested API does not exist.
7001ExceedMonthlyUsageMonthly usage limit has been reached.
7002ExceedDailyUsageDaily usage limit has been reached.
7003ExceedMaxUploadSizeMaximum upload size has been reached.
7004ExceedMaxUploadNumberMaximum upload number has been reached.
7101MessageSettingDisabledThe recipient’s message setting is disabled.
7201KakaoTalkNotInstalledKakaoTalk is not installed.
7202NotKakaoTalkUserNot a KakaoTalk user.
9001UserCanceledCancelled by the user. Cancellation by the user occurred in actions requiring user interaction such as IDP authentication and coupon registration.
9999UnknownUnknown error. An error occurred unexpectedly.

For more information, see Kakao Error Code.

Query the friend list for Steam

The Steam friend list supports querying platform friends and co-play friends, friend pagination, as well as querying friend status. Steam co-play friends are friends who have recently played a game together, not necessarily being friends on Steam.

For the friend list feature to function properly, the player must have Steam installed and running on their PC with a valid login state. Call the QueryFriends function, specifying the active login channel, an integer for the page of friends to retrieve, another integer for the number of friends per page, a boolean to determine whether to retrieve co-play friends or in-game friends, and an optional parameter for any additional data.

//Paginate the co-playing friends according to the number of 10 per page, and return the co-playing friends on page 1
INTLAPI.QueryFriends(1, 10, true, INTLChannel.Steam);
//Paginate platform friends according to the number of 10 per page, and return the platform friends on page 1
INTLAPI.QueryFriends(1, 10, false, INTLChannel.Steam);
Steam Friends Status

Friend status information is returned in the extra_json field of `FriendResult.

"extra_json": {
"persona_state": 0
}

persona_state description:

ValuesDescription
0Offline
1Online
2Online but busy
3Auto-away
4Auto-away for a long time
5Online, trading
6Online, wanting to play
7Online, but appears offline to friends. This status is never shown to clients
Steam Error Codes

The following table shows some common error codes for Steam.

ErrorCodeDescription
1031Steam Dll failed to load
1032Need to pull the game from the Steam platform
1033Steam initialization failed, usually because steam_appid.txt is not placed in the same directory as the executable .exe file, or the Steam software did not start.

Query the friend list for Switch

The Switch friend list supports querying platform friends and in-game friends, as well as friend pagination.

Call the QueryFriends function with the following parameters:

  • The active login channel which is Switch;
  • An integer representing the page of friends to retrieve which defaults to 0 if not specified.
  • Another integer for the number of friends per page which cannot exceed 300, this means that one page can have at most 300 data records and the number of records must be the same for every page;
  • A boolean to which is set to true for in-game friends and false for platform friends;
  • An optional parameter for any additional data.
INTLAPI.QueryFriends(1, 10, true, INTLChannel.Switch);

The returned data structure is:

{
"ret": 0,
"msg": "",
"method_id": 203,
"ret_code": 0,
"ret_msg": "Success",
"extra_json": "{}",
"extinfo": "{}",
"lists": [{
"openid": "eb4621e26d73bdab",
"user_name": "xuzhang",
"gender": 0,
"picture_url": "",
"country": "",
"province": "",
"city": "",
"language": "",
"extra_json": "{\"status\":\"0\",\"isFavorite\":\"true\",\"lastPlayedAppId\":\"0\",\"lastPlayedGroupId\":\"0\",\"lastUpdateTime\":\"1668740158\",\"isSameApplication\ ":\"false\"}"
}, {
"openid": "8867f26c1681ea8b",
"user_name": "swtchtest",
"gender": 0,
"picture_url": "",
"country": "",
"province": "",
"city": "",
"language": "",
"extra_json": "{\"status\":\"0\",\"isFavorite\":\"true\",\"lastPlayedAppId\":\"300761088\",\"lastPlayedGroupId\":\"300761088\",\"lastUpdateTime\":\"1670204409\",\"isSameApplication\":\"true\"}"
}]
}

Query the friend list for VK

The VK friend list supports platform friends and friend pagination. Call the QueryFriends function, specifying the active login channel, an integer for the page of friends to retrieve, another integer for the number of friends per page, a boolean to determine if only in-game friends should be retrieved, and an optional parameter for any additional data.

INTLAPI.QueryFriends(1, 10, true, INTLChannel.VK); //Organizes platform friends to 10 per page, returns to page 1 
INTLAPI.QueryFriends(1, 10, false, INTLChannel.VK); //Organizes platform friends to 10 per page, returns to page 1

Query the friend list for Xbox Series X|S

The Xbox Series X|S friend list supports querying in-game friends.

Call the QueryFriends function, specifying the active login channel, an integer for the page of friends to retrieve, another integer for the number of friends per page, a boolean set to true to retrieve in-game friends, and an optional parameter for any additional data.

The returned data structure is:

{
"ret": 0,
"msg": "",
"method_id": 203,
"ret_code": 0,
"ret_msg": "Success",
"extra_json": "{}",
"extinfo": "{}",
"lists": [{
"openid": "10027382",
"user_name": "xuzhang",
"gender": 0,
"picture_url": "",
"country": "",
"province": "",
"city": "",
"language": "",
"extra_json": "{\"status\":\"Online\"}"
}, {
"openid": "10027312",
"user_name": "swtchtest",
"gender": 0,
"picture_url": "",
"country": "",
"province": "",
"city": "",
"language": "",
"extra_json": "{\"status\":\"Offline\"}"
}]
}