Webhook notification
When a user completes the Pleenk approve flow, a webhook (HTTP POST request) is sent to your configured endpoint. The body of this request contains an events
array, where each object represents a distinct event. Below is an example payload and a table describing the structure.
JSON Structure
Path | Type | Description |
---|---|---|
events | Array of Objects | An array containing all events in the webhook. Approve will always contains only one event. |
events[].eventType | String | The type of event: APPROVE . |
events[].data | Object | Holds detailed information about the event. |
events[].data["@type"] | String | The event category: APPROVE_EVENT . |
events[].data.userRef | String (UUID) | A unique reference for the user or session. Match this with your internal user reference. |
events[].data.request | String | The requested verification check, e.g., age_over_18 . |
events[].data.result | Object | Contains the verification outcome. |
events[].data.result.age_over_18 | Boolean | true if the user is verified as over 18, otherwise false . |
Example Payload
{
"events": [
{
"eventType": "APPROVE",
"data": {
"@type": "APPROVE_EVENT",
"userRef": "407eebe2-a380-44d8-9397-6663849afeb4-e2e",
"request": "age_over_18",
"result": {
"age_over_18": true
}
}
}
]
}
Processing the Webhook
-
Receive Webhook
- Configure your server to listen for an HTTP POST request at the endpoint you provided to Pleenk or configured as
pw_notification
params.
- Configure your server to listen for an HTTP POST request at the endpoint you provided to Pleenk or configured as
-
Verify signature: Refer to signature verification procedure
-
Parse the Payload
- Extract the
events
array from the incoming JSON. - Get first event as approve always containing only one event.
- Extract the
-
Apply Logic
- Match
userRef
to the corresponding user or session in your system. - If
age_over_18
istrue
, grant or maintain access to age-restricted sections. Otherwise, deny or revoke access.
- Match
-
Acknowledge Receipt
- Return an HTTP
200 OK
(or suitable) response to confirm successful handling of the webhook.
- Return an HTTP
Updated 2 days ago