Skip to main content

Importing history from CSV

Flows know only the events they have received. A customer who bought five times before you connected is a stranger to them — until you load the history. A file of past orders or visits makes "Reactivation" and conditions like "bought three times" or "spent over 5,000 in 90 days" work from the first day.

The import is in the cabinet: Flows → Connections → Event journal, the Import events button.

What the import does​

Every row of the file becomes an event marked as history:

  • it is recorded in the journal and counted in the contact's history and in conditions;
  • it finds or creates the contact by the same rules as an event sent through the API — see Contact;
  • it starts no flows: nobody gets a message about an order from last spring;
  • it does count as the exit and the goal of a flow — a past order_paid is a paid order;
  • it does not use the daily quota of events.

The file​

  • CSV with the names of the columns in the first row.
  • UTF-8 (a BOM is fine) or Windows-1251.
  • The separator: a comma, a semicolon, a tab or |.
  • Up to 20 MB and 100,000 rows. Split a larger file into parts and import them one by one.
  • Column names do not repeat.
id;order_id;date;customer;phone;total
shop:order_paid:A-0977;A-0977;2026-08-14 18:40;client-77;+380671234567;890
shop:order_paid:A-1013;A-1013;2026-09-30 11:05;client-77;+380671234567;1520
shop:order_paid:A-1020;A-1020;2026-10-02 09:12;client-81;0501112233;430

This file is imported with one type, order_paid: id goes to Event ID, date — to Event time, customer — to Customer ID, phone — to Phone, order_id and total become properties with these names.

Event type​

  • One type for the whole file — every row is an event of one type, for example order_paid;
  • The type is in a column of the file — each row names its own type.

A type is Latin letters, digits and _ . : -, starting with a letter, up to 64 characters — as the name of an event sent through the API. Use the names of the recommended events, and the templates will see the history.

Columns​

For every column of the file, choose where it goes:

WhereWhat it is
Event timeRequired: when it happened
Customer ID, Phone, EmailThe contact: at least one of the three
Event ID (against duplicates)What makes the row unique — see Repeating an import. A row with a known ID is not recorded again
Event typeWhen each row names its own type
PropertyA property of the event under the name of the column, or a property the event already has
Do not importThe column is skipped
  • An event has up to 50 properties. Mark the extra columns Do not import.
  • A number in a cell becomes a number: 1520 is counted as an amount.

Time​

The time is a date and a time: 2026-11-10 14:05, or ISO 8601 with a time zone. A time without a zone is read in the time zone of the flows settings.

Repeating an import​

With an Event ID column, importing the same file again adds nothing: the known rows become duplicates. Without it, every import records the rows anew, and the history doubles.

The Event ID is unique among all events of the account, not only in this file and not only in this type. A bare order number used for order_created in one file and for order_paid in another makes the whole second file duplicates. Put the type in front — order_paid:A-0977 — or, better, the same value your system sends as message_id through the API (shop:order_paid:A-0977): then the API and the file do not double each other either.

The result​

The import runs in the background; the dialog shows how it goes and then the totals:

  • Recorded — the new events;
  • Duplicates — rows with an Event ID that is already known;
  • Refused — rows that did not pass the check, with the row number and the reason.

The reasons are the same as for an event sent through the API — Refused events: invalid_contact — no valid phone, email or customer ID; invalid_time — the time cannot be read; invalid_event — the type breaks the rule. Fix the rows and import them again: with an Event ID column, the rows already recorded will be duplicates.