Notifications
On this page
Clara tells people about a board in two ways (SPEC D14): webhooks, which post to a chat or any
address the board names, and browser notifications, which the page clara serve opens shows
while its tab is hidden. Neither sends anything anywhere else, and neither is on until a
person turns it on.
Webhooks
A board lists its webhooks in .clara/config.json, under notify:
{
"notify": [
{ "on": ["blocked", "in_review", "run_failed"], "webhook": "env:SLACK_WEBHOOK", "format": "slack" },
{ "on": ["mentioned"], "webhook": "env:DISCORD_WEBHOOK", "format": "discord" },
{ "on": ["done"], "webhook": "env:TELEGRAM_WEBHOOK", "format": "telegram" }
]
}
on lists what a target is sent: an event's kind, a status a ticket moves into, run_failed
or mentioned. FORMAT.md lists every name. clara doctor warns about a
name that matches nothing, with the one most likely meant.
When a message is sent
After a change is committed, by a command, by a change made on the page clara serve serves,
or by an agent through clara mcp, each target whose on covers one of the change's events
is sent one message. A change of many events, such as clara plan apply, is still one message
per target: it lists the first 20 events and says how many more there were.
Sending never holds up or fails the change. It starts once the change is saved, gives up after
5 seconds, and a problem is one warning line: in a terminal after the command's output, and
once per problem from clara serve or clara mcp, however many changes meet it. The hosted
board (HOSTED.md) sends nothing.
Trust
A webhook carries what tickets say to an address the repository names, so the board's
webhooks are trusted like its checks (D8): nothing is sent until a person on this machine has
read them with clara trust and said yes with clara trust --yes. Until then each change
that would send says so in a warning. Changing a webhook in any way, its address, format or
names, asks again. A webhook written as an address is listed by its host and a digest of the
address, never the address itself.
Keep the address secret
A webhook's address is usually its secret: anyone who has it can post to the chat. Write
env:NAME instead of the address, and set NAME in the environment of whoever runs Clara;
the board then holds only the variable's name. The variable is read when each message is
sent, and one that is not set is a warning, not an error.
Clara never prints a webhook's address: a warning names it by its scheme and host, such as
https://hooks.slack.com/…, or by its variable. An address must be https://, or http://
to this machine, with no user name or password in it. Clara follows no redirect.
Formats
format |
Body posted as JSON |
|---|---|
json |
{ "board": { "key", "name" }, "events": [...] }: the events as clara log --json gives them |
slack |
{ "text", "mrkdwn": true, "unfurl_links": false, "unfurl_media": false }, for an incoming webhook |
discord |
{ "content", "allowed_mentions": { "parse": [] }, "flags": 4 }, for a channel webhook |
telegram |
{ "chat_id", "text", "link_preview_options": { "is_disabled": true } }, for the Bot API's sendMessage |
A chat's message starts with the board's name and key, then a line for each event, such as
APP-3 agent:claude blocked: "Which bank does the refund go to?". Everything from the board is
escaped for that chat, so a title can neither mention anyone nor add a link, and no link shows
a preview. A Discord message is cut at 2000 characters, a Telegram one at 4096.
Telegram
Telegram has no webhook of its own: Clara calls the bot's sendMessage. Make a bot with
@BotFather, add it to the chat, and use this address, with the bot's token and the chat's id:
https://api.telegram.org/bot<token>/sendMessage?chat_id=<chat id>
The token lets anyone send as the bot, so keep the address in the environment:
export TELEGRAM_WEBHOOK='https://api.telegram.org/bot<token>/sendMessage?chat_id=<chat id>'
and write "webhook": "env:TELEGRAM_WEBHOOK". Clara sends the text as plain text, so nothing
in a title is read as markup.
Trying one
clara notify test sends each webhook a message saying it is a test, and says for each
whether it was taken. --target 2 tests only the second. It asks for trust first, as
clara verify does, and exits 1 when any webhook did not take the message.
Browser notifications
The page clara serve opens can show a notification while its tab is hidden, when something
waits on the person looking at it: a ticket blocked on a question, work handed in for review
when people review (review.mode is human), or a comment that mentions them. Clicking one
opens the ticket.
Turn them on in Settings, under "Browser notifications". The browser asks for permission only
then. The choice is kept in this browser's storage, not in the board, so it is each person's
own and changes nothing in the repository. The page reads the board's live events from the
server that served it, and the notification is the browser's own, so nothing leaves the
machine. A browser shows them only over https or from 127.0.0.1 or localhost, which is
where clara serve listens; a board exported with clara export --static has none.