playgen.io

Documentation

Player events

Webhooks

Configuring Webhooks for Game Event Notifications

Webhooks allow you to receive real-time notifications of game events from playgen.io directly to your server. By configuring a webhook, you can automate responses to in-game events, such as tracking analytics, updating leaderboards, or triggering custom actions based on player behavior.

Configuring Webhooks

To set up a webhook for your playgen.io game events:

  1. Open Webhook Configuration:

    • Navigate to the game settings in your dashboard and locate the Webhook Configuration section.
  2. Enter Webhook URL:

    • Input the URL of your server endpoint where you want to receive the game events.
    • The URL must start with https://.
  3. API Key (Optional):

    • If your server requires authentication, you can enter an API key, which will be included as a bearer token in the Authorization header of each webhook request.
    • This helps secure your webhook endpoint by ensuring that only requests with the correct API key are accepted.
  4. Apply the Configuration:

    • Click Apply to save your webhook settings. Once configured, playgen.io will send a POST request to your webhook URL every time a specified game event occurs.

Sample Webhook Payload

Each webhook payload will contain the event type and relevant data. Below is an example of what a webhook payload might look like:

{
  "event": "PLAYGEN_GAME_COMPLETED",
  "data": {
    "gameId": "12345",
    "playerId": "67890",
    "timestamp": "2024-11-12T12:00:00Z",
    "score": 150
  }
}

On this page