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.
- Unity
- Unreal Engine
API | Function |
---|---|
AddFriendResultObserver | Add the FriendResult callback to manage QueryFriends callback. |
RemoveFriendResultObserver | Delete the FriendResult callback. |
API | Function |
---|---|
SetFriendResultObserver | Sets the FriendResult callback for the friend list. |
GetFriendResultObserver | Gets the FriendResult callback for the friend list. |
OnFriendResult_Implementation | Implements the FriendResult callback for QueryFriends. |
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.
- Unity
- Unreal Engine
INTLAPI.QueryFriends(1, 10, false, INTLChannel.Discord); //Organizes platform friends to 10 per page, returns to page 1
UINTLSDKAPI::QueryFriends(EINTLLoginChannel::kChannelDiscord, 1, 10, false, "{}"); //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.
- Unity
- Unreal Engine
INTLAPI.QueryFriends(1, 10, false, INTLChannel.Epic); //Organizes platform friends to 10 per page, returns to page 1
UINTLSDKAPI::QueryFriends(EINTLLoginChannel::kChannelEpic, 1, 10, false, "{}"); //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.
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.
- Unity
- Unreal Engine
INTLAPI.QueryFriends(1, 10, true, INTLChannel.KaKao);
UINTLSDKAPI::QueryFriends(EINTLLoginChannel::kChannelKaKao);
Kakao Error Codes
The following table shows some common error codes for Kakao.
Error code | Error message | Description |
---|---|---|
200 | Success | Success |
400 | BadRequest | Bad request. An invalid request has been sent to the server. Unparsed data. Missing required parameters or parameter type error. |
401 | AuthFailure | Authentication failure. The access token of the IDP delivered during automatic or manual login is not valid. |
403 | Forbidden | Forbidden request. The request was sent by an unauthorized user. |
404 | NotFound | Unsupported function. A server API that does not exist was called. |
406 | NotExistData | The 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. |
406 | AlreadyUsedIdpAccount | Account conversion was attempted using an account that has already been authenticated by someone else. |
409 | ConflictData | Data overlap. An attempt was made to register again data which cannot be overridden. |
461 | Punishment | User punishment |
473 | ServiceUnavailable | Service unavailable (maintenance). Platform service is not available. For example, platform server maintenance, etc. |
483 | NotAllowed | Not allowed |
500 | InternalError | Server system internal error |
1001 | NetworkFailure | Network error. The device is not connected to a network (3G/LTE/WiFi) |
2001 | ServerTimeout | Server timeout. No response from the server for a certain period (currently 10 seconds). |
2002 | ServerException | Exception in server action. An exception occurred while the server response is being processed. |
2003 | InvalidResponse | Invalid response from the server. The server sent an invalid response. |
3000 | InitializationFailed | Initialization 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. |
3001 | NotInitialized | Not initialized. An API other than initialize/start is called when the platform is not initialized. |
3002 | NotAuthorized | Not authorized. An API other than lifecycle/authentication API is called without authentication. |
4000 | InvalidParameter | Parameter error. The parameter which is delivered when the API is called has an error. |
4001 | ClientException | Error in client action. An error occurred in the client SDK action. |
4002 | InvalidState | Request 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. |
4003 | InProgress | Request in progress. Start API is called while start API is in progress. Login API is called while login API is in progress. |
4010 | IdpAuthFailure | KakaoTalk authentication failed. |
5001 | NotSupported | Not supported. |
6001 | APINotExists | The requested API does not exist. |
7001 | ExceedMonthlyUsage | Monthly usage limit has been reached. |
7002 | ExceedDailyUsage | Daily usage limit has been reached. |
7003 | ExceedMaxUploadSize | Maximum upload size has been reached. |
7004 | ExceedMaxUploadNumber | Maximum upload number has been reached. |
7101 | MessageSettingDisabled | The recipient’s message setting is disabled. |
7201 | KakaoTalkNotInstalled | KakaoTalk is not installed. |
7202 | NotKakaoTalkUser | Not a KakaoTalk user. |
9001 | UserCanceled | Cancelled by the user. Cancellation by the user occurred in actions requiring user interaction such as IDP authentication and coupon registration. |
9999 | Unknown | Unknown 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.
- Unity
- Unreal Engine
//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);
//Paginate co-playing friends according to the number of 10 per page, and return co-playing friends on page 1
UINTLSDKAPI::QueryFriends(EINTLLoginChannel::kChannelSteam, 1, 10, true, "{}");
//Paginate platform friends according to the number of 10 per page, and return the platform friends on page 1
UINTLSDKAPI::QueryFriends(EINTLLoginChannel::kChannelSteam, 1, 10, false, "{}");
Steam Friends Status
Friend status information is returned in the extra_json
field of `FriendResult
.
"extra_json": {
"persona_state": 0
}
persona_state
description:
Values | Description |
---|---|
0 | Offline |
1 | Online |
2 | Online but busy |
3 | Auto-away |
4 | Auto-away for a long time |
5 | Online, trading |
6 | Online, wanting to play |
7 | Online, 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.
ErrorCode | Description |
---|---|
1031 | Steam Dll failed to load |
1032 | Need to pull the game from the Steam platform |
1033 | Steam 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 andfalse
for platform friends; - An optional parameter for any additional data.
- Unity
- Unreal Engine
INTLAPI.QueryFriends(1, 10, true, INTLChannel.Switch);
UINTLSDKAPI::QueryFriends(EINTLLoginChannel::kChannelSwitch, 1 , 10, true);
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.
- Unity
- Unreal Engine
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
UINTLSDKAPI::QueryFriends(EINTLLoginChannel::kChannelVK, 1, 10, true, "{}"); //Organizes platform friends to 10 per page, returns to page 1
UINTLSDKAPI::QueryFriends(EINTLLoginChannel::kChannelVK, 1, 10, false, "{}"); //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.
- Unity
- Unreal Engine
UINTLSDKAPI::QueryFriends(EINTLLoginChannel::kChannelXbox);
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\"}"
}]
}