Webhooks
Overview
Reward webhooks enable you to receive real-time notifications when data changes in Reward. By using webhooks, you can automate processes such as syncing user credits, updating profiles, or triggering workflows in your application.
Getting Started
Creating a Webhook
Follow these steps to set up a webhook in your Reward account:
- Go to the Webhooks page under Account Settings.
- Click the Create Webhook button.
- Enter a name for your webhook.
- Specify the URL where you want to receive webhook notifications (supports
POST
requests only). - Select the events you wish to subscribe to.
- Click Create Webhook to save your webhook configuration.
Webhook Events
Reward supports the following webhook events:
trigger_event.created
: Triggered whenever a new trigger event is created.balance.credit_points_issued
: Triggered when credits are issued to a user.
Check the API Reference for detailed information on each event.
Webhook Payload
Webhook events send a POST
request to your specified URL, containing a JSON payload with the following structure:
Payload Format
Field | Type | Description |
---|---|---|
id | string | Unique identifier for the webhook event. |
type | string | Event type (e.g., trigger_event.created ). |
time | string | ISO 8601 timestamp when the event occurred. |
data | object | Event-specific payload with additional details. |
Example Payload
{
"id": "we_01jf2wkmvcfw6ts1qmgzya291c",
"type": "trigger_event.created",
"time": "2024-12-14T15:29:18.821Z",
"data": {
"user": {
"id": "ca9bb5c2-25a6-43e9-972e-862d28241a47"
},
"value": 2.99,
"trigger": {
"id": "successful_payment"
}
}
}
Error Handling
Reward expects your webhook endpoint to return a 2xx
HTTP status code to acknowledge successful receipt of the event. If a non-2xx
status is returned, Reward will retry the delivery up to 5 times with exponential backoff.
Security Best Practices
To ensure secure and reliable webhook integration:
- Keep your webhook URL confidential: Avoid sharing your URL to prevent unauthorized access.
- Use HTTPS: Always use a secure connection (HTTPS) for your webhook endpoint to protect the data in transit.