Skip to content
EchoSpaceStudios
All tutorials
PlayFabBeginner2 - 5 mins

PlayFab Player Created 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 deploy after save then click save and deploy.

Step 4: Go to the rules tab.

Step 5: Click add new rule

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

Step 7: Click add action button.

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

REVISION CODE:

handlers.PlayerCreated = function(args) {
    var contentBody = {
    "content": "```" + "A New Player Has Arrived" + "\n" + 
    "PlayerID: " + 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