Integrate groups into your game
Overview
AccelByte Gaming Services (AGS) Group provides game developers a way to boost interaction between players that can increase overall player retention by allowing players to form a group, gather, interact, and collaborate to achieve common goals. In this guide, you will learn how to integrate groups into your game using the AGS Group service with the Client SDK.
Goals
By following this guide, you will:
- Learn how to integrate groups into your game with Client SDKs.
- Gain an understanding of how to allow players to manage groups.
- Gain an understanding of how to retrieve group information.
- Gain an understanding of how to allow players to interact with groups.
- Gain an understanding of how to send group-related notifications to the player.
Prerequisites
You will need access to:
- The AGS Admin Portal.
- The AccelByte Unreal or Unity SDK, including the required permissions:
- Client ID
- Client Secret
- The AGS Group API documentation for reference.
Manage groups
The following sections detail how to integrate group management into your game.
Create a new group
You can allow your players to create a new group once you have a group configuration in your namespace. The player who created the group will be group admin by default. Use the following function to create a new group:
- Unreal Engine V1
- Unity V1
- Unreal Engine V2
- Unity V2
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FAccelByteModelsCreateGroupRequest RequestContent = {};
RequestContent.ConfigurationCode = "YourGroupConfigurationCode";
RequestContent.GroupName = "YourGroupName";
RequestContent.GroupDescription = "YourGroupDescription";
RequestContent.GroupMaxMember = 50;
RequestContent.GroupType = EAccelByteGroupType::PUBLIC;
ApiClient->Group.CreateGroup(RequestContent, THandler<FAccelByteModelsGroupInformation>::CreateLambda([](const FAccelByteModelsGroupInformation& Result)
{
// Do something if CreateGroup has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if CreateGroup has an error
UE_LOG(LogTemp, Log, TEXT("Error CreateGroup, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
CreateGroupRequest createGroupRequest = new CreateGroupRequest
{
configurationCode = "YourGroupConfigurationCode",
groupName = "YourGroupName",
groupDescription = "YourGroupDescription",
groupMaxMember = 50,
groupType = GroupType.PUBLIC
};
AccelBytePlugin.GetGroup().CreateGroup(createGroupRequest, result =>
{
if (result.IsError)
{
// Do something if CreateGroup has an error
Debug.Log($"Error CreateGroup, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if CreateGroup has been successful
}
});
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FAccelByteModelsCreateGroupRequest RequestContent = {};
RequestContent.ConfigurationCode = "YourGroupConfigurationCode";
RequestContent.GroupName = "YourGroupName";
RequestContent.GroupDescription = "YourGroupDescription";
RequestContent.GroupMaxMember = 50;
RequestContent.GroupType = EAccelByteGroupType::PUBLIC;
ApiClient->Group.CreateV2Group(RequestContent, THandler<FAccelByteModelsGroupInformation>::CreateLambda([](const FAccelByteModelsGroupInformation& Result)
{
// Do something if CreateV2Group has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if CreateV2Group has an error
UE_LOG(LogTemp, Log, TEXT("Error CreateV2Group, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
CreateGroupRequest createGroupRequest = new CreateGroupRequest
{
configurationCode = "YourGroupConfigurationCode",
groupName = "YourGroupName",
groupDescription = "YourGroupDescription",
groupMaxMember = 50,
groupType = GroupType.PUBLIC
};
AccelBytePlugin.GetGroup().CreateGroupV2(createGroupRequest, result =>
{
if (result.IsError)
{
// Do something if CreateGroupV2 has an error
Debug.Log($"Error CreateGroupV2, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if CreateGroupV2 has been successful
}
});
Update group information
Information that is tied to a specific group, such as a group name, icon, description, region, or type, can be updated. Only members with an admin role can update the group’s information. Use this function to update group information:
- Unreal Engine V1
- Unity V1
- Unreal Engine V2
- Unity V2
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString GroupId = "YourGroupId";
bool bCompletelyReplace = true;
FAccelByteModelsGroupUpdatable UpdateContent = {};
UpdateContent.GroupName = "UpdatedGroupName";
UpdateContent.GroupDescription = "UpdatedGroupDescription";
UpdateContent.GroupType = EAccelByteGroupType::PRIVATE;
ApiClient->Group.UpdateGroup(GroupId, bCompletelyReplace, UpdateContent, THandler<FAccelByteModelsGroupInformation>::CreateLambda([](const FAccelByteModelsGroupInformation& Result)
{
// Do something if UpdateGroup has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if UpdateGroup has an error
UE_LOG(LogTemp, Log, TEXT("Error UpdateGroup, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string groupId = "YourGroupId";
UpdateGroupRequest updateGroupRequest = new UpdateGroupRequest
{
groupName = "UpdatedGroupName",
groupDescription = "UpdatedGroupDescription",
groupType = GroupType.PRIVATE
};
AccelBytePlugin.GetGroup().UpdateGroup(groupId, updateGroupRequest, result =>
{
if (result.IsError)
{
// Do something if UpdateGroup has an error
Debug.Log($"Error UpdateGroup, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if UpdateGroup has been successful
}
});
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FAccelByteModelsUpdateGroupRequest UpdateContent = {};
UpdateContent.GroupName = "UpdatedGroupName";
UpdateContent.GroupDescription = "UpdatedGroupDescription";
UpdateContent.GroupType = EAccelByteGroupType::PRIVATE;
ApiClient->Group.UpdateV2Group(GroupId, UpdateContent, THandler<FAccelByteModelsGroupInformation>::CreateLambda([](const FAccelByteModelsGroupInformation& Result)
{
// Do something if UpdateV2Group has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if UpdateV2Group has an error
UE_LOG(LogTemp, Log, TEXT("Error UpdateV2Group, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string groupId = "YourGroupId";
UpdateGroupRequest updateGroupRequest = new UpdateGroupRequest
{
groupName = "UpdatedGroupName",
groupDescription = "UpdatedGroupDescription",
groupType = GroupType.PRIVATE
};
AccelBytePlugin.GetGroup().UpdateGroupV2(groupId, updateGroupRequest, result =>
{
if (result.IsError)
{
// Do something if UpdateGroupV2 has an error
Debug.Log($"Error UpdateGroupV2, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if UpdateGroupV2 has been successful
}
});
Update a group’s custom attributes
You can update a group’s custom attributes separately using this function. Just like updating group information, only members with an admin role can update the group’s custom attributes.
- Unreal Engine V1
- Unity V1
- Unreal Engine V2
- Unity V2
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString GroupId = "YourGroupId";
FJsonObjectWrapper UpdatedCustomAttributes;
UpdatedCustomAttributes.JsonObject = MakeShared<FJsonObject>();
UpdatedCustomAttributes.JsonObject->SetStringField("Attribute String Key", "Updated Attribute");
FAccelByteModelsUpdateGroupCustomAttributesRequest UpdateContent = {};
UpdateContent.CustomAttributes = UpdatedCustomAttributes;
ApiClient->Group.UpdateGroupCustomAttributes(GroupId, UpdateContent, THandler<FAccelByteModelsGroupInformation>::CreateLambda([](const FAccelByteModelsGroupInformation& Result)
{
// Do something if UpdateGroupCustomAttributes has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if UpdateGroupCustomAttributes has an error
UE_LOG(LogTemp, Log, TEXT("Error UpdateGroupCustomAttributes, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string groupId = "YourGroupId";
Dictionary<string, object> updateGroupRequest = new Dictionary<string, object>
{
{"Attribute String Key", "Updated Attribute" }
};
AccelBytePlugin.GetGroup().UpdateGroupCustomAttributes(groupId, updateGroupRequest, result =>
{
if (result.IsError)
{
// Do something if UpdateGroupCustomAttributes has an error
Debug.Log($"Error UpdateGroupCustomAttributes, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if UpdateGroupCustomAttributes has been successful
}
});
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString GroupId = "YourGroupId";
FJsonObjectWrapper UpdatedCustomAttributes;
UpdatedCustomAttributes.JsonObject = MakeShared<FJsonObject>();
UpdatedCustomAttributes.JsonObject->SetStringField("Attribute String Key", "Updated Attribute");
FAccelByteModelsUpdateGroupCustomAttributesRequest UpdateContent = {};
UpdateContent.CustomAttributes = UpdatedCustomAttributes;
ApiClient->Group.UpdateV2GroupCustomAttributes(GroupId, UpdateContent, THandler<FAccelByteModelsGroupInformation>::CreateLambda([](const FAccelByteModelsGroupInformation& Result)
{
// Do something if UpdateV2GroupCustomAttributes has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if UpdateV2GroupCustomAttributes has an error
UE_LOG(LogTemp, Log, TEXT("Error UpdateV2GroupCustomAttributes, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string groupId = "YourGroupId";
Dictionary<string, object> updateGroupRequest = new Dictionary<string, object>
{
{"Attribute String Key", "Updated Attribute" }
};
AccelBytePlugin.GetGroup().UpdateGroupCustomAttributesV2(groupId, updateGroupRequest, result =>
{
if (result.IsError)
{
// Do something if UpdateGroupCustomAttributesV2 has an error
Debug.Log($"Error UpdateGroupCustomAttributesV2, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if UpdateGroupCustomAttributesV2 has been successful
}
});
Display group information
The following sections detail how to display different types of group information.
Retrieve a list of groups
You can allow your players to search the available groups created by the players by searching using a group name or region. The results will be appear in pages, and you can use offset and limit parameters to limit the list. Use the following function to retrieve a list of groups:
The function below only shows PUBLIC and OPEN groups. You can learn more about group types in the section on group interactions.
- Unreal Engine
- Unity
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FAccelByteModelsGetGroupListRequest FilterContent = {};
FilterContent.GroupName = "YourGroupName";
FilterContent.GroupRegion = "US";
ApiClient->Group.GetGroupList(FilterContent, THandler<FAccelByteModelsGetGroupListResponse>::CreateLambda([](const FAccelByteModelsGetGroupListResponse& Result)
{
// Do something if GetGroupList has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if GetGroupList has an error
UE_LOG(LogTemp, Log, TEXT("Error GetGroupList, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string groupName = "YourGroupName";
string groupRegion = "US";
int limit = 100;
int offset = 0;
AccelBytePlugin.GetGroup().SearchGroups(groupName, groupRegion, limit, offset, result =>
{
if (result.IsError)
{
// Do something if SearchGroups has an error
Debug.Log($"Error SearchGroups, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if SearchGroups has been successful
}
});
Retrieve group information by group ID
To give more clear information about the group to the players, you can use the following function to get information about a group by using the group ID:
- Unreal Engine
- Unity
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString GroupId = "YourGroupId";
ApiClient->Group.GetGroup(GroupId, THandler<FAccelByteModelsGroupInformation>::CreateLambda([](const FAccelByteModelsGroupInformation& Result)
{
// Do something if GetGroup has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if GetGroup has an error
UE_LOG(LogTemp, Log, TEXT("Error GetGroup, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string groupId = "YourGroupId";
AccelBytePlugin.GetGroup().GetGroup(groupId, result =>
{
if (result.IsError)
{
// Do something if GetGroup has an error
Debug.Log($"Error GetGroup, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if GetGroup has been successful
}
});
Retrieve group information by user ID
You can let your players get their group information by using their user Id with the following function:
If the player you requested doesn't belong to any group, the returned status will be ErrorCode.UserNotBelongToAnyGroup
, and the player will be able to be invited to a group.
- Unreal Engine
- Unity
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString UserId = "YourUserId";
ApiClient->Group.GetUserGroupInfoByUserId(UserId, THandler<FAccelByteModelsGetUserGroupInfoResponse>::CreateLambda([](const FAccelByteModelsGetUserGroupInfoResponse& Result)
{
// Do something if GetUserGroupInfoByUserId has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if GetUserGroupInfoByUserId has an error
UE_LOG(LogTemp, Log, TEXT("Error GetUserGroupInfoByUserId, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
AccelBytePlugin.GetGroup().GetMyGroupInfo(result =>
{
if (result.IsError)
{
// Do something if GetMyGroupInfo has an error
Debug.Log($"Error GetMyGroupInfo, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if GetMyGroupInfo has been successful
}
})
Retrieve a player’s group information
You can allow your player to retrieve the group information of the user with a specific user Id.
- Unreal Engine
- Unity
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString UserId = "YourUserId";
ApiClient->Group.GetUserGroupInfoByUserId(UserId, THandler<FAccelByteModelsGetUserGroupInfoResponse>::CreateLambda([](const FAccelByteModelsGetUserGroupInfoResponse& Result)
{
// Do something if GetUserGroupInfoByUserId has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if GetUserGroupInfoByUserId has an error
UE_LOG(LogTemp, Log, TEXT("Error GetUserGroupInfoByUserId, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string userId = "YourUserId";
AccelBytePlugin.GetGroup().GetOtherGroupInfo(userId, result =>
{
if (result.IsError)
{
// Do something if GetOtherGroupInfo has an error
Debug.Log($"Error GetOtherGroupInfo, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if GetOtherGroupInfo has been successful
}
});
Retrieve a group’s member list
You can let your players retrieve a list of members within a specific group. Use the following function to get a group’s member list by using a group Id.
- Unreal Engine
- Unity
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString GroupId = "YourGroupId";
FAccelByteModelsGetGroupMembersListByGroupIdRequest RequestContent = {};
RequestContent.Limit = 100;
RequestContent.Offset = 0;
RequestContent.SortBy = EAccelByteGroupListSortBy::ASCENDING;
ApiClient->Group.GetGroupMembersListByGroupId(GroupId, RequestContent, THandler<FAccelByteModelsGetGroupMemberListResponse>::CreateLambda([](const FAccelByteModelsGetGroupMemberListResponse& Result)
{
// Do something if GetGroupMembersListByGroupId has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if GetGroupMembersListByGroupId has an error
UE_LOG(LogTemp, Log, TEXT("Error GetGroupMembersListByGroupId, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string groupId = "YourGroupId";
AccelBytePlugin.GetGroup().GetGroupMemberList(groupId, result =>
{
if (result.IsError)
{
// Do something if GetGroupMemberList has an error
Debug.Log($"Error GetGroupMemberList, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if GetGroupMemberList has been successful
}
});
Interact with groups
The follow sections details players' interactions with groups.
Join a group
Players can request to join OPEN or PUBLIC groups. Each group type will have a different behavior:
- OPEN groups will allow players to automatically join.
- PUBLIC groups will require players to make a join request which needs to be approved by a group admin before the player can join.
Use the following function to allow players join to a specific group.
- Unreal Engine V1
- Unity V1
- Unreal Engine V2
- Unity V2
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString GroupId = "YourGroupId";
ApiClient->Group.JoinGroup(GroupId, THandler<FAccelByteModelsJoinGroupResponse>::CreateLambda([](const FAccelByteModelsJoinGroupResponse& Result)
{
// Do something if JoinGroup has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if JoinGroup has an error
UE_LOG(LogTemp, Log, TEXT("Error JoinGroup, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string groupId = "YourGroupId";
AccelBytePlugin.GetGroup().JoinGroup(groupId, result =>
{
if (result.IsError)
{
// Do something if JoinGroup has an error
Debug.Log($"Error JoinGroup, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if JoinGroup has been successful
}
});
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString GroupId = "YourGroupId";
ApiClient->Group.JoinV2Group(GroupId, THandler<FAccelByteModelsJoinGroupResponse>::CreateLambda([](const FAccelByteModelsJoinGroupResponse& Result)
{
// Do something if JoinV2Group has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if JoinV2Group has an error
UE_LOG(LogTemp, Log, TEXT("Error JoinV2Group, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string groupId = "YourGroupId";
AccelBytePlugin.GetGroup().JoinGroupV2(groupId, result =>
{
if (result.IsError)
{
// Do something if JoinGroupV2 has an error
Debug.Log($"Error JoinGroupV2, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if JoinGroupV2 has been successful
}
});
Cancel a join request
After a player requests to join a PUBLIC group, that request can be canceled.
- Unreal Engine
- Unity
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString GroupId = "YourGroupId";
ApiClient->Group.CancelJoinGroupRequest(GroupId, THandler<FAccelByteModelsMemberRequestGroupResponse>::CreateLambda([](const FAccelByteModelsMemberRequestGroupResponse& Result)
{
// Do something if CancelJoinGroupRequest has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if CancelJoinGroupRequest has an error
UE_LOG(LogTemp, Log, TEXT("Error CancelJoinGroupRequest, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string groupId = "YourGroupId";
AccelBytePlugin.GetGroup().CancelJoinGroupRequest(groupId, result =>
{
if (result.IsError)
{
// Do something if JoinGroupV2 has an error
Debug.Log($"Error JoinGroupV2, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if JoinGroupV2 has been successful
}
});
Leave a group
To allow players to leave a group, you can use the following function:
- Unreal Engine V1
- Unity V1
- Unreal Engine V2
- Unity V2
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
ApiClient->Group.LeaveGroup(THandler<FAccelByteModelsMemberRequestGroupResponse>::CreateLambda([](const FAccelByteModelsMemberRequestGroupResponse& Result)
{
// Do something if LeaveGroup has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if LeaveGroup has an error
UE_LOG(LogTemp, Log, TEXT("Error LeaveGroup, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
AccelBytePlugin.GetGroup().LeaveGroup( result =>
{
if (result.IsError)
{
// Do something if LeaveGroup has an error
Debug.Log($"Error LeaveGroup, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if LeaveGroup has been successful
}
});
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString GroupId = "YourGroupId";
ApiClient->Group.LeaveV2Group(GroupId, THandler<FAccelByteModelsMemberRequestGroupResponse>::CreateLambda([](const FAccelByteModelsMemberRequestGroupResponse& Result)
{
// Do something if LeaveV2Group has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if LeaveV2Group has an error
UE_LOG(LogTemp, Log, TEXT("Error LeaveV2Group, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string groupId = "YourGroupId";
AccelBytePlugin.GetGroup().LeaveGroupV2(groupId, result =>
{
if (result.IsError)
{
// Do something if LeaveGroupV2 has an error
Debug.Log($"Error LeaveGroupV2, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if LeaveGroupV2 has been successful
}
});
Invite a player to a group
Group admins can invite players to join their group. A PRIVATE group can use this function to add new members. Players need to accept the invitation before they can join the group.
- Unreal Engine V1
- Unity V1
- Unreal Engine V2
- Unity V2
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString UserId = "YourUserId";
ApiClient->Group.InviteUserToGroup(UserId, THandler<FAccelByteModelsMemberRequestGroupResponse>::CreateLambda([](const FAccelByteModelsMemberRequestGroupResponse& Result)
{
// Do something if InviteUserToGroup has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if InviteUserToGroup has an error
UE_LOG(LogTemp, Log, TEXT("Error InviteUserToGroup, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string userId = "YourUserId";
AccelBytePlugin.GetGroup().InviteOtherUserToGroup(userId, result =>
{
if (result.IsError)
{
// Do something if InviteOtherUserToGroup has an error
Debug.Log($"Error InviteOtherUserToGroup, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if InviteOtherUserToGroup has been successful
}
});
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString UserId = "YourUserId";
FString GroupId = "YourGroupId";
ApiClient->Group.InviteUserToV2Group(UserId, GroupId, THandler<FAccelByteModelsMemberRequestGroupResponse>::CreateLambda([](const FAccelByteModelsMemberRequestGroupResponse& Result)
{
// Do something if InviteUserToV2Group has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if InviteUserToV2Group has an error
UE_LOG(LogTemp, Log, TEXT("Error InviteUserToV2Group, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string userId = "YourUserId";
string groupId = "YourGroupId";
AccelBytePlugin.GetGroup().InviteOtherUserToGroupV2(userId, groupId, result =>
{
if (result.IsError)
{
// Do something if InviteOtherUserToGroupV2 has an error
Debug.Log($"Error InviteOtherUserToGroupV2, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if InviteOtherUserToGroupV2 has been successful
}
});
Remove/kick a group member
Group admins can also remove (kick) group members from the group.
- Unreal Engine V1
- Unity V1
- Unreal Engine V2
- Unity V2
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString UserId = "YourUserId";
ApiClient->Group.KickGroupMember(UserId, THandler<FAccelByteModelsKickGroupMemberResponse>::CreateLambda([](const FAccelByteModelsKickGroupMemberResponse& Result)
{
// Do something if KickGroupMember has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if KickGroupMember has an error
UE_LOG(LogTemp, Log, TEXT("Error KickGroupMember, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string userId = "YourUserId";
AccelBytePlugin.GetGroup().KickGroupMember(userId, result =>
{
if (result.IsError)
{
// Do something if KickGroupMember has an error
Debug.Log($"Error KickGroupMember, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if KickGroupMember has been successful
}
});
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString UserId = "YourUserId";
FString GroupId = "YourGroupId";
ApiClient->Group.KickV2GroupMember(UserId, GroupId, THandler<FAccelByteModelsKickGroupMemberResponse>::CreateLambda([](const FAccelByteModelsKickGroupMemberResponse& Result)
{
// Do something if KickV2GroupMember has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if KickV2GroupMember has an error
UE_LOG(LogTemp, Log, TEXT("Error KickV2GroupMember, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string userId = "YourUserId";
string groupId = "YourGroupId";
AccelBytePlugin.GetGroup().KickGroupMemberV2(userId, groupId, result =>
{
if (result.IsError)
{
// Do something if KickGroupMemberV2 has an error
Debug.Log($"Error KickGroupMemberV2, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if KickGroupMemberV2 has been successful
}
});
Get a list of group invitation requests
Players can get the list of group invitation requests to either accept or reject these invitations.
- Unreal Engine
- Unity
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FAccelByteModelsLimitOffsetRequest RequestContent = {};
RequestContent.Limit = 100;
RequestContent.Offset = 0;
ApiClient->Group.GetGroupInvitationRequests(RequestContent, THandler<FAccelByteModelsGetMemberRequestsListResponse>::CreateLambda([](const FAccelByteModelsGetMemberRequestsListResponse& Result)
{
// Do something if GetGroupInvitationRequests has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if GetGroupInvitationRequests has an error
UE_LOG(LogTemp, Log, TEXT("Error GetGroupInvitationRequests, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
int limit = 100;
int offset = 0;
AccelBytePlugin.GetGroup().GetGroupInvitationRequests(limit, offset, result =>
{
if (result.IsError)
{
// Do something if GetGroupInvitationRequests has an error
Debug.Log($"Error GetGroupInvitationRequests, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if GetGroupInvitationRequests has been successful
}
});
Accept a group invitation request
After getting the invitation list, players can accept an invitation.
- Unreal Engine V1
- Unity V1
- Unreal Engine V2
- Unity V2
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString GroupId = "YourGroupId";
ApiClient->Group.AcceptGroupInvitation(GroupId, THandler<FAccelByteModelsMemberRequestGroupResponse>::CreateLambda([](const FAccelByteModelsMemberRequestGroupResponse& Result)
{
// Do something if AcceptGroupInvitation has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if AcceptGroupInvitation has an error
UE_LOG(LogTemp, Log, TEXT("Error AcceptGroupInvitation, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string groupId = "YourGroupId";
AccelBytePlugin.GetGroup().AcceptGroupInvitation(groupId, result =>
{
if (result.IsError)
{
// Do something if AcceptGroupInvitation has an error
Debug.Log($"Error AcceptGroupInvitation, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if AcceptGroupInvitation has been successful
}
});
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString GroupId = "YourGroupId";
ApiClient->Group.AcceptGroupInvitation(GroupId, THandler<FAccelByteModelsMemberRequestGroupResponse>::CreateLambda([](const FAccelByteModelsMemberRequestGroupResponse& Result)
{
// Do something if AcceptGroupInvitation has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if AcceptGroupInvitation has an error
UE_LOG(LogTemp, Log, TEXT("Error AcceptGroupInvitation, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string groupId = "YourGroupId";
AccelBytePlugin.GetGroup().AcceptGroupInvitationV2(groupId, result =>
{
if (result.IsError)
{
// Do something if AcceptGroupInvitationV2 has an error
Debug.Log($"Error AcceptGroupInvitationV2, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if AcceptGroupInvitationV2 has been successful
}
});
Reject a group invitation request
Players can reject any invitation request.
- Unreal Engine V1
- Unity V1
- Unreal Engine V2
- Unity V2
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString GroupId = "YourGroupId";
ApiClient->Group.RejectGroupInvitation(GroupId, THandler<FAccelByteModelsMemberRequestGroupResponse>::CreateLambda([](const FAccelByteModelsMemberRequestGroupResponse& Result)
{
// Do something if RejectGroupInvitation has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if RejectGroupInvitation has an error
UE_LOG(LogTemp, Log, TEXT("Error RejectGroupInvitation, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string groupId = "YourGroupId";
AccelBytePlugin.GetGroup().RejectGroupInvitation(groupId, result =>
{
if (result.IsError)
{
// Do something if RejectGroupInvitation has an error
Debug.Log($"Error RejectGroupInvitation, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if RejectGroupInvitation has been successful
}
});
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString GroupId = "YourGroupId";
ApiClient->Group.RejectV2GroupInvitation(GroupId, THandler<FAccelByteModelsMemberRequestGroupResponse>::CreateLambda([](const FAccelByteModelsMemberRequestGroupResponse& Result)
{
// Do something if RejectV2GroupInvitation has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if RejectV2GroupInvitation has an error
UE_LOG(LogTemp, Log, TEXT("Error RejectV2GroupInvitation, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string groupId = "YourGroupId";
AccelBytePlugin.GetGroup().RejectGroupInvitationV2(groupId, result =>
{
if (result.IsError)
{
// Do something if RejectGroupInvitationV2 has an error
Debug.Log($"Error RejectGroupInvitationV2, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if RejectGroupInvitationV2 has been successful
}
});
Get a list of group member join requests
Group admins can get a list of group member join requests to either approve or reject them.
- Unreal Engine V1
- Unity V1
- Unreal Engine V2
- Unity V2
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString GroupId = "YourGroupId";
FAccelByteModelsLimitOffsetRequest RequestContent = {};
RequestContent.Limit = 100;
RequestContent.Offset = 0;
ApiClient->Group.GetGroupJoinRequests(GroupId, RequestContent, THandler<FAccelByteModelsGetMemberRequestsListResponse>::CreateLambda([](const FAccelByteModelsGetMemberRequestsListResponse& Result)
{
// Do something if GetGroupJoinRequests has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if GetGroupJoinRequests has an error
UE_LOG(LogTemp, Log, TEXT("Error GetGroupJoinRequests, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string groupId = "YourGroupId";
int limit = 100;
int offset = 0;
AccelBytePlugin.GetGroup().GetGroupJoinRequests(groupId, limit, offset, result =>
{
if (result.IsError)
{
// Do something if GetGroupJoinRequests has an error
Debug.Log($"Error GetGroupJoinRequests, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if GetGroupJoinRequests has been successful
}
});
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString GroupId = "YourGroupId";
FAccelByteModelsLimitOffsetRequest RequestContent = {};
RequestContent.Limit = 100;
RequestContent.Offset = 0;
ApiClient->Group.GetGroupJoinRequestList(GroupId, RequestContent, THandler<FAccelByteModelsGetMemberRequestsListResponse>::CreateLambda([](const FAccelByteModelsGetMemberRequestsListResponse& Result)
{
// Do something if GetGroupJoinRequestList has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if GetGroupJoinRequestList has an error
UE_LOG(LogTemp, Log, TEXT("Error GetGroupJoinRequestList, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string groupId = "YourGroupId";
int limit = 100;
int offset = 0;
AccelBytePlugin.GetGroup().GetGroupJoinRequestsV2(groupId, limit, offset, result =>
{
if (result.IsError)
{
// Do something if GetGroupJoinRequestsV2 has an error
Debug.Log($"Error GetGroupJoinRequestsV2, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if GetGroupJoinRequestsV2 has been successful
}
});
Accept a group member join request
After getting the list of join requests, a group admin can accept them to the group.
- Unreal Engine V1
- Unity V1
- Unreal Engine V2
- Unity V2
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString UserId = "YourUserId";
ApiClient->Group.AcceptGroupJoinRequest(UserId, THandler<FAccelByteModelsMemberRequestGroupResponse>::CreateLambda([](const FAccelByteModelsMemberRequestGroupResponse& Result)
{
// Do something if AcceptGroupJoinRequest has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if AcceptGroupJoinRequest has an error
UE_LOG(LogTemp, Log, TEXT("Error AcceptGroupJoinRequest, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string userId = "YourUserId";
AccelBytePlugin.GetGroup().AcceptOtherJoinRequest(userId, result =>
{
if (result.IsError)
{
// Do something if AcceptOtherJoinRequest has an error
Debug.Log($"Error AcceptOtherJoinRequest, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if AcceptOtherJoinRequest has been successful
}
});
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString UserId = "YourUserId";
FString GroupId = "YourGroupId";
ApiClient->Group.AcceptV2GroupJoinRequest(UserId, GroupId, THandler<FAccelByteModelsMemberRequestGroupResponse>::CreateLambda([](const FAccelByteModelsMemberRequestGroupResponse& Result)
{
// Do something if AcceptV2GroupJoinRequest has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if AcceptV2GroupJoinRequest has an error
UE_LOG(LogTemp, Log, TEXT("Error AcceptV2GroupJoinRequest, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string userId = "YourUserId";
string groupId = "YourGroupId";
AccelBytePlugin.GetGroup().AcceptOtherJoinRequestV2(userId, groupId, result =>
{
if (result.IsError)
{
// Do something if AcceptOtherJoinRequestV2 has an error
Debug.Log($"Error AcceptOtherJoinRequestV2, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if AcceptOtherJoinRequestV2 has been successful
}
});
Reject a group member join request
Group admins can reject any member join request.
- Unreal Engine V1
- Unity V1
- Unreal Engine V2
- Unity V2
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString UserId = "YourUserId";
ApiClient->Group.RejectGroupJoinRequest(UserId, THandler<FAccelByteModelsMemberRequestGroupResponse>::CreateLambda([](const FAccelByteModelsMemberRequestGroupResponse& Result)
{
// Do something if RejectGroupJoinRequest has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if RejectGroupJoinRequest has an error
UE_LOG(LogTemp, Log, TEXT("Error RejectGroupJoinRequest, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string userId = "YourUserId";
AccelBytePlugin.GetGroup().RejectOtherJoinRequest(userId, result =>
{
if (result.IsError)
{
// Do something if RejectOtherJoinRequest has an error
Debug.Log($"Error RejectOtherJoinRequest, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if RejectOtherJoinRequest has been successful
}
});
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString UserId = "YourUserId";
FString GroupId = "YourGroupId";
ApiClient->Group.RejectV2GroupJoinRequest(UserId, GroupId, THandler<FAccelByteModelsMemberRequestGroupResponse>::CreateLambda([](const FAccelByteModelsMemberRequestGroupResponse& Result)
{
// Do something if RejectV2GroupJoinRequest has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if RejectV2GroupJoinRequest has an error
UE_LOG(LogTemp, Log, TEXT("Error RejectV2GroupJoinRequest, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string userId = "YourUserId";
string groupId = "YourGroupId";
AccelBytePlugin.GetGroup().RejectOtherJoinRequestV2(userId, groupId, result =>
{
if (result.IsError)
{
// Do something if RejectOtherJoinRequestV2 has an error
Debug.Log($"Error RejectOtherJoinRequestV2, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if RejectOtherJoinRequestV2 has been successful
}
});
Manage group roles
Every group member has roles assigned to them which can be used to restrict or allow access to features such as inviting a member or kicking a member, among others. Every group member will be automatically assigned to the default member role that is already defined in the group configuration. This can either be an admin group role or a member group role.
Get a list of group member roles
An admin can get a list of the member roles that have already been created in the AGS Admin Portal.
- Unreal Engine V1
- Unity V1
- Unreal Engine V2
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FAccelByteModelsLimitOffsetRequest RequestContent = {};
RequestContent.Limit = 100;
RequestContent.Offset = 0;
ApiClient->Group.GetMemberRoles(RequestContent, THandler<FAccelByteModelsGetMemberRolesListResponse>::CreateLambda([](const FAccelByteModelsGetMemberRolesListResponse& Result)
{
// Do something if GetMemberRoles has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if GetMemberRoles has an error
UE_LOG(LogTemp, Log, TEXT("Error GetMemberRoles, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
int limit = 100;
int offset = 0;
AccelBytePlugin.GetGroup().GetMemberRoles(limit, offset, result =>
{
if (result.IsError)
{
// Do something if GetMemberRoles has an error
Debug.Log($"Error GetMemberRoles, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if GetMemberRoles has been successful
}
});
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FAccelByteModelsLimitOffsetRequest RequestContent = {};
RequestContent.Limit = 100;
RequestContent.Offset = 0;
ApiClient->Group.GetAllMemberRoles(RequestContent, THandler<FAccelByteModelsGetMemberRolesListResponse>::CreateLambda([](const FAccelByteModelsGetMemberRolesListResponse& Result)
{
// Do something if GetAllMemberRoles has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if GetAllMemberRoles has an error
UE_LOG(LogTemp, Log, TEXT("Error GetAllMemberRoles, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
Promote a member to a role
A group admin can promote a group member to a specific role if the role has been defined for that group.
- Unreal Engine V1
- Unity V1
- Unreal Engine V2
- Unity V2
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString MemberRoleId = "YourMemberRoleId";
FAccelByteModelsUserIdWrapper RequestContent = {};
RequestContent.UserId = "YourUserId";
ApiClient->Group.AssignMemberRole(MemberRoleId, RequestContent, THandler<FAccelByteModelsGetUserGroupInfoResponse>::CreateLambda([](const FAccelByteModelsGetUserGroupInfoResponse& Result)
{
// Do something if AssignMemberRole has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if AssignMemberRole has an error
UE_LOG(LogTemp, Log, TEXT("Error AssignMemberRole, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string memberRoleId = "YourMemberRoleId";
string userId = "YourUserId";
AccelBytePlugin.GetGroup().AssignRoleToMember(memberRoleId, userId, result =>
{
if (result.IsError)
{
// Do something if AssignRoleToMember has an error
Debug.Log($"Error AssignRoleToMember, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if AssignRoleToMember has been successful
}
});
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString MemberRoleId = "YourMemberRoleId";
FString GroupId = "YourGroupId";
FAccelByteModelsUserIdWrapper RequestContent = {};
RequestContent.UserId = "YourUserId";
ApiClient->Group.AssignV2MemberRole(MemberRoleId, GroupId, RequestContent, THandler<FAccelByteModelsGetUserGroupInfoResponse>::CreateLambda([](const FAccelByteModelsGetUserGroupInfoResponse& Result)
{
// Do something if AssignV2MemberRole has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if AssignV2MemberRole has an error
UE_LOG(LogTemp, Log, TEXT("Error AssignV2MemberRole, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string memberRoleId = "YourMemberRoleId";
string userId = "YourUserId";
string groupId = "YourGroupId";
AccelBytePlugin.GetGroup().AssignRoleToMemberV2(memberRoleId, userId, groupId, result =>
{
if (result.IsError)
{
// Do something if AssignRoleToMemberV2 has an error
Debug.Log($"Error AssignRoleToMemberV2, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if AssignRoleToMemberV2 has been successful
}
});
Remove a member’s role
An admin can remove a role from a member.
- Unreal Engine V1
- Unity V1
- Unreal Engine V2
- Unity V2
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString MemberRoleId = "YourMemberRoleId";
FAccelByteModelsUserIdWrapper RequestContent = {};
RequestContent.UserId = "YourUserId";
ApiClient->Group.DeleteMemberRole(MemberRoleId, RequestContent, FVoidHandler::CreateLambda([]()
{
// Do something if DeleteMemberRole has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if DeleteMemberRole has an error
UE_LOG(LogTemp, Log, TEXT("Error DeleteMemberRole, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string memberRoleId = "YourMemberRoleId";
string userId = "YourUserId";
AccelBytePlugin.GetGroup().RemoveRoleFromMember(memberRoleId, userId, result =>
{
if (result.IsError)
{
// Do something if RemoveRoleFromMember has an error
Debug.Log($"Error RemoveRoleFromMember, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if RemoveRoleFromMember has been successful
}
});
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
FString MemberRoleId = "YourMemberRoleId";
FString GroupId = "YourGroupId";
FAccelByteModelsUserIdWrapper RequestContent = {};
RequestContent.UserId = "YourUserId";
ApiClient->Group.DeleteV2MemberRole(MemberRoleId, GroupId, RequestContent, FVoidHandler::CreateLambda([]()
{
// Do something if DeleteV2MemberRole has been successful
}), FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if DeleteV2MemberRole has an error
UE_LOG(LogTemp, Log, TEXT("Error DeleteV2MemberRole, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));
string memberRoleId = "YourMemberRoleId";
string userId = "YourUserId";
string groupId = "YourGroupId";
AccelBytePlugin.GetGroup().RemoveRoleFromMemberV2(memberRoleId, userId, groupId, result =>
{
if (result.IsError)
{
// Do something if RemoveRoleFromMemberV2 has an error
Debug.Log($"Error RemoveRoleFromMemberV2, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
else
{
// Do something if RemoveRoleFromMemberV2 has been successful
}
});
Manage group notifications
Some group activities will trigger notifications that will be sent to individual players, to group admins, or to all group members. The notification payload will be a JSON formatted string that contains data related to the triggered activity. To retrieve these notifications, you need to add a callback to the SetMessageNotifDelegate
and the OnNotification
functions.
- Unreal Engine
- Unity
FApiClientPtr ApiClient = FMultiRegistry::GetApiClient();
ApiClient->Lobby.Connect();
FString NotificationTopic = "group";
ApiClient->Lobby.SetMessageNotifDelegate(AccelByte::Api::Lobby::FMessageNotif::CreateLambda([&](FAccelByteModelsNotificationMessage const& Notif)
{
if (Notif.Topic == NotificationTopic)
{
// Do something if there's a new notification under group topic
}
}));
AccelBytePlugin.GetLobby().Connect();
string notificationTopic = "group";
AccelBytePlugin.GetLobby().OnNotification += result =>
{
if (result.Value.topic == notificationTopic)
{
// Do something if there's a new notification under group topic
}
};
Notify a player of a group invitation
Here’s an example of the payload for a notification sent to a player when they’ve been invited to join a group:
- Group Invitation Notification
{
"groupName": "nameOfGroup",
"groupId": "groupId",
"kind": "invitation"
}
Notify a player of an accepted join request
Here’s an example of the payload for a notification sent to a player when their request to join a group has been accepted:
- Group Acceptance Notification
{
"groupName": "nameOfGroup",
"groupId": "groupId",
"kind": "accepted-request"
}
Notify a player of a rejected join request
Here’s an example of the payload for a notification sent to a player when their request to join a group has been rejected:
- Group Rejection Notifications
{
"groupName": "nameOfGroup",
"groupId": "groupId",
"kind": "rejected-request"
}
New Group Member Notifications
Here’s an example of the payload for a notification sent to all group members when a new member has joined their group:
- New Group Member Notifications
{
"groupName": "nameOfGroup",
"groupId": "groupId",
"newGroupMember": "newGroupMember",
"kind": "new-member"
}
Notify a group admin of a request to join a group
Here’s an example of the payload for a notification sent to group admins when a player has requested to join their group:
- Member Request Notifications
{
"groupName": "nameOfGroup",
"groupId": "groupId",
"newGroupMember": "newGroupMember",
"kind": "join-request"
}
Notify a player of a new role assignment
Here’s an example of the payload for a notification sent to a player when a group admin has assigned a role to them:
- Member Role Assignment Notifications
{
"groupName": "nameofgroup",
"groupId": "groupId",
"roleName": "Chief",
"roleId": "roleId",
"kind": "assigned-role"
}
Notify a member of a role removal
Here’s an example of the payload for a notification sent to a player when a group admin has removed a role from them:
- Member Role Removal Notifications
{
"groupName": "nameofgroup",
"groupId": "groupId",
"roleName": "Chief",
"roleId": "roleId",
"kind": "removed-role"
}