Last Updated: 9/22/2021, 7:52:24 AM

# Friends

# Overview

The Friends service allows players to connect socially with other players. This service uses WebSocket to ensure all players get real-time updates about their Friend List. Players can manage their friends in several different ways, including:

  • Request Friend allows players to add another player as a friend using that player’s User ID. Players will be notified when they receive a friend request.
  • Accept Friend Request allows players to accept friend requests they’ve received. After the player accepts the request, the requester will be notified and the two players will be linked as friends.
  • Reject Friend Request allows players to deny a friend request from a player they don’t want to be friends with.
  • Cancel Friend Request allows players to cancel and remove a pending friend request they have sent to another player, in case they have changed their mind or sent the request to the wrong player.
  • Get Friendship Status shows players their friendship status with another player. Possible statuses include:
  • Not Friend indicates that the players are not connected as friends.
  • Outgoing Friend indicates that the friend request sent by the player to another player is still pending.
  • Incoming Friend indicates that the player has received a friend request that is still pending.
  • Friend indicates that the two players are connected as friends.
  • List of Friends shows the player all of the players they’re currently friends with.
  • List of Incoming Friends shows the player a list of players that have requested to be their friend. Players can accept or reject these requests.
  • List of Outgoing Friends shows players the list of pending friend requests they have sent to other players.
  • Unfriend allows players to stop being friends with other players. Unfriending a player will remove that player from their friend list. If the player wants to be friends with an unfriended player, they will have to send that player another friend request.
  • Bulk Synchronization 3rd Party Platform Friends allows players to connect player’s friends from third party platforms to the AccelByte IAM service.

# How It Works

# Bulk Synchronization 3rd Party Platform Friends

Bulk Synchronization 3rd Party Platform Friends is a process to connect player’s friends from third party platforms to the AccelByte IAM service. The recommended implementation for this feature is:

  • The process should work in the background.
  • The process can be triggered automatically every time the game starts or manually by the interaction between player and the game client.
  • The game UI only displays a list of friends using the AccelByte Friends service.

Players can connect their friends from several third party platforms which are Steam and Xbox. To see how Bulk Synchronization 3rd Party Platform works under each third party platform and how to implement the SDK, you can read from the description below.

# Steam

The diagram below gives a basic overview of how the Bulk Sync 3rd Party Platform for Steam works:

friends

  1. The game client requests the total number of the player’s friends at Steam by sending the GetFriendCount (opens new window) call to Steam.
  2. After receiving the total number of the player’s friends, the game client sends the GetFriendByIndex (opens new window) call to Steam to get the list of player’s friends Steam ID.
  3. The game client sends the BulkGetUserByPlatformUserId call to the AccelByte IAM service to get the list of Steam’s friends user ID from the AccelByte IAM service.
  4. Steam’s friends user ID from the AccelByte IAM service will be added to the friend list. To do so, the game client sends the BulkFriendRequest call to the AccelByte Friends service. Friends will be automatically added without confirmation needed.

# Xbox

The diagram below gives a basic overview of how the Bulk Sync 3rd Party Platform for Xbox works:

friends

  1. The game client sends the GetSocialRelationshipsAsync() (opens new window) call to Xbox and gets the list of people that the player is having a relationship with on the Xbox.
  2. Once the list of people that the player is having a relationship with on the Xbox is received, the game client sends the BulkGetUserByPlatformUserId call to the AccelByte IAM service to get the list of Xbox’s friends user ID from the AccelByte IAM service.
  3. Xbox’s friends user ID from the AccelByte IAM service will be added to the friend list. To do so, the game client sends the BulkFriendRequest call to the AccelByte Friends service. Friends will be automatically added without confirmation needed.

# Permissions

Permissions are used to grant access to specific resources within our services. Make sure your account has the following permissions before you attempt to manage friends in the Admin Portal.

Usage Resource Action
Add Friends Without Confirmation NAMESPACE:{namespace}:USER:{userId}:FRIENDS Create
Get List of Friends NAMESPACE:{namespace}:USER:{userId}:FRIENDS Read
Get Blocked Players by User ID ADMIN:NAMESPACE:{namespace}:USER:{userId}:PLAYER:BLOCK Read
Get Players Who Blocked This Player by User ID ADMIN:NAMESPACE:{namespace}:USER:{userId}:PLAYER:BLOCK Read
Configure a New 3rd Party Integration ADMIN:NAMESPACE:{namespace}:THIRDPARTY:CONFIG Create

Permissions work slightly differently depending on whether they are assigned to IAM Clients or Roles assigned to users. For more information, read the Authentication and Authorization documentation.

# Implementing Friend using SDK

# Search for a Player

You can search for a player’s account information using their Email Address or Display Name as the query. Please refer to the Search User endpoint.

# Friend Interactions

# Send a Friend Request

The first step in making a friend is to send a friend request to another player.

# Accepting and Rejecting Friend Requests

After a friend request has been sent, the player who received the request can either accept or reject it.

# Cancel and Reject Friend Notification

This notification is raised when a player cancels and rejects friend invitation.

# Retrieve the Friend List

Players can see a list of all of their friends.

# Retrieve the List of Incoming Friend Requests

Players can see who has sent them friend requests.

# Retrieve the List of Outgoing Friend Requests

Players can see a list of friend requests they have sent that are still pending.

# Unfriend

Players can remove another player from their friend list.

# Unfriend Notification

This notification is raised when a player unfriends a player.

# Bulk Synchronization 3rd Party Platform Friends

To add your players’ Steam or Xbox friends to your AccelByte friend list, you need to call user.BulkGetUserByOtherPlatformUserIds() and lobby.BulkRequestFriend() consecutively. To specify the platform, please replace the PlatformType with the platform name (Steam or Xbox).

# Managing Friend using API

# Get Blocked Players by User ID

Follow the steps below to use a player’s User ID to retrieve a list of blocked players they have blocked

  1. Use the Admin Get Blocked Players by User ID: GET - /lobby/v1/admin/player/namespaces/{namespace}/users/{userId}/blocked endpoint.
  2. Input the desired Namespace. This is usually the Game Namespace.
  3. Input the User ID of the player whose blocked players you want to retrieve.

Upon successful request, the list of blocked players will be displayed. Here is the response example of the successful request:

# Get Players Who Blocked This Player by User ID

Follow the steps below to use a player’s User ID to retrieve a list of players that have blocked them.

  1. Use the Admin Get Blocked Players by User ID: GET - /lobby/v1/admin/player/namespaces/{namespace}/users/{userId}/blocked-by endpoint.
  2. Input the desired Namespace. This is usually the Game Namespace.
  3. Input the User ID of the blocked player.

Upon successful request, the list of User IDs that have blocked the player will be displayed. Here is the response example of the successful request:

# Configure Friends Integration

You can integrate our Friends service with the Friends services found on 3rd party platforms such as Steam so that your players can find their friends from the platform in your game automatically.

# Configure a New 3rd Party Integration

Follow the steps below to create a new Steam configuration:

  1. Use the Create Third-Party Steam Config: POST - /lobby​/v1​/admin​/thirdparty​/namespaces​/{namespace}​/config​/steam endpoint.
  2. Input the desired Namespace. This is usually the Game Namespace.
  3. Fill out the Request Body.
  • Input the API Key field with the Steam API Key.

Upon successful request, a new configuration will be created. Here is the response example of the successful request: