Trigger Custom Events
This document provides a detailed reference for triggering custom events via the Reward API.
Overview
The custom event endpoint enables you to programmatically trigger specific events in your application. This is useful for monitoring user interactions, purchase events, feature usage, and other custom milestones not captured by the Reward SDK.
Endpoints
POST /triggers/{triggerId}/users/{userId}/events
Description
Trigger a custom event for a specific user, using a defined triggerId
and the unique userId
for the user.
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
triggerId | string | Yes | The unique identifier of the trigger, created in the dashboard. |
userId | string | Yes | The unique identifier of the user (must be URL-encoded if containing special characters). |
Request Headers
Header | Type | Required | Description |
---|---|---|---|
Authorization | string | Yes | Your API key in the format: Bearer {API_KEY} . |
Content-Type | string | Yes | Must be set to application/json . |
Request Body
Field | Type | Required | Description |
---|---|---|---|
value | number | No | The value associated with the custom event (e.g., purchase amount). |
Example Request
POST /v1/triggers/successful_payment/users/user123/events
Authorization: Bearer sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Type: application/json
{
"value": 19.99
}
Response
If the request is successful, you will receive a 200 OK
response with the following payload:
{
"success": true
}
Changelog
Date | Change |
---|---|
2024-12-16 | Initial release of the custom event trigger API. |