Webhooks
Configuring Webhooks for Game Event Notifications
Webhooks allow you to receive real-time notifications of game events from Playgent 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 Playgent game events:
-
Open Webhook Configuration:
- Navigate to the game settings in your dashboard and locate the Webhook Configuration section.
-
Enter Webhook URL:
- Input the URL of your server endpoint where you want to receive the game events.
- The URL must start with
https://.
-
API Key (Optional):
- If your server requires authentication, you can enter an API key, which will be included as a bearer token in the
Authorizationheader of each webhook request. - This helps secure your webhook endpoint by ensuring that only requests with the correct API key are accepted.
- If your server requires authentication, you can enter an API key, which will be included as a bearer token in the
-
Apply the Configuration:
- Click Apply to save your webhook settings. Once configured, Playgent 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": "PG_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"
}