X

Create a recipient event

A recipient event can be used for tracking campaign engagement and conversions. Events can also be recorded so communication can be triggered automatically.


[POST] https://api-eu1.stannp.com/v1/recipientEvents/create

Parameters

recipient_id string An id of the recipient. This needs to be the recipient_id or the alternative reference id which can be used to match an id from a different system.
name string Name the event. For example: PURCHASE, SIGNUP, PAGE_VIEW, PRODUCT_VIEW, PRODUCT_TO_BASKET.
value string Add value information. For example, the value of the purchase or the product name.
conversion bool True or false. Is this a conversion event (e.g., purchasing or a signup)? Defaults to false.
data string Any extended data you wish to store about this event for automation tasks or dynamic templating.
ref string Can be a campaign reference id or a mailpiece reference id. If left empty, we will use any recent communication to allocate as a reference.

Request

                <?php
$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api-eu1.stannp.com/v1/recipientEvents/create?api_key={API_KEY}",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => array(
        'name' => "PURCHASE",
        'value' => "24.99",
        'conversion' => "true",
        'recipient_id' => "12345"
    ),
    
));

$response = curl_exec($curl);

curl_close($curl);
print_r($response);
?>
            

Response

{
    "success": true,
    "data": 266
}