question

Darius Vu avatar image
Darius Vu asked

How to accept the group invitation automatically?

Dear team,

I am using PlayFabGroupsAPI.InviteToGroup() to invite players to join the group. The process is as below:

1. An admin of group invites players to join a group using PlayFabGroupsAPI.InviteToGroup().

https://docs.microsoft.com/en-us/rest/api/playfab/groups/groups/invitetogroup?view=playfab-rest

2. The group invitation is accepted automatically from players who are invited without any action like "click accept button"...

So could I do the second step? "The group invitation is accepted automatically from players who are invited"?

Thank you so much.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Rick Chen avatar image
Rick Chen answered

There is a group API AddMembers that can directly add a player to the group without any action from that player. However, this API called from client may produce NotAuthorized error. Nonetheless you can write a CloudScript to call this API without getting NotAuthorized error, for example:

handlers.AddPlayerToGroup = function(args, context){
                
entity.AddMembers({
Group: {
Id: args.groupId
},
Members: [
args.entityKey
]
});
}
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Darius Vu avatar image Darius Vu commented ·

Thank you so much for your support. It is working for me.

1 Like 1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.