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.
https://dash.stannp.com/api/v1/recipientEvents/create

Parameters

recipient_id string An id of the recipient. This needs to be the recipient_id or the alternative reference id whcih 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 You can add value information here. For example the vlaue of the purchase or the product name. For conversions the value should be a number so that we can calculate.
conversion bool True or false. Is this a conversion event. Conversions are things like purchasing or a signup. Defaults to false.
data string Any exetended data you wish to store about this event used 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
$ curl https://dash.stannp.com/api/v1/recipientEvents/create \
-u {API_KEY}: \
-d "name=PURCHASE" \ 
-d "value=24.99" \ 
-d "conversion=1" \ 
-d "recipient_id=12345"
define("API_KEY", "YOUR API KEY");
$postdata = http_build_query(
    array(
        'name' => "PURCHASE"
        'value' => "24.99"
        'conversion' => "1"
        'recipient_id' => "12345"
    )
);
$opts = array(
    'http' => array(
        'method'  => 'POST',
        'header'  => 'Content-type: application/x-www-form-urlencoded',
        'content' => $postdata
    )
);
$context  = stream_context_create($opts);
$result = file_get_contents("https://dash.stannp.com/api/v1/recipientEvents/create?api_key=" . API_KEY, false, $context);
$response = json_decode($result, true);

print_r($response);
import requests

data = {
    'name': 'PURCHASE',
    'value': '24.99',
    'conversion': '1',
    'recipient_id': '12345',
}

response = requests.post('https://dash.stannp.com/api/v1/recipientEvents/create?api_key={API_KEY}', data=data)
print(response.text)
var client = new RestClient("https://dash.stannp.com/api/v1/recipientEvents/create?api_key={API_KEY}");

var request = new RestRequest(Method.POST);

request.AddParameter("name", "PURCHASE");
request.AddParameter("value", "24.99");
request.AddParameter("conversion", "1");
request.AddParameter("recipient_id", "12345");

IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content)
Response
{
   "success":true,
   "data": 266
   }
}