Benji Platform Webhooks Overview
An overview of the Benji Platform webhooks, allowing you to receive real time updates on users, campaigns and reward transactions.
Overview
The Benji Platform webhooks allow you to receive updates in near real time on activities in your partnership ecosystem. The following webhook entities are supported: -Users : Updates on a user’s partner connect status and lifecycle on the Benji Platform. -Campaigns : Updates to relevant campaigns and their lifecycle on the Benji Platform -Transactions : Updates on reward transaction statuses and lifecycle.
Webhook Format
All webhooks contain the following JSON body parameters :
Integer representing an enum of one of the following entity type values :
Webhook Authentication
In order to optionally authenticate and validate that the webhook was received from the Benji Platform, Benji provides a header value representing a signature that you can then validate. The signature is essentially the webhook body, signed with the salt provided in the response from the subscribe endpoint, using a HMAC SHA-256 (HS256) algorithm. To authenticate the webhook, you can go through the following steps :
- Store the salt returned in the subscribe API call.
- When receieving a webhook, use the salt to create a signature using the body of the webhook and the salt from the previous step using the HS256 algorithm.
- Extract the provided signature from the x-benji-signature header value
- Compare your signed body and the siganture provided, and continue processing the webhook only if the signatures match.
The webhook will also contain a header including the datetime in GMT format of the event. Typically, you can use this field to validate that this webhook is not a replay event.
Webhook body sample
Webhook Flow
A typical webhook flow requires the following steps :
- Subscribe to an event and register your webhook endpoint. The Benji Platform will send any updates to this event to this endpoint using a POST request.
- Listen to any webhooks on your registered webhook event endpoint
- Call the Benji Platform API to retrieve additional information on the entity based on the event and the entity_type parameters in the webhook.
Supported events
The following events and their corresponding entity types are supported :