Event format
Request
POST https://events.alphasms.net/v1/events with two headers:
Authorization: Bearer <KEY>
Content-Type: application/json
If your system cannot set headers, pass the key in the address instead: POST https://events.alphasms.net/v1/events?key=<KEY>. The
header wins: when Authorization is present, the parameter is ignored. The key in the address is visible wherever the
address is — in your system's settings and logs — so use the header when you can. AlphaFlow does not write the address to
its logs.
The body is one event:
{ "event": "order_paid", "contact": { "external_id": "client-77" } }
or a batch of up to 100 events in batch:
{ "batch": [
{ "event": "order_created", "contact": { "external_id": "client-77" } },
{ "event": "order_paid", "contact": { "external_id": "client-77" } }
] }
Event fields
| Field | Required | Rule |
|---|---|---|
event | yes | The event name: Latin letters, digits and _ . : -, up to 64 characters, starting with a letter. You choose the names; AlphaFlow adds a new one to the catalogue with its first event |
contact | yes | Who the event is about: at least one of external_id, phone, email — see Contact |
message_id | no, but send it | The id of the event in your system: up to 128 printable ASCII characters without spaces. A second event with the same id is not recorded, so a retry is safe — see Duplicates |
occurred_at | no | When it happened: ISO 8601 with a time zone — 2026-11-20T12:20:00+02:00 or …Z. Without the field — the time of receipt |
properties | no | The details of the event — a JSON object: order number, amount, links. Texts use them as {{ trigger.order_id }} |
traits | no | Fields of the contact: name, language, time zone and any of your own — see Contact fields |
consents | no | Consents to messages: { "sms_marketing": true } — see Consents |
dedupe_key | no | The business object of the event: an order or invoice number, a string or a number up to 128 characters. Send the same value in every event of one order: a flow can then wait for an event of this very order |
context | no | Anything about the sender — the source, the version — as a JSON object. It is stored with the event |
backfill | no | true — the event is history: it is recorded but starts no flows — see History |
Limits
- An event — up to 64 KB of JSON. A larger one is refused with
payload_too_large, the rest of the batch is recorded. - A batch — up to 100 events. A larger batch is refused whole:
413 batch_too_large. - A request body — up to 2 MB:
413 body_too_large. All three limits apply: a hundred events of 64 KB do not fit into one request, but a usual event is a few hundred bytes.
Contact
Every event is about one person. contact names them by at least one identifier:
| Identifier | Rule |
|---|---|
external_id | Your id of the customer: a string or an integer, up to 190 characters |
phone | A phone number in any notation: +380671234567, 380671234567, 067 123 45 67, (067) 123-45-67. A local number is read by the country of the account (the phone region in the Flows settings) |
email | An email address; it is stored in lower case |
AlphaFlow finds the contact by external_id, then by phone, then by email, and creates one if there is none.
The other identifiers of the event are added to the contact: up to five phones and five addresses, one
external_id.
- A value that cannot be read —
0000, a word instead of a number,nullinstead of an id — is dropped with the warninginvalid_identifier, and the contact is found by the rest. With no valid identifier left, the event is refused:invalid_contact. - Two contacts are never merged on their own. If the phone of the event already belongs to another contact,
the event goes to the contact of the older identifier (
external_idfirst), and the mismatch is logged.
Send external_id whenever you have it: phones change hands and people have several addresses, while your
customer id stays.
Contact fields
traits updates the profile of the contact:
"traits": { "first_name": "Olena", "language": "uk", "timezone": "Europe/Kyiv", "city": "Lviv", "vip": true }
- Up to 50 fields. A value is a number, a string,
true/falseor a simple list;nullremoves the field. first_nameis what the templates greet with:{{ contact.first_name }}.language(orlocale) andtimezonebecome the contact's language and time zone. The time zone decides when quiet hours begin for the person.- The latest value wins by the time of the event: an event that arrives late does not overwrite fresher fields.
Consents
consents records what the person agreed to receive. The key is <channel>_<topic>:
- channels:
sms,viber,whatsapp,rcs,email; - topics:
service(order, payment, appointment),tips(useful advice, a review request),marketing(offers and reminders that sell).
"consents": {
"sms_marketing": true,
"viber_marketing": { "granted": true, "source": "checkout", "at": "2026-11-20T12:05:00+02:00" }
}
The value is true/false or an object with granted, source (where the consent was given) and at.
false withdraws the consent: AlphaFlow records the event consent_revoked, and the channel stops receiving that
topic.
How the topics work in flows:
- marketing goes only to the channels with consent
true. A cascade keeps the channels that have it: with onlysms_marketing, a Viber + SMS message goes by SMS; - tips go until the person refuses them (
false); - service messages need no consent.
Time
occurred_atis ISO 8601 with a time zone. A time without a zone is refused:invalid_time.- A time in the future is cut to the time of receipt.
- An event older than 72 hours (by
occurred_at, against the time of receipt) is recorded but starts no flows: a reminder about a week-old cart helps no one. - Dates inside
properties—visit_atfor an appointment — are ISO 8601 as well. Without a zone they are read in the time zone of the account.
Duplicates
message_id is the id of the event in your system. AlphaFlow keeps every message_id of the account for good: an
event with a known id — including a repeat inside the same batch — is not recorded again and starts nothing.
This is what makes a retry safe.
- Build the id from what makes the event unique:
shop:order_paid:A-1042,shop:order_status_changed:A-1042:shipped. - Ids starting with
flow:are reserved for AlphaFlow's own events. - A refused event does not take its id: the corrected event with the same
message_idis accepted. - Without
message_idthe event is accepted with the warningno_message_id, and a retry becomes a second event.
History
backfill: true marks an event as history: it is recorded in the journal and counted in the contact's history
and in conditions such as "bought three times", but it starts no flows. Put it on an event or next to
batch for the whole request:
- JSON
- cURL
- PHP
- Python
- Node.js
{
"backfill": true,
"batch": [
{
"message_id": "shop:order_paid:A-0977",
"event": "order_paid",
"occurred_at": "2026-08-14T18:40:00+03:00",
"contact": {
"external_id": "client-77"
},
"properties": {
"order_id": "A-0977",
"total": 890
}
}
]
}
curl -X POST 'https://events.alphasms.net/v1/events' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <KEY>' \
--data-raw '{
"backfill": true,
"batch": [
{
"message_id": "shop:order_paid:A-0977",
"event": "order_paid",
"occurred_at": "2026-08-14T18:40:00+03:00",
"contact": {
"external_id": "client-77"
},
"properties": {
"order_id": "A-0977",
"total": 890
}
}
]
}'
<?php
$payload = <<<'JSON'
{
"backfill": true,
"batch": [
{
"message_id": "shop:order_paid:A-0977",
"event": "order_paid",
"occurred_at": "2026-08-14T18:40:00+03:00",
"contact": {
"external_id": "client-77"
},
"properties": {
"order_id": "A-0977",
"total": 890
}
}
]
}
JSON;
$ch = curl_init('https://events.alphasms.net/v1/events');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Bearer <KEY>',
],
CURLOPT_POSTFIELDS => $payload,
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $status, ' ', $response;
import requests
response = requests.post(
"https://events.alphasms.net/v1/events",
headers={"Authorization": "Bearer <KEY>"},
json={
"backfill": True,
"batch": [
{
"message_id": "shop:order_paid:A-0977",
"event": "order_paid",
"occurred_at": "2026-08-14T18:40:00+03:00",
"contact": {
"external_id": "client-77",
},
"properties": {
"order_id": "A-0977",
"total": 890,
},
},
],
},
timeout=30,
)
print(response.status_code, response.json())
const response = await fetch("https://events.alphasms.net/v1/events", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer <KEY>",
},
body: JSON.stringify({
"backfill": true,
"batch": [
{
"message_id": "shop:order_paid:A-0977",
"event": "order_paid",
"occurred_at": "2026-08-14T18:40:00+03:00",
"contact": {
"external_id": "client-77"
},
"properties": {
"order_id": "A-0977",
"total": 890
}
}
]
}),
});
console.log(response.status, await response.json());
For a file of past orders or visits there is the import in the cabinet — History from CSV.
Event types
AlphaFlow keeps a catalogue of the events it receives: names, properties and their types (string, number,
integer, boolean, datetime, array, object). The types are learned from the events; a string with an
ISO 8601 date becomes datetime, and a flow can wait until that moment.
In the cabinet, the Event types tab gives an event a title and describes its properties. When a property
arrives in a type different from the description, the event is recorded with the warning schema_mismatch.