What it is for
This page explains, for technical readers and curious operators, what happens between “a coupon was redeemed” and “an email left”. It replaces the old “Notifications (OneSignal)” introduction of Documentation, which described a dispatcher that no longer sends anything.From the business fact to the provider: occurrence, decisions, queue, lane and provider.
The pieces
notify(): one door for every producer
A producer (the Club, payments, onboarding, a cron) never chooses a channel, a template or a text. It only says which event happened and passes its data:The event registry
Events are declared in the code, one file per domain, and copied to the catalog by a migration. The catalog can switch an event or a channel on and off and adjust its rules; it cannot create events or change their data.What happens on each call
- Event. The key is looked up in the registry and the catalog. An unknown key is a programming error.
- Data. The data is checked against the schema. Invalid data leaves the occurrence Rejected with the reason Invalid data, and nothing is sent.
- Occurrence. The occurrence is recorded once per event and idempotency key. Calling again with the same key returns the first occurrence and sends nothing new.
- Event active. An event turned off or deprecated skips every channel (Event inactive).
- Recipients. The audience is resolved into people or addresses. None: No recipient.
- Language and timezone of each recipient, from their account.
- Each channel and recipient, in this order, where the first failure decides: channel on, published template, translation (Spanish if the language is missing), render, address, suppression, preference, frequency cap, quiet hours, delay. If everything passes, the send is written and queued (or scheduled).
- Fallback. A channel declared as fallback of another runs only when that one was skipped or suppressed, or later fails at delivery.
- Close. The occurrence ends Completed or No send, and later moves with its sends’ delivery.
Why it works this way
What changed from the old design
The old dispatcher file still exists as a thin wrapper over the core and no production code calls it. Old-shape
queue messages are still translated for one more release.