Skip to main content

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​

FieldRequiredRule
eventyesThe 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
contactyesWho the event is about: at least one of external_id, phone, email — see Contact
message_idno, but send itThe 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_atnoWhen it happened: ISO 8601 with a time zone — 2026-11-20T12:20:00+02:00 or …Z. Without the field — the time of receipt
propertiesnoThe details of the event — a JSON object: order number, amount, links. Texts use them as {{ trigger.order_id }}
traitsnoFields of the contact: name, language, time zone and any of your own — see Contact fields
consentsnoConsents to messages: { "sms_marketing": true } — see Consents
dedupe_keynoThe 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
contextnoAnything about the sender — the source, the version — as a JSON object. It is stored with the event
backfillnotrue — 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:

IdentifierRule
external_idYour id of the customer: a string or an integer, up to 190 characters
phoneA 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)
emailAn 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, null instead of an id — is dropped with the warning invalid_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_id first), 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/false or a simple list; null removes the field.
  • first_name is what the templates greet with: {{ contact.first_name }}.
  • language (or locale) and timezone become 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 only sms_marketing, a Viber + SMS message goes by SMS;
  • tips go until the person refuses them (false);
  • service messages need no consent.

Time​

  • occurred_at is 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_at for 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_id is accepted.
  • Without message_id the event is accepted with the warning no_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:

{
"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
}
}
]
}

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.