Reference
Notifications
Every AALY project can send email, Slack, WhatsApp and in-app messages through one API, and keeps a durable record of each send. Email works with no configuration at all. The same layer sends the verification and password-reset emails described in Authentication.
Three entities carry it:
| Entity | What it holds |
|---|---|
notification_channels | How to deliver: the transport and sender identity |
notification_templates | What to say: a Mustache subject and body |
notifications | The send itself, and its delivery record |
Channels and templates are configuration you set once per project, with MCP
tools. notifications is data your app or a function writes at runtime over
ordinary REST.
The shortest path
Email needs nothing configured. The platform has its own verified sender and ships the auth templates in code:
POST /<your-slug>/<project>/notifications
Authorization: Bearer <token>
{
"template": "auth.password_changed",
"toUser": { "id": "USR5" },
"data": { "name": "Ada", "appName": "Acme" }
}
The response is the delivery record, with status: "sent" and a sentAt.
How a send resolves
A channel and a template are resolved separately, so a tenant can restyle a message while still sending through the project's identity.
channel tenant row -> project row -> platform email (email only)
template tenant row -> project row -> shipped in code (every channel)
The platform fallback covers email. Slack and WhatsApp send from your own
workspace and your own Meta phone number, so set up that channel first; until
then a send returns NO_CHANNEL_CONFIGURED.
Channels
One channel per type, set with set_notification_channel.
provider | Channel | Credential |
|---|---|---|
ses | none. Sends as AALY's own sender only | |
smtp | SMTP password | |
slack | Slack | bot token |
whatsapp_cloud | Meta access token | |
internal | in-app | none. The record is the delivery |
A channel stores the name of a secret, never the credential. You add the
value in the dashboard through the link set_secret returns, so it stays out
of your agent's context.
How do I send email from my own domain?
Use smtp. The ses provider sends through AALY's own sender at aaly.io.
With smtp, verification, password reset and the password-changed
notice all send from your address, because the auth flows use whatever channel
resolves.
The SMTP username is the login name, which is often not the sender address.
Leave it out and it defaults to fromAddress, which suits Google Workspace and
Microsoft 365. Most email providers need it set: SendGrid uses the literal
apikey, Postmark a server token, Mailgun postmaster@mg.yourdomain.com.
Set SPF and DKIM on your domain so your mail reaches the inbox.
Templates
Mustache, rendered against the data on each send. {{value}} is
HTML-escaped and {{{value}}} is raw. A missing key renders empty and the
send goes ahead. Templates are per key and channel type, so one key can carry
a full HTML email and a one-line Slack message.
Anything that must not be stored, such as a one-time code or an invite link,
goes in secretData instead of data. It renders the same way but is never
saved, never returned, and is redacted from request logs.
For WhatsApp, Meta delivers pre-approved templates for a message a business starts, so a WhatsApp template names your approved Meta template and its ordered placeholders.
Recipients
Pass exactly one of toUser or to. toUser reads the address from the user
record (email, phone, or the user itself for in-app). to takes a literal
address, for an invitation or a one-off alert. Slack uses to, usually a
channel such as #alerts.
In-app inbox
An in-app notification makes no external call, so the same entity backs an inbox:
GET /notifications?toUser=USR5&read=false # the unread list
GET /notifications?read=false&facets=read # the unread count
PATCH /notifications/NTF7 { "read": true } # mark read
read is the only field a client may change.
Delivery outcomes
Every send is recorded with its outcome. A delivery that didn't go through
still gets a normal "created" reply, with status: "failed" and an error code, so check status
rather than relying on the reply alone, and re-send when you're ready. Review them with
?status=failed. Pass an idempotencyKey to make a
send safe to retry: a second POST with the same key answers "that already exists" instead of
delivering twice. A JSON array on POST /notifications sends up to 100 in one
request.
Sample data and test addresses
AALY's own email channel records mail to domains reserved for testing
(example.com, example.org, example.net, and addresses ending in .test,
.example, .invalid or .localhost) as sent without delivering it, so
your flows and checks behave normally and no mail leaves. That's why test
users in a project's test tenant use addresses such as member1@example.com.
When your Functions send through your own SMTP, Slack or WhatsApp channel,
have them write an in-app notification in the test tenant instead, for
example by comparing req.tenant_id with a TEST_TENANT_ID variable.
To notify people when something happens, such as "notify when an order is
created", your app or an after-request Function writes to
/notifications.