Batching events together
To reduce the amount of requests for event heavy games, it is possible to batch events and identifiers together, even when they have different timestamps.
Note! When evaluating what events can be batched together, concider the user experience that it might affect. Events that have an immediate affect on starting or finishing mission, should not be delayed / queued for batching, since that might cause a mission to not start / finish when the user expects it to.
Our recommendation is the bulk events that are not time sensitive (in-game events) together in a 30 second time period, or when the number of pending events reach 100.
[CLIENT_ID]
: Unique identifier for the client application, provided by Playfull[GAME_ID]
: Unique identifier for the game sending the event, provided by Playfull[GENERATED_SIGNATURE]
: A signature that verifies the integrity of the request (see Signature Generation)[USER_ID_*]
: The game's own internal user identifiers for each player in the match
POST /v2/custom-events
x-client-id: "[CLIENT_ID]",
x-timestamp: "1698306156387",
x-signature: "[GENERATED_SIGNATURE]",
Content-Type: "application/json"
{
"gameId": "[GAME_ID]",
"identifiers": [
{ "userId": "[USER_ID_1]", "discordId": "123456789","email": "john@doe.com", "twitterId": "987654321", "walletAddress": "0xb794f5ea0ba39494ce839613fffba74279579268"},
{ "userId": "[USER_ID_2]", "discordId": "9876543", "email": null }
],
"events": [
{"userId": "[USER_ID_1]", "event": "MATCH_START", "time": "2023-10-24T03:42:12.650Z"},
{"userId": "[USER_ID_2]", "event": "MATCH_START", "time": "2023-10-24T03:42:12.650Z"},
{"userId": "[USER_ID_3]", "event": "MATCH_START", "time": "2023-10-24T03:42:12.650Z"},
{"userId": "[USER_ID_1]", "event": "KILL_PLAYER", "traits": {"weapon": "KNIFE", "player": "[USER_ID_2]"}, "time": "2023-10-24T03:45:00.000Z"},
{"userId": "[USER_ID_2]", "event": "KILLED_BY_PLAYER", "traits": {"weapon": "KNIFE", "player": "[USER_ID_1]"}, "time": "2023-10-24T03:45:00.000Z"},
{"userId": "[USER_ID_1]", "event": "KILL_NPC", "traits": {"weapon": "BASEBALL_BAT", "type": "ZOMBIE"}, "time": "2023-10-24T03:45:00.000Z"},
{"userId": "[USER_ID_1]", "event": "KILL_PLAYER", "traits": {"weapon": "PISTOL_1", "player": "[USER_ID_3]"}, "time": "2023-10-24T03:49:00.000Z"},
{"userId": "[USER_ID_3]", "event": "KILLED_BY_PLAYER", "traits": {"weapon": "PISTOL_1", "player": "[USER_ID_1]"}, "time": "2023-10-24T03:49:00.000Z"},
{"userId": "[USER_ID_1]", "event": "MATCH_END", "traits": {"isSurvivor": true}, "time": "2023-10-24T03:49:00.000Z"},
{"userId": "[USER_ID_2]", "event": "MATCH_END", "traits": {"isSurvivor": false}, "time": "2023-10-24T03:49:00.000Z"},
{"userId": "[USER_ID_3]", "event": "MATCH_END", "traits": {"isSurvivor": false}, "time": "2023-10-24T03:49:00.000Z"},
],
}