Saving puzzle results via webhooks
Puzzel.org offers puzzle result tracking + registration within its own ecosystem but to automate/customize the tracking a bit further, you might want to handle the saving of results yourself. To allow this, you can easily add your own webhook URL to handle the puzzle results.
Every time Puzzel.org saves a puzzle result (after a correct answer for example), it checks whether a webhook URL is enabled and if so, it will POST the data to that URL.
You can enable the webhook settings via Premium > Developer > Save puzzle results via webhook and then fill in the webhook link in the Webhook link field.
The payload will have the following json format:
{
puzzleKey: string,
results: object,
account: object,
type: "stats" | "player_info"
}
The results and payload will differ depending on the puzzle type and registration settings, so it will be helpful to check out the details of the payload when setting up and testing your webhook endpoint.
The 'type' key lets you determine what kind of result you are receiving. The "stats" value means it is a saved puzzle result while the "player_info" value is received once a player fills in their info in the completion message.
Note: The results that are sent via the webhook are protected against tampering, since the player does not actually post their result to the real webhook that you've added in your settings. It pings an intermediate Puzzel.org endpoint that queries the latest puzzle results for the given puzzle player and then posts it to your webhook.