Sending a Custom Event
Sending a custom event is as simple as sending a POST
request to the events endpoint of the Torque API. For an event to be accepted by the Torque API, you must first create the custom event and structure.
Custom event endpoint: https://api.torque.so/events
Request structure
NOTE: Replace the event name, and parameters with the ones you configured when creating the custom event.
Example request
Let's say that you wanted to create a campaign/offer that requires a user to purchase a specific product ("item_123") from a store. First, you would create a custom event named STORE_ORDER
with the following parameters: itemId
, orderAmount
, and isPremiumUser
. Now, when creating a campaign/offer and adding requirements, you can select "Custom Event" and then select the STORE_ORDER
custom event you created. In the custom event configuration, you will be shown the parameters you created for the event and be able to set the validation rules for each parameter. Since the original requirement was for a specific product purchase, you only need to set the "exact match" validation rule for the itemId
parameter to match "item_123".
Here is a full example of a custom event request of a store order:
Our system will validate the event data, and if it is valid, it will be accepted by the Torque API if the user accepted the offer and met the requirements.
Last updated