API ReferenceTriggers

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

ParameterTypeRequiredDescription
triggerIdstringYesThe unique identifier of the trigger, created in the dashboard.
userIdstringYesThe unique identifier of the user (must be URL-encoded if containing special characters).

Request Headers

HeaderTypeRequiredDescription
AuthorizationstringYesYour API key in the format: Bearer {API_KEY}.
Content-TypestringYesMust be set to application/json.

Request Body

FieldTypeRequiredDescription
valuenumberNoThe 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

DateChange
2024-12-16Initial release of the custom event trigger API.