Trigger manual

The engine has two separate trigger systems that are easy to mix up:

  • Engine trigger detectors — nightly detectors that feed the recommendation pipeline. They never send anything themselves; their output turns into rec_ recommendations and the rec_active_triggers field (see Smaily templates).
  • Engine-run automations — a smaller subset of triggers you can turn on in the plugin/admin so the engine itself enrols a contact into your Smaily automation (Smaily templates → Engine-run automations gives the how-to; this page gives the exact numbers).

This page is the source for the numbers: every threshold, window and cooldown here is verified straight from the code (lib/engine/triggers/, lib/automations/, the sector packs' triggers.yaml), not from spec intent. Where the engine promises more than it delivers today, that gap is called out explicitly.

How triggers fit the nightly chain

All times follow the Europe/Tallinn server schedule:

TimeStepWhat it gives the triggers
03:00Engagement-state updateengagement_state refreshes — needed by dormant_to_clicker
03:30Customer calibrationbuying-rhythm curves (cadence_curves_customer) and pet age are computed — needed by cadence_window_reached and life_stage_transition_due
04:00Trigger detectionevery detector below runs for every customer, writes trigger_candidates
04:30Recommendation issuecandidates run through the 5-stage decision pipeline, become recommendations rows
05:00Smaily contact syncrecommendations + rec_active_triggers land on the contact fields
05:15Automation firinguses ONLY candidates detected in the last 24h (see below)

Engine trigger detectors (behind the recommendations)

These ten detectors exist in code (lib/engine/triggers/index.ts). Whether one actually produces candidates for a given sector pack is decided by that pack's triggers.yaml status field — the same detector code serves every sector, but each pack switches on only the triggers it wants.

In the table, active means the pack switches the trigger on, off means the pack declares it with status stub, so it does not fire, and — means the pack does not declare it.

TriggerPet suppliesBeauty & cosmeticsFMCG / groceryHome & livingSports & fitnessFashion & apparelWine, beer & spiritsConsumer electronicsTravel & experiences
Pack statusactiveactiveactiveactiveactiveactiveactiveactiveactive
purchase_in_categoryactiveactiveactiveactiveactiveactiveactiveactiveactive
cadence_window_reachedactiveactiveactiveactiveactiveactiveactiveactiveoff
dormant_to_clickeractiveactiveactiveactiveactiveactiveactiveactiveactive
life_stage_transition_dueactive (see below)————————
cart_abandonmentoff————off———
category_first_purchaseoffactiveactiveactiveactiveactiveactiveactive—
stock_status_changeactiveactiveactiveoffoffactiveactiveactiveoff
aov_below_free_shipping_thresholdoffactiveactiveoffactiveactiveactiveactive—
seasonal_window_openoffactiveactiveactiveactiveactiveactiveactiveactive
purchase_lapsed_opener———activeactiveactive—activeactive

The other active packs:

TriggerAdult wellnessArts, crafts & hobbiesBooksCar careCinemaDIY & toolsGarden & plantsGeneral retailHome & surface careMusical instrumentsSpas and wellnessToys and baby goodsTheatre and performing artsTicketing platform
Pack statusactiveactiveactiveactiveactiveactiveactiveactiveactiveactiveactiveactiveactiveactive
purchase_in_categoryactiveactiveactiveactiveactiveactiveactiveactiveactiveactiveactiveactiveactiveactive
cadence_window_reachedactiveactive—active—activeactiveactiveactiveactiveactiveactive——
dormant_to_clickeractiveactiveactiveactiveactiveactiveactiveactiveactiveactiveactiveactiveactiveactive
life_stage_transition_due——————————————
cart_abandonment——————————————
category_first_purchaseoff——————activeactive—————
stock_status_changeoffactive—————offoff—————
aov_below_free_shipping_thresholdoff——————offoff—————
seasonal_window_open——active———active—active——activeactiveactive
purchase_lapsed_openeractiveactiveactiveactiveactiveactiveactiveactiveactiveactiveactiveactiveactiveactive

A store can be set up only on an active industry pack; every pack in these tables is active. Pet supplies and Beauty & cosmetics are self-service packs (a store can choose them itself without our team's check); our team sets up a store on the others. Salons and beauty services is under review and takes no store yet. In every pack, whatever the tables say, seasonal_window_open also opens the gift-card season for a store that has its gift cards recommended (see Seasonal window). Some packs also declare placeholder triggers of their own that have no detector (for example warranty_window_milestone in Consumer electronics and pre_departure_milestone in Travel & experiences); like the Pet placeholders further down, they produce nothing. Where a section below gives numbers per pack, a pack it does not name has its own values in its triggers.yaml.

Services and gift cards are not purchases. A non-recommendable product (a service such as assembly or delivery, a gift card, a payment, fee or deposit line — see content/docs/terms.md) never reaches an email, and since PRO-3639 it also starts no trigger: every detector that reads order lines skips it. Such a line opens no first purchase, is never the anchor product and starts no cooldown. The check is per line, not per order: a sofa bought with an assembly service triggers on the sofa as usual. When the store has chosen to have its gift cards recommended (admin → Settings → Gift cards, off by default), a gift card is a recommendable product and a gift-card order is a purchase (INT-286). A product priced at €0 or less is never recommended either (a gift card excepted); in an order its line still counts as a product (INT-299).

A product with a last date (theatre). In a pack with dated shelves (today Theatre and performing arts) the store sends one catalogue row per production, keeps it in stock while a future performance has tickets on sale, and adds two tags (INT-323):

  • tags.valid_until — the start of the last performance currently on sale: an ISO 8601 timestamp with Z or an offset (2026-12-14T19:00:00Z), or a date alone (2026-12-14, read as 00:00 UTC). Move it forward when new dates are published; never send the end of the published month or season.
  • tags.starts_at — optional, the next performance, in the same format. It is stored; no rule and no email text uses it yet.

A production whose valid_until is within 10 days is never recommended, on any path, and it leaves a list that already shows it at the next calculation: only its own place changes. The 10 days are the pack's, not a store setting. On the performance shelves (and until the nightly tagging places a row on a shelf) a production without a readable valid_until (missing, or another format) is recommended only by a strong rule — the same genre, director or creator, or a family production after a children's show — never as a popular pick, and only while the store keeps sending it: in stock and received in the last 7 days. It leaves a list when the store stops sending it. A refunded ticket there is a changed date, not a returned production: the production may be recommended again, and refunds do not count toward the repeat-returner limit. A bought production is never recommended to its buyer again; other productions of the same genre are. When the store sends tags.city, a customer's popular picks start with the cities they bought tickets in. A production for adults (tags.audience: adult, the store's 16+/18+ marker) is never recommended to a customer who bought only children's or family shows, nor sent to them in a back-in-stock email; audience: family marks a family production, and the Christmas family picks (November–December) go only to customers who bought one. No email text claims a visit, states a date or names a child. In every other pack these tags change nothing.

A film in several cities (cinema). In the Cinema pack the store sends one catalogue row per film per city — the cinemas of one city share a film page — and every row of a film carries the same tags.product_id (the film id) and tags.city. The language versions of one title (an Estonian and a Russian dub, each its own film id) also share tags.title_id. A row stays in stock while a future screening of the film in that city has seats. The store sends (INT-324):

  • tags.valid_until — while the film keeps running past the published schedule: the start of its last published screening in that city plus 7 days, moved forward each time the schedule is published; in the film's final week in that city: the start of its last screening; for a presale film with no screening yet: its release date plus the weeks the cinema plans to show it. Same format as above. A film row without a readable valid_until is never recommended.
  • tags.title_id — the id shared by a title's language versions; without it a film is its own title.
  • tags.release_date — the film's release date (a date). Before it, the film is on presale.
  • tags.rating — the Estonian age rating, exactly one of PERE, MS-6, MS-12, K-12, K-14, K-16, K-18, Lubatud kõigile.
  • tags.audio_languages, tags.subtitle_languages — language codes (et, ru, en …) of the film's screenings in that city; a dubbed film sends its dub language and no subtitles.
  • Optional: tags.series and tags.series_order (a franchise and the film's place in it), tags.director, tags.genres, tags.event_series (an event-cinema series).

A film whose valid_until is within 3 days is never recommended and leaves a list that shows it at the next calculation; a film with no seats left in that city leaves it too. A list shows each title once — one city, one language version — as the row of the customer's city: the city they bought the most tickets in (a tie: the latest purchase); a customer with no ticket gets the city with the most films on sale. A film shown only in another city is not recommended, unless the customer bought a ticket in that city. A title the customer bought is never recommended again, in any city or language version. A film reaches the customer when its audio, or its subtitles, are in a language they bought audio in or write to us in (no ticket and no contact language: the store's language); a dubbed film is checked from the first ticket, any other film from the second, and a customer with no ticket gets the version in their contact language. Popular picks rank by the last 14 days' orders, a film without one by its release date, and a customer with no ticket gets this week's releases first. A customer who bought only family-rated films (PERE, MS-6) is not recommended a K-14, K-16 or K-18 film; a customer whose rated tickets are all older gets no family-rated popular pick, and a list for a customer with no rated ticket fills with no K-16 or K-18 film. The same director is recommended only with a newer film, and no series part at or before one the customer bought. A film on presale says so ("On presale", "See the presale"). No email text claims the customer saw a film, states a screening time, a hall, a price or seats left, or names a child.

Many organisers' events (ticketing platform). In the Ticketing platform pack — a ticketing platform, or an organiser or venue with a mixed programme — the store sends one catalogue row per occurrence: one event on one date at one venue, in stock until it sells out. The event's kind and genre are its category (concert, theatre, sport, festival, family, conference or other, then the genre). The store sends (INT-326):

  • tags.valid_until — the start of the occurrence (a festival pass: the first day). Same format as above. A row without a readable valid_until is never recommended.
  • tags.event_group — the id shared by the rows that are one thing to a buyer: the dates of one tour, the pass and day tickets of one festival edition, the performances of one production. For sport the group is the single match, never the team's season.
  • tags.organiser_id — the organiser's own id on the platform.
  • tags.venue and tags.city.
  • Optional: tags.audience (family, or adult for the store's 16+/18+ marker), tags.artist, tags.team_home and tags.league (a match), tags.festival, tags.pass (true on a festival's pass row), tags.director, tags.author.

An occurrence whose start is within its kind's days is never recommended and leaves a list that shows it at the next calculation: theatre 10 days, a concert, festival or family event 7, a match 3, a conference 14, anything else 7. A sold-out occurrence leaves too. A bought row owns its whole event group: no other date of a bought tour and no day ticket of a bought festival edition is recommended. A list shows each event group once, as the row in the customer's city on the nearest date (the city they bought the most tickets in), and a festival as its pass (tags.pass: true). Popular picks start with the genres and cities the customer bought and rank by the last 14 days' orders; an event already in a quarter of the day's lists goes last. Outside the customer's cities a popular pick is a concert or a festival only. The rules stay within the kind of the ticket bought — another production of the genre or director, the artist's other concert, a match of the same league in the same city — and take another city's play or match only when the customer's cities have none; the same team's home match is recommended only to a customer who bought two or more of that team's home matches. Kinds cross only for family events after a children's event, the same venue and tickets bought together. A list holds one match per home team, and a customer with no sport ticket gets at most one match. A children's or family event reaches only customers who bought one, or who bought nothing yet. A conference is recommended only by a rule, never as a popular pick, and an order of 5 or more tickets to one conference says nothing about the buyer. A list holds at most two events of one organiser. Religious, political and health events reach only customers who bought one, and a recommendation that follows such a ticket uses the plain popular-pick text. An organiser that keeps its buyers to itself is listed by our team (admin → Settings): its events reach only its own buyers, a ticket from it leads only to its own events and steers no popular pick, and a customer who bought only from such organisers gets the store's general list. A store with one organiser lists none. No email text claims the customer attended an event, states a date, a time, a price or seats left, or names a child.

Post-purchase cross-sell candidate — purchase_in_category

Fires cross-sell/replenish/discovery recommendations off a category purchase. Does not require a repeat purchase — fires from the very first purchase in that category (unlike cadence_window_reached, which needs at least 3 repeat purchases).

  • Fires when: the customer has a completed/processing order with an item in category C within the last window_days. One candidate per (customer, category); anchor product = the most recently purchased SKU in that category (ties broken by the largest line total).
  • Window: 30 days (Pet, FMCG) / 45 days (Beauty).
  • Cooldown: 14 days (Pet, FMCG) / 21 days (Beauty, Fashion, Alcohol) — the same customer+category won't fire again before that.

Replenishment window — cadence_window_reached

Fires when a recurring product is predicted to run low, based on the customer's OWN buying rhythm.

  • Fires when: now >= predicted_next_purchase − 15% × median_interval (buffer factor 0.85) AND the customer has at least 3 confirmed repeat purchases of the same product/product family (n_observations >= 3) AND cadence confidence ≥ 0.5.
  • No buying rhythm for a non-recommendable product (a gift card, a service): the nightly calibration computes no curve for it and removes any stored one (PRO-3791).
  • Only purchases count: cancelled and refunded orders count neither in the 3 repeat purchases nor in the rhythm. A customer whose rhythm can no longer be computed (e.g. after a refund) keeps no stored curve (PRO-3794).
  • Stops when: the product is overdue by more than 2 × the customer's median interval past the predicted date (now > predicted_next_purchase + 2 × median_interval). A customer who has skipped two whole cycles has stopped buying the product; they get no more reorder reminders for it, and the win-back triggers (dormant_to_clicker, purchase_lapsed_opener) still apply to them. Measured at MiuMjau over 14 days: 42% of candidates were later than that.
  • Cooldown: 14 days (Pet, Beauty, Alcohol) / 7 days (FMCG) / 30 days (Fashion) — product-family aware: if any other variant of the same family was recommended recently, this product won't fire again either (a variant switch does not duplicate the email).
  • Detection cooldown: 5 days per customer+product, counted from the previous candidate of this trigger. The replenishment window stays open for weeks, so without it the same product would be detected again every night; a different product coming due is unaffected and still fires the same night.
  • The underlying cadence data (median interval, consumption-rate factor, confidence) is computed in the 03:30 calibration run, before 04:00 trigger detection.

Cart abandonment — cart_abandonment (off)

The detector's code exists and works (a 24-72h window after a cart-link click, 7-day cooldown), but the Pet pack marks it stub — it produces zero candidates in any sector today. Reason: no edges_universal rule carries trigger_type='cart_abandonment' (an unauthored edge would mean "recommend the whole catalog"); offering "1 safe companion" needs cart CONTENTS, which requires browse-tracking Variant B (backlog, see CLAUDE.md §14.2).

Dormant-to-clicker — dormant_to_clicker

Fires when a long-quiet customer shows a fresh sign of life (an open or a click) — the win-back moment.

  • Fires when (two cases, OR'd):
    1. the customer is still in the dormant state, has been there at least 60 days (120 days in Consumer electronics and Travel & experiences, 180 days in Home & living and Sports & fitness), AND clicked or opened an email in the last 7 days (covers an open-driven wake-up, since the nightly engagement cron only flips state on a CLICK, not an open);
    2. the customer was freshly promoted (within the last 8 days) to won_back_recent by the 03:00 cron AND clicked or opened an email in the last 7 days (this is today's live path — the cron has already "rescued" the customer before trigger detection gets to them).
  • Cooldown: 30 days (Pet, Beauty, FMCG, Fashion, Alcohol) / 60 days (Sports & fitness) / 90 days (Consumer electronics, Travel) / 120 days (Home & living), counted from the previous candidate of this trigger.
  • Two attempts, then stop: an "attempt" is one candidate of this trigger that the nightly issuance actually used, counted from the customer's last purchase onwards. After two the customer stops being a candidate until they buy again — a purchase is what answers a win-back, and it also resets the count. A purchase is an order with at least one product: a gift card or a service bought alone does not reset it (PRO-3676). A fresh CLICK does not reset it either: this trigger fires on a click in the first place, so a click-reset would mean the limit never applies to anyone. A customer who has hit the limit still receives their nine recommendations as usual; they just stop getting another "come back" pitch.
  • Anchor product for the recommendation: the customer's most-repeated purchased product (a proven favourite, not a novelty).

Lapsed but still opening — purchase_lapsed_opener (five packs)

The other side of dormant_to_clicker: that one is about email silence and needs a click to end it. This one is about a customer who stopped buying while still opening the emails — in fashion that is the typical lapsed customer, and requiring a click closed the win-back door on nearly all of them.

  • Fires when: no purchase for the pack's lapse period AND an email open within the pack's open window AND the customer has fewer than two unanswered attempts behind them (below). A purchase is an order with at least one product: a gift card or a service bought alone does not end the lapse (PRO-3651, the same reading as the engagement state).
  • Lapse period / open window: 180 / 30 days (Fashion), 120 / 45 days (Sports & fitness), 365 / 45 days (Home & living), 540 / 45 days (Consumer electronics, Travel).
  • Anchor: exactly ONE category — the customer's most-kept product and the category it sits in. The win-back stays inside that category.
  • Two attempts, then stop (the same counter as dormant_to_clicker above): an "attempt" is one candidate of this trigger that the nightly issuance actually used, counted from the customer's last purchase onwards. After two the customer stops being a candidate. There is no separate "was it answered" test: the answer to a win-back is a purchase, which both ends the lapse and resets the count. A gift card or a service bought alone does neither (PRO-3676).
  • Cooldown: 60 days (Fashion, Sports & fitness) / 120 days (Home & living, Consumer electronics, Travel).
  • Fashion, Home & living, Sports & fitness, Consumer electronics and Travel declare it; the other packs leave it undefined, so the detector returns nothing for them.

Life-stage transition — life_stage_transition_due (pet stores only)

Fires when a pet's age crosses a life-stage boundary: kitten/puppy → adult at 12 months; adult → senior (dog 7 years / 84 months, cat 11 years / 132 months).

  • Fires when: customers.inferred_attributes.pet_age_months is known AND falls in [threshold, threshold + 1) months (a 30-day lookback window; the nightly cron always catches the crossing) AND the customer does NOT have a young-stage (kitten/puppy) purchase and an adult/senior purchase for the same species within 6 months of each other — a hard conflict gate that suppresses the trigger for likely multi-pet or gift-purchase households, where the age-derived transition would send the wrong-stage email.
  • Cooldown: 365 days, counted from the previous candidate of this trigger (a life-stage transition happens once per pet). It is also what keeps the month-wide age window from producing a candidate every night.
  • Where the age comes from, in order of confidence:
    1. Registration birthdate — the plugin registration field the customer fills in themselves. Exact, but almost no store collects it.
    2. Purchase-anchored aging timeline (PRO-1569) — the customer's FIRST purchase of a kitten/puppy product starts a clock, and the pet is treated as newborn at that moment. The age it produces is deliberately a lower bound (the pet was already some weeks or months old when that food was bought), so the transition lands late rather than early — the safe direction for a "time to switch food" email. Only a young-stage purchase may start a clock: an adult-food-only buyer gets no age at all, because assuming "12 months old" for them would fake a transition on their very first order. A later adult/senior purchase restarts the clock at that purchase, so the next boundary is measured from the observed switch-over. A birthdate always wins where one exists.
  • Honest status: with the timeline in place the trigger fires for real customers, but only for the minority whose purchases carry a life-stage tag — a store whose product names never say "kitten" or "puppy" still produces nothing here.

Category-family first purchase — category_first_purchase (off for Pet)

Fires on the customer's FIRST-EVER purchase in an entire category family (e.g. their first skincare product) — an onboarding moment.

  • Fires when: the family's first-ever purchase happened within window_days AND the customer has no earlier purchase in that family.
  • Window: 45 days (Beauty) / 30 days (FMCG).
  • Cooldown: 60 days (Beauty) / 45 days (FMCG).
  • Pet pack status: stub — this trigger does not fire for Pet tenants.

Stock status change — stock_status_change

Fires when a product the customer reliably rebuys (cadence n_observations >= 3) goes out of stock or disappears from the catalog — prompts a managed substitute recommendation.

  • Fires when: the customer's cadence SKU is either missing from the catalog or in_stock = false.
  • Does not fire for a non-recommendable product (a gift card, a service, a test product). "Recommendable" is read as everywhere else in the engine: the operator's override first, then the automatic flag (PRO-3652).
  • Cooldown: 30 days (Beauty) / 21 days (FMCG) / 30 days (Pet).
  • Pet pack status: active (PRO-1479, 2026-07-20) — the detector already existed and Pet's edges.yaml already referenced it, but the trigger definition was missing from triggers.yaml entirely, so it silently never fired. Now active — same universal detector as Beauty/FMCG.

Basket just under free shipping — aov_below_free_shipping_threshold (off for Pet)

Fires when the customer's typical basket sits just below the store's free-shipping line — a small add-on could close the gap.

  • Requires: tenant_settings.free_shipping_threshold must be configured; with no threshold set, this trigger fires for nobody by default.
  • Fires when: the customer's average of recent orders (over window_days) falls in [threshold − max_gap, threshold). An order's value is the sum of its product lines: gift card and service lines add nothing, and an order of only those is not averaged (PRO-3651).
  • Window / max gap: 60 days / €25 (Beauty); 60 days / €20 (FMCG).
  • Cooldown: 30 days (Beauty) / 21 days (FMCG).
  • Pet pack status: stub — does not fire for Pet tenants.

Seasonal window — seasonal_window_open (off for Pet)

Fires when a calendar-defined seasonal window is open (e.g. SPF season, cold & flu season, gift season) AND the customer matches the window's eligibility rule.

  • Fires when: the current month is in the window's month list AND the customer meets the eligibility rule — either "bought before, not recently" (a purchase within lookback_days but not within the last recent_days) or "bought within the lookback" (any purchase from the window's category prefixes within lookback_days).
  • Examples: Beauty's spf_season (April-August, "bought before, not recently", 120d not-recent / 455d lookback); FMCG's cold_flu_season (October-February); both sectors' gift_season (November-December).
  • Purchase-anchored window: when a window's months are all, the calendar plays no part — the window opens off the purchase (e.g. the electronics replacement cycle, a furniture after-delivery offer). A returned item opens no such window. In a calendar window (a month list) a purchase counts as category history even if it was returned.
  • Cooldown: 75 days (Beauty) / 60 days (FMCG) — one seasonal series per season.
  • Gift-card season (every pack): when a store has its gift cards recommended (admin → Settings → Gift cards), the window gift_card_season opens in every pack, Pet included: Christmas (November–December) and Mother's Day (May). Every customer with a purchase in two years gets one of the store's gift cards in the list; cooldown 90 days, so once per window. A list never holds more than one gift card. With the setting off the window does not open (INT-287).
  • Pet pack status: stub — does not fire for Pet tenants (except the gift-card season).

Planned, no code yet

Three triggers are described in the Pet pack's triggers.yaml as placeholder concepts with no working detector (no file for them under lib/engine/triggers/, not present in the ACTIVE_DETECTORS map) — don't expect these to produce candidates today:

TriggerPlanned meaning
purchase_volume_anomalythe latest order's quantity is >2× the customer's median (e.g. stocking up, a multi-pet household)
loyalty_milestonethe customer crossed an order-count or spend milestone (e.g. 5/10/20 orders, €100/250/500)
won_back_recentas a standalone trigger; the STATE itself exists and is USED by dormant_to_clicker's case B, but there is no separate candidate detector for it

Engine-run automations (sending the email)

Automation triggers are a smaller subset (currently 5) of the detectors above that can be bound to a Smaily automation workflow — the engine enrols the contact, the workflow sends the email. The model: settings in the plugin/admin, execution in the engine, content in Smaily (authoritative code: lib/automations/catalog.ts + lib/automations/fire.ts).

One of the five, back in stock, is not fed by any of the nine nightly detectors above at all — see its own row in the table below for how it's actually detected.

Candidate freshness requirement

The nightly automation-firing run (05:15) uses ONLY candidates detected in the last 24 hours (trigger_candidates.detected_at) — a candidate from yesterday or earlier that missed its automation window is dropped from the automation path (it still reaches the recommendation path; this freshness window applies only to sending emails). Back in stock is the one exception: a dedicated cron running every 15 minutes (fire-back-in-stock) calls the same firing logic with a 30-minute freshness window instead, so that trigger's detection→send latency is ~15-30 minutes rather than up to a day.

The enrolment sequence (every candidate goes through these, in order)

  1. Fail-closed: if the tenant has no config OR enabled=false, the whole tenant is skipped (not logged per customer, for volume reasons) — a trigger you haven't enabled NEVER fires.
  2. Opted-out customer (opted_out=true) — skipped on every path.
  3. Held-out (holdout) customer (holdout_arm='holdout') — always skipped, before any other check (protects the incrementality measurement).
  4. Sync scope: the contact must have an email, be on the Smaily list (in_smaily=true) and not be unsubscribed (smaily_unsubscribed must not be true) — otherwise skipped.
  5. Complaint or recent unsubscribe (PRO-3903): a customer with any complaint in this store, at any time, never gets an engine automated email again (complaint); a customer who unsubscribed in the last 30 days is skipped even when they subscribed again since (unsub_30d). A complaint does not mark the contact unsubscribed, so the sync-scope check alone does not catch it.
  6. Test mode: if on, ONLY the test_emails addresses fire; everyone else is skipped.
  7. Cooldown: if the same customer has a pending or fired row for this trigger within cooldown_days, skipped.
  8. Engine email gap (PRO-3716): if the customer got any engine-sent automated email (any trigger) in the last 3 days, skipped (engine_email_gap). Triggers run in catalog order, so a customer due for two triggers gets only the first in one run.
  9. Mass campaign quiet (PRO-3716): if the customer got one of the store's mass campaigns in the last 24 hours, skipped (mass_campaign_quiet). The engine's own workflow send does not count as a mass campaign.
  10. Daily cap: if today's fired count for this trigger has already reached daily_cap, skipped.
  11. Workflow ACTIVE check: if the matching automation id is not in Smaily's ACTIVE list, skipped (an INACTIVE workflow still returns 101 OK from Smaily, but never sends the email — a silent trap this step avoids).
  12. Bought the product since selection (PRO-3903): for an email that names one product (replenishment due, back in stock), right before the send the engine checks whether the customer bought that product (completed/processing, total above 0) after the detector selected them (trigger_candidates.detected_at). If so, the email is not sent (bought_since_selection). In a durable-goods pack another colour or size of the same model counts too.

The admin automations daily table counts these three skips by reason (distinct customers per day).

At-most-once: a pending row is written to automation_fires BEFORE the Smaily call; if the call crashes, the pending row stays and still counts toward the cooldown — a retry never double-sends. A failed status does NOT block the next night (better a day late than never).

Also: a tenant-level freeze (contact_sync_enabled=false, e.g. during a migration freeze) excludes the whole tenant from automations — the same flag that halts the contact sync.

Configuration limits

FieldDefaultAllowed range
cooldown_days71-365
daily_capempty (unlimited)1-100,000 or empty
test_modeon (true)boolean
language_modesinglesingle (one automation) or per_language (a language map + fallback)

The five automation triggers available today

TriggerFires from candidateSectorsRecommended cooldown
Replenishment due (replenish_due)cadence_window_reacheduniversal7 days (schema default)
Win-back (winback_rescue)dormant_to_clickeruniversal30 days (matches the detector's own cooldown)
Life-stage transition (life_stage)life_stage_transition_duepet stores only365 days
Post-purchase recommendation (post_purchase)purchase_in_categoryuniversal14+ days AND a daily cap (avoids an email after every single order)
Back in stock (back_in_stock)back_in_stock — NOT one of the nine nightly detectors; detected inside catalog ingest itself (see below)universaltenant-configured (applies per customer AND product — see note below)

Four of these are essentially universal (the mechanism is sector-independent; content comes from the sector pack); the life-stage trigger is sector-restricted in code (scope: ['pet'] in lib/automations/catalog.ts), because its thresholds come from the Pet pack's triggers.yaml — another sector pack would need to define its own thresholds or leave the trigger unused.

The post-purchase email does not show a product of the order

The post-purchase email shows the contact's recommendation slots under "These go well with your order", so no slot may hold a product the customer has just bought. In a store with this email switched on (test mode included), the nightly recommendation run after the purchase leaves out every product of that order and its other variants (the same product family) — every slot, not only the cross-sell ones. The same list serves the other emails until the next run; the replenishment email takes its product from elsewhere and does not change. Right before the send the engine checks again: the email is not sent when the contact's list was not recomputed and pushed to Smaily after the purchase, when it still holds a product of the order, or when the order was cancelled since.

Each trigger's description, recipe and activation steps (test mode → going live) are in Smaily templates → Engine-run automations. If you have operator access, detailed fire/skip monitoring and debugging live in the operator runbook "Activating and monitoring automations".

Back in stock — how it's actually detected (PRO-1376)

Unlike the other four, back in stock has no nightly detector. It's event-based: every catalog ingest (the plugin's regular sync AND an admin CSV re-upload) diffs each SKU's stock status against what was stored before. A false → true flip only counts once it has stayed out of stock for at least 30 minutes (a debounce that filters out same-day drain-then-restock flicker and stale-read noise during a full re-sync) — qualifying signals accumulate in a small internal table. The nightly product list (PRO-3763) also corrects stock, but a product it finds back in stock sends no back-in-stock email: when it came back is unknown.

A dedicated cron (fire-back-in-stock, every 15 minutes) then:

  1. Builds the interest pool for that restocked SKU — v1 uses three engine-derivable signals, no storefront waitlist yet: past purchasers of the exact SKU (180-day lookback), customers who browsed that SKU while it was unavailable (30-day lookback on product_view events, where browse tracking is wired for that store), and customers who added it to a wishlist (90-day lookback on wishlist_add events; no plugin sends one today, INT-282). A customer in more than one counts as a purchase before a view and a view before a wishlist add; every send carries its source (purchase, browse, wishlist). In a durable-goods store (furniture, electronics) the pool leaves out every customer who already owns the product or another colour or size of it, also when the store sells each colour as its own product (the same model) — a sofa owner is not told the sofa is back. Earlier buyers of a product from a category that is bought again (care products and textiles in a furniture store; ink, toner, paper and cables in an electronics store) are still told. Other stores keep notifying past buyers, because there the restock is the reorder (PRO-3632). In every store the pool leaves out a customer who returned the product in the last 180 days (in a durable-goods store, also another colour or size of its model) — the same returned-item suppression the recommendations use (PRO-1610).
  2. Fires through the exact same enrolment sequence described above — holdout, sync scope, test mode, cooldown, engine email gap, mass campaign quiet, daily cap, workflow ACTIVE — with no exceptions. On top of that, the product must pass the pack's hard gates for that customer — the same ones every recommendation passes: a dog owner gets no notice for a cat product, and in a sports store a weight-loss or hormone product reaches only a buyer of that product (who may also get another size or flavour of it). A customer the gates block is skipped (product_gated, INT-176).

One real difference from the other four: the cooldown counts per customer AND product (INT-282): a customer notified about one restocked product can be notified about a different restocked product before cooldown_days has elapsed — the engine email gap (3 days between engine emails) still applies. A separate, SKU-scoped check at candidate-creation time (30-day window) additionally stops the same product re-notifying the same customer if it flaps in and out of stock repeatedly over time.

A shopper's own request (INT-282 Stage 2, contract 1.35.0 §6c) — built, not switched on yet: the engine accepts no requests today. A store's connector can send a shopper's "Notify me when it's back" request (a logged-in shopper, or a guest whose typed address belongs to a customer already subscribed to the store's email list). At the next restock the engine adds every open request for that product to the pool as a fourth source, request, ahead of the other three: a customer who asked and also bought or viewed the product gets one email, sent as the alert they asked for. A requested alert goes out once per customer and product and then the request is closed. It differs from the inferred alert in these ways:

  • it is also sent to a customer in the holdout group (both groups get it alike, so it moves no comparison) and to a customer who objected to profiling (the request is not profiling);
  • the pause between emails (cooldown_days) and the engine email gap do not apply;
  • the pack's preference gates (species, life stage, fit and size), "already owns it" and "recently returned it" do not apply; stock, "can be recommended", the customer's website and the pack's never-promote gates do;
  • a customer who bought the product after asking gets no alert, and the request is closed;
  • a purchase after the alert is never credited to the engine.

Every other rule applies, checked again at the send: a subscribed Smaily contact that never complained and did not unsubscribe in the last 30 days, test mode, the daily limit and the ramp (an alert held back by them stays open for 24 hours), and an active workflow. While the store's back-in-stock email is off, requests are kept and nothing is sent. A request that is neither sent nor cancelled closes after 90 days; a closed request is deleted 30 days later. A store on the adult-wellness pack keeps no requests.

Like the other four, this ships disabled by default — no tenant has back_in_stock enabled today; nothing fires until a merchant opts in through the same settings mechanism as any other trigger.

The same signal also feeds the recommendations (PRO-1566): since pet pack version 1.3.0 a restock candidate additionally gives that customer's nightly top-9 a slot for the exact product that came back (the mirror image of the out-of-stock substitute rule — the wanted product, not a compromise). This half needs no opt-in and sends nothing by itself: it only changes which products land in the customer's rec_1..9_* fields overnight. The two consumers do not interfere — the automation reads a 30-minute freshness window on the candidate, the nightly issuance stamps the candidate processed, and neither step affects the other.

Where to read more

Last updated: 2026-11-20