Skip to content
EchoSpaceStudios
All tutorials
PlayFabBeginner2 - 5 min

PlayFab Player Banned Discord Logger

Learn how to connect playfab to discord using cloudscripts and webhooks.

Published

Step 1: Copy and paste the revision code into playfab revisions (ensure you replace the webhook with your discord webhook url).

Step 2: Save revision

Step 3: Make sure you select depoy after save then click save and deploy.

Step 4: Goto the rules tab.

Step 5: Click add new rule

Step 6: Set Rules name and Search in event type for "com.playfab.player_banned".

Step 7: Click add action button.

Step 8: Set type to Execute Cloud Script, and select the cloud script function as PlayerBanned, then save action.

Revision Script:

handlers.PlayerBanned = function(args) {
    var contentBody = {
    "content": "```"+ "A Player Has Been BANNED." + "\n" +
    "PlayerBanned: " + currentPlayerId + "```"
    };
    var url = "DISCORD WEBHOOK HERE";
    var method = "post";
    var contentType = "application/json";
    var headers = {};
    var responseString =  http.request(url,method,JSON.stringify(contentBody),contentType,headers);
}
Community

Got it working? Or stuck?

Either way, the Discord is the place to say so — questions here often turn into the next tutorial.

Back to all tutorials