Skip to main content

Events

There are different types of events that can be sent to your server. The Webhook events are dispatched to your server as a POST request with a JSON payload.

Game started

It is triggered when a game within a game session is started. Per game session, this event can be triggered multiple times.

{
"eventType": "game.started",
"payload": {
"createdAt": "2023-11-03T10:34:28.191Z",
"gamesPlayed": 0,
"players": [
{
"externalId": "PEP_001",
"name": "Pepito",
"score": 0
},
{
"externalId": "JD_001",
"name": "John Doe",
"score": 0
}
],
"status": "playing",
"uid": "8qgmUmqJj",
"updatedAt": "2023-11-03T10:34:35.508Z"
}
}

Game finished

It is triggered when a game within a game session is finished. Per game session, this event can be triggered multiple times.

{
"eventType": "game.finished",
"payload": {
"createdAt": "2023-11-03T10:34:28.191Z",
"gamesPlayed": 1,
"players": [
{
"externalId": "PEP_001",
"name": "Pepito",
"score": 1
},
{
"externalId": "JD_001",
"name": "John Doe",
"score": 0
}
],
"status": "playing",
"uid": "8qgmUmqJj",
"updatedAt": "2023-11-03T10:34:57.484Z"
}
}

Sync with users on your system

To keep in sync users from your system and Webhooks, you need to pass the parameter externalUserId on the iframe.

https://papergames.io/en/r/8qgmUmqJj/embed/play?username=John Doe&externalUserId=JD_001

When receiving a Webhook event, the external ID reference is passed on the JSON payload under the path webhookPayload.payload.players[].externalId