emitNotification — with the event key of a notification type and a target (who should receive it). Archie does the rest: it resolves the recipients, checks their preferences, renders the templates, and delivers on each channel.
You describe intent (“notify these users that their build failed”); you never build per-recipient rows yourself.
Endpoint
The input at a glance
Choosing a target
A target is exactly one of:userIds— an explicit list of user ids. Use this for transactional notifications (“notify this user”).audience— a named group:SUBSCRIBERS— everyone whose preference for this type is enabled (respecting per-user opt-in).ALL_PROJECT_USERS— every user in the project (use sparingly; respects mandatory and anomaly rules).
Examples
Notify specific users
Notify everyone subscribed to a type
accepted: true means the request was queued. recipientCount is therefore null and a fanoutJobId is returned that identifies the broadcast.
Make a send idempotent
If your service might retry, pass a stablededupKey. The same key is never delivered twice:
Understanding the result
EmitNotificationResult tells you what happened synchronously:
When a send is rejected
Ifaccepted is false, check rejectedReason. Common reasons:
A rejection is a normal, expected response (the mutation still returns
200); it is not a server error.Large broadcasts
To protect your users from accidental mass-sends, an audience broadcast that resolves to an unusually large number of recipients is held unless you explicitly confirm it. If you intend to reach a very large audience, setbroadcastConfirm: true: