curl --request POST \
--url https://api.messaging.phonovation.com/peopleevents/2/persons/{personId}/definitions/{definitionId}/events \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json-patch+json' \
--data '
{
"properties": {
"transactionId": "my-transaction-1",
"fromPromoCampaign": true,
"totalCost": 100,
"itemsInCart": [
{
"itemId": 1,
"price": 25,
"quantity": 3,
"inStockSince": "2023-11-17T15:47:50.4136517Z",
"category": "clothes"
},
{
"itemId": 2,
"price": 25,
"quantity": 1,
"inStockSince": "2023-12-17T15:47:50.4138054Z",
"category": "shoes"
}
]
}
}
'import requests
url = "https://api.messaging.phonovation.com/peopleevents/2/persons/{personId}/definitions/{definitionId}/events"
payload = { "properties": {
"transactionId": "my-transaction-1",
"fromPromoCampaign": True,
"totalCost": 100,
"itemsInCart": [
{
"itemId": 1,
"price": 25,
"quantity": 3,
"inStockSince": "2023-11-17T15:47:50.4136517Z",
"category": "clothes"
},
{
"itemId": 2,
"price": 25,
"quantity": 1,
"inStockSince": "2023-12-17T15:47:50.4138054Z",
"category": "shoes"
}
]
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json-patch+json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)using RestSharp;
var options = new RestClientOptions("https://api.messaging.phonovation.com/peopleevents/2/persons/{personId}/definitions/{definitionId}/events");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "<api-key>");
request.AddJsonBody("{\n \"properties\": {\n \"transactionId\": \"my-transaction-1\",\n \"fromPromoCampaign\": true,\n \"totalCost\": 100,\n \"itemsInCart\": [\n {\n \"itemId\": 1,\n \"price\": 25,\n \"quantity\": 3,\n \"inStockSince\": \"2023-11-17T15:47:50.4136517Z\",\n \"category\": \"clothes\"\n },\n {\n \"itemId\": 2,\n \"price\": 25,\n \"quantity\": 1,\n \"inStockSince\": \"2023-12-17T15:47:50.4138054Z\",\n \"category\": \"shoes\"\n }\n ]\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
HttpResponse<String> response = Unirest.post("https://api.messaging.phonovation.com/peopleevents/2/persons/{personId}/definitions/{definitionId}/events")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json-patch+json")
.body("{\n \"properties\": {\n \"transactionId\": \"my-transaction-1\",\n \"fromPromoCampaign\": true,\n \"totalCost\": 100,\n \"itemsInCart\": [\n {\n \"itemId\": 1,\n \"price\": 25,\n \"quantity\": 3,\n \"inStockSince\": \"2023-11-17T15:47:50.4136517Z\",\n \"category\": \"clothes\"\n },\n {\n \"itemId\": 2,\n \"price\": 25,\n \"quantity\": 1,\n \"inStockSince\": \"2023-12-17T15:47:50.4138054Z\",\n \"category\": \"shoes\"\n }\n ]\n }\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.messaging.phonovation.com/peopleevents/2/persons/{personId}/definitions/{definitionId}/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'properties' => [
'transactionId' => 'my-transaction-1',
'fromPromoCampaign' => true,
'totalCost' => 100,
'itemsInCart' => [
[
'itemId' => 1,
'price' => 25,
'quantity' => 3,
'inStockSince' => '2023-11-17T15:47:50.4136517Z',
'category' => 'clothes'
],
[
'itemId' => 2,
'price' => 25,
'quantity' => 1,
'inStockSince' => '2023-12-17T15:47:50.4138054Z',
'category' => 'shoes'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json-patch+json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json-patch+json'},
body: JSON.stringify({
properties: {
transactionId: 'my-transaction-1',
fromPromoCampaign: true,
totalCost: 100,
itemsInCart: [
{
itemId: 1,
price: 25,
quantity: 3,
inStockSince: '2023-11-17T15:47:50.4136517Z',
category: 'clothes'
},
{
itemId: 2,
price: 25,
quantity: 1,
inStockSince: '2023-12-17T15:47:50.4138054Z',
category: 'shoes'
}
]
}
})
};
fetch('https://api.messaging.phonovation.com/peopleevents/2/persons/{personId}/definitions/{definitionId}/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"eventId": "EFDB662A-F0BD-4064-8F49-16C0C1C48AD2",
"definitionId": "addToCart",
"occurredTime": "2024-05-17T15:47:50.4139152Z",
"properties": {
"transactionId": "my-transaction-1",
"fromPromoCampaign": true,
"totalCost": 100,
"itemsInCart": [
{
"itemId": 1,
"price": 25,
"quantity": 3,
"inStockSince": "2023-11-17T15:47:50.4136517Z",
"category": "clothes"
},
{
"itemId": 2,
"price": 25,
"quantity": 1,
"inStockSince": "2023-12-17T15:47:50.4138054Z",
"category": "shoes"
}
]
},
"metadata": {
"source": "API"
}
}{
"requestError": {
"serviceException": {
"messageId": "UNAUTHORIZED",
"text": "Unauthorized"
}
}
}{
"requestError": {
"serviceException": {
"messageId": "FORBIDDEN",
"text": "Forbidden"
}
}
}{
"requestError": {
"serviceException": {
"messageId": "NOT_FOUND",
"text": "Not found"
}
}
}{
"requestError": {
"serviceException": {
"messageId": "GENERAL_ERROR",
"text": "Something went wrong. Please contact support."
}
}
}Send Event
Use this endpoint to track events that persons perform. Your request must refer to existing person profile and event definition.
Required scope: Enable one of: people:manage, people:use, web:sdk.
curl --request POST \
--url https://api.messaging.phonovation.com/peopleevents/2/persons/{personId}/definitions/{definitionId}/events \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json-patch+json' \
--data '
{
"properties": {
"transactionId": "my-transaction-1",
"fromPromoCampaign": true,
"totalCost": 100,
"itemsInCart": [
{
"itemId": 1,
"price": 25,
"quantity": 3,
"inStockSince": "2023-11-17T15:47:50.4136517Z",
"category": "clothes"
},
{
"itemId": 2,
"price": 25,
"quantity": 1,
"inStockSince": "2023-12-17T15:47:50.4138054Z",
"category": "shoes"
}
]
}
}
'import requests
url = "https://api.messaging.phonovation.com/peopleevents/2/persons/{personId}/definitions/{definitionId}/events"
payload = { "properties": {
"transactionId": "my-transaction-1",
"fromPromoCampaign": True,
"totalCost": 100,
"itemsInCart": [
{
"itemId": 1,
"price": 25,
"quantity": 3,
"inStockSince": "2023-11-17T15:47:50.4136517Z",
"category": "clothes"
},
{
"itemId": 2,
"price": 25,
"quantity": 1,
"inStockSince": "2023-12-17T15:47:50.4138054Z",
"category": "shoes"
}
]
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json-patch+json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)using RestSharp;
var options = new RestClientOptions("https://api.messaging.phonovation.com/peopleevents/2/persons/{personId}/definitions/{definitionId}/events");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "<api-key>");
request.AddJsonBody("{\n \"properties\": {\n \"transactionId\": \"my-transaction-1\",\n \"fromPromoCampaign\": true,\n \"totalCost\": 100,\n \"itemsInCart\": [\n {\n \"itemId\": 1,\n \"price\": 25,\n \"quantity\": 3,\n \"inStockSince\": \"2023-11-17T15:47:50.4136517Z\",\n \"category\": \"clothes\"\n },\n {\n \"itemId\": 2,\n \"price\": 25,\n \"quantity\": 1,\n \"inStockSince\": \"2023-12-17T15:47:50.4138054Z\",\n \"category\": \"shoes\"\n }\n ]\n }\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
HttpResponse<String> response = Unirest.post("https://api.messaging.phonovation.com/peopleevents/2/persons/{personId}/definitions/{definitionId}/events")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json-patch+json")
.body("{\n \"properties\": {\n \"transactionId\": \"my-transaction-1\",\n \"fromPromoCampaign\": true,\n \"totalCost\": 100,\n \"itemsInCart\": [\n {\n \"itemId\": 1,\n \"price\": 25,\n \"quantity\": 3,\n \"inStockSince\": \"2023-11-17T15:47:50.4136517Z\",\n \"category\": \"clothes\"\n },\n {\n \"itemId\": 2,\n \"price\": 25,\n \"quantity\": 1,\n \"inStockSince\": \"2023-12-17T15:47:50.4138054Z\",\n \"category\": \"shoes\"\n }\n ]\n }\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.messaging.phonovation.com/peopleevents/2/persons/{personId}/definitions/{definitionId}/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'properties' => [
'transactionId' => 'my-transaction-1',
'fromPromoCampaign' => true,
'totalCost' => 100,
'itemsInCart' => [
[
'itemId' => 1,
'price' => 25,
'quantity' => 3,
'inStockSince' => '2023-11-17T15:47:50.4136517Z',
'category' => 'clothes'
],
[
'itemId' => 2,
'price' => 25,
'quantity' => 1,
'inStockSince' => '2023-12-17T15:47:50.4138054Z',
'category' => 'shoes'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json-patch+json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json-patch+json'},
body: JSON.stringify({
properties: {
transactionId: 'my-transaction-1',
fromPromoCampaign: true,
totalCost: 100,
itemsInCart: [
{
itemId: 1,
price: 25,
quantity: 3,
inStockSince: '2023-11-17T15:47:50.4136517Z',
category: 'clothes'
},
{
itemId: 2,
price: 25,
quantity: 1,
inStockSince: '2023-12-17T15:47:50.4138054Z',
category: 'shoes'
}
]
}
})
};
fetch('https://api.messaging.phonovation.com/peopleevents/2/persons/{personId}/definitions/{definitionId}/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"eventId": "EFDB662A-F0BD-4064-8F49-16C0C1C48AD2",
"definitionId": "addToCart",
"occurredTime": "2024-05-17T15:47:50.4139152Z",
"properties": {
"transactionId": "my-transaction-1",
"fromPromoCampaign": true,
"totalCost": 100,
"itemsInCart": [
{
"itemId": 1,
"price": 25,
"quantity": 3,
"inStockSince": "2023-11-17T15:47:50.4136517Z",
"category": "clothes"
},
{
"itemId": 2,
"price": 25,
"quantity": 1,
"inStockSince": "2023-12-17T15:47:50.4138054Z",
"category": "shoes"
}
]
},
"metadata": {
"source": "API"
}
}{
"requestError": {
"serviceException": {
"messageId": "UNAUTHORIZED",
"text": "Unauthorized"
}
}
}{
"requestError": {
"serviceException": {
"messageId": "FORBIDDEN",
"text": "Forbidden"
}
}
}{
"requestError": {
"serviceException": {
"messageId": "NOT_FOUND",
"text": "Not found"
}
}
}{
"requestError": {
"serviceException": {
"messageId": "GENERAL_ERROR",
"text": "Something went wrong. Please contact support."
}
}
}Authorizations
This is the most secure authorization type and the one with the most flexibility.
API keys can be generated by calling the dedicated API method. Furthermore, API keys can have a limited scope and cover only some API methods. Lastly, they can be revoked at any time. This range of possibilities makes API keys well suited for separating the API access rights across multiple applications or use cases. Finally, the loss of an API key is easily manageable.
You can manage your API keys from GUI, or programmatically with dedicated API.
API key Authorization header example:
Authorization: App 003026bbc133714df1834b8638bb496e-8f4b3d9a-e931-478d-a994-28a725159ab9
Path Parameters
Identifier of the custom event definition. Event properties are passed in the request body.
Identifier of the person who performed the event. The identifierType query parameter specifies the type of the ID.
Query Parameters
Person's identifier type.
ID, EXTERNAL_ID, PHONE, EMAIL, LINE, FACEBOOK, TELEGRAM, PUSH, WEB_PUSH, LIVE_CHAT, VIBER_BOTS, INSTAGRAM, INSTAGRAM_DM, TWITTER, APPLE_BUSINESS_CHAT, KAKAO_SANGDAM, GOOGLE_BUSINESS_MESSAGES, WHATSAPP, ZALO_FOLLOWER, TIKTOK_BM Set this parameter to true to automatically create a person profile with the specified personId and identifierType if no existing profile matches the provided identifier. The default value is false.
Note: New profiles can only be created for the following identifier types: PHONE, EMAIL, or EXTERNAL_ID.
Body
Unique identifier of the event. If provided, it helps prevent duplicate events in case of retries—for example, if the first API call fails and the same event is sent again. Passing the same eventId ensures the event is only recorded once in the person profile.
The value must be 1–36 characters long and can include letters (A–Z, a–z), digits (0–9), underscores (_), and hyphens (-) only.
Object containing event properties. Must match the corresponding event definition. See People Events documentation for supported data types.
Response
Successfully created
Unique identifier of the event.
Unique identifier of event schema.
Time of event occurrence, as the following format: yyyy-MM-dd'T'HH:mm:ss.SSSZ
"2024-05-17T15:47:50.413Z"
Object that contains event properties.
Show child attributes
Show child attributes
Object that contains metadata of event occurrence.
Show child attributes
Show child attributes