On this page
Send a notification
Declare channels, send messages and connect recipients.
Let your site admins receive order updates, stock alerts, booking requests, and other important events by email or Telegram. Define the channels in FRL; Frontbacked gives each channel a place in Notifications where admins connect and verify recipients.
Define channels
Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →
Use a stable key such as orders to identify a channel. The as label appears in the admin dashboard. Consecutive // comments or a /* block comment */ immediately above the declaration become its description, just like rateLimit. A blank line separates unrelated comments. Write these descriptions for the site admin so they can choose the right recipients.
Labels and descriptions can change without disconnecting recipients. The key must follow FRL identifier rules, and each key can be declared only once. Notifications require version 2;. The system namespace is reserved: themes cannot declare system.messages, system.new_messages, or other system channel keys. The aliases New message and New messages are also reserved, ignoring capitalization and extra whitespace. Built-in channels carry a gold ★ System badge in the dashboard; theme declarations do not.
Send a notification
Call notification.send(channelKeys, message) in an after hook, payment event, or endpoint body. For endpoints with dedupe, place the call after dedupe.
Rule input (JSON)
Use a complete version 2 rule file. Select a post with “postType” and “action”, or an “endpoint” by name. Saved data, jobs, payments and email need the local server. Dedupe replay protection also needs a site.
Check complete rules or run schemas, permissions, hooks and calculations against the input above. Add excerpts to a complete rule before running.
To reach multiple channels, pass an array such as ["orders", "inventory"]. A recipient connected to both channels receives one copy of that notification. Only active, verified recipients receive messages.
| Argument | Requirements |
|---|---|
| Channel keys | An array of 1–20 declared keys. Repeated keys are combined. |
title | Required text, up to 200 characters. |
message | Required text, up to 3,000 characters. |
url | Optional path on the current site, starting with /, up to 1,000 characters. External URLs are not accepted. |
The combined title, message, and URL may contain at most 3,700 characters. Message text is treated as plain text; you do not need to escape email HTML or Telegram formatting.
The method returns { ok: true, queued: true }. This means the notification is scheduled when the surrounding operation is accepted; it does not mean a recipient has already received it. With no active recipients, there is nothing to deliver.
Use declared helper functions to reuse notification messages. They inherit the calling phase: a helper called from an after hook may send notifications, but one called from a permission check or before hook may not. Place notification.send outside atomic blocks, after the related changes. A failed endpoint transaction does not deliver its queued notifications. Use endpoint dedupe for actions that may be repeated by the caller.
Continue with Connect notification recipients.