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_name": "PLAYGEN_GAME_COMPLETED",
    "publish_key": "PUBLISH_KEY",
    "user_id": "USER_ID",
    "game_name": "worday",
    "created_at": "2024-12-04T16:32:33.879Z",
    "timestamep": TIMESTAMP,
    "score": 2,
    "time": 11,
    "date": "20241215"
}

On this page