question

Deekshith avatar image
Deekshith asked

Push Notifications to only Player's Friends

I am working on friend functionality so I need to send push notifications to player's friends when the player has completed certain events like completing achievement, upgrading enemies, killing animals,etc


How can this be done as we cannot send push notifications to specific user list which is the friend list in this case?

Push NotificationsFriends
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

·
Sarah Zhang avatar image
Sarah Zhang answered

Client/Server API GetFriendsListServer can retrieve the current friends for the user with PlayFabId. Server API SendPushNotification can send an iOS/Android Push Notification to a specific user. You can call these two API on CloudScript to achieve the feature you want.

3 comments
10 |1200

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

Deekshith avatar image Deekshith commented ·

Yes, but if there are 100+ friends then inside the cloudscript function SendPushNotification has to be called 100+ times.

But there are limitations as we cannot call SendPushNotification 100+ times in single function.

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang Deekshith commented ·

Currently, PlayFab does not natively support sending notifications to the friend list. Using these two APIs is just a workaround and is not a perfect best practice. If your needs exceed the limits of CloudScript, a custom server is a better choice to call the server API. You can also try adding a feature request for the API that sending notifications to a player list.

0 Likes 0 ·
Deekshith avatar image Deekshith Sarah Zhang commented ·

Okay thanks!

0 Likes 0 ·

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.