Skip to content

Notifications

Felix can wake a signed-in person’s phone or computer when a run on one of their conversations, or a workflow run they started, is waiting on them, even with the web app closed. It uses Web Push: the browser’s own push service (Google, Mozilla, Apple or Microsoft) carries an encrypted message to the device, and the app’s service worker shows it. There is no email or messaging delivery, and nothing is sent to shared destinations. For other systems, a scheduled or triggered run can post a signed run.finished to a webhook when it ends; see The run.finished webhook.

A push goes to the browsers the conversation’s owner, or the workflow run’s starter, turned notifications on in, and to no one else, at four moments, and when an agent sends a notice (see Notices from an agent):

When Title Body
A call in the conversation waits on an approval Waiting on your approval tool needs a decision.
The agent asks a question (ask_user) Felix is asking you something Open the conversation to answer it.
A workflow approval step waits, in a run you started A workflow is waiting on your approval Open the run to approve or reject it.
A run started in the background (background: true) finishes or fails The conversation’s title Finished. or Failed: reason

Tapping the notification opens that conversation, or for a workflow the run’s view (/workflows?workflow=<id>&view=run&run=<run>), in a window the app already has open when there is one.

An approval step pushes once, when it opens its approval. A step that is retried and finds the approval it already opened sends nothing more. The push names the workflow by its id and nothing else from the run: never the step’s prompt, payload or inputs. A run started with the API token has no one to tell, and the admins who may also decide the approval are not pushed to.

Each person can turn workflow approval notifications off, for all their devices at once; they are on until they do. Conversation approvals and questions are not affected.

A push for a wait never carries the call’s arguments, the question, the approval rule’s reason or any message: it may show on a lock screen. The one thing taken from the run is the tool’s name, which an approval needs to be told apart and which the deployment’s own configuration chose; a name with anything but letters, digits and _ . : - is shown as “A tool call”. The payload is still encrypted end to end to the browser, so the push service relays ciphertext.

Only signed-in people have notifications. A conversation or workflow run started with the API token has no owner, so nothing is pushed for it. A finished or failed run sends no notification of its own unless it was started in the background.

A client that starts a run with background: true (the web app’s Run in background) does not follow it, so the conversation’s owner is pushed once when it ends: Finished. when it completes or reaches its turn limit, or Failed: with a fixed reason (an error ended the run or it ran past its time limit), never the error’s own text. The title is the conversation’s title, up to 80 characters, so it shows on a lock screen. Each run’s notification stands alone: a second run on the same conversation does not replace the first. A run stopped with the stop route sends nothing. There is no preference for it: asking for a background run is the choice.

An agent can send its own short notice with the notify tool: a title of up to 80 characters and a message of up to 500, written by the agent, for something the person would want to know without opening Felix, such as a scheduled job’s result. It is off unless you turn it on for an agent:

  • notify is offered only to an agent whose own Tools list names it. An agent that lists no tools gets every other tool, but not this one, and no deployment default includes it. Admins can still turn it off for every agent.
  • It needs web push on this deployment, and a conversation a signed-in person owns. The notice goes to that person’s browsers and no one else’s; the agent cannot choose who receives it.
  • Before it is sent, the deployment’s own secret values (every setting whose name contains TOKEN, SECRET, KEY, PASSWORD or PRIVATE) and strings shaped like common credentials are replaced with [REDACTED], and every link, including obfuscated ones such as evil[.]com or hxxp://, is replaced with [link removed]. The agent is told what was sent when this changed it.
  • A run may send at most 3 notices, and an agent at most 10 an hour to one person. A notice past either limit is refused, and the agent is told why.
  • Each notice sent is recorded in the audit log as notice_sent, with the conversation, the agent, the person and how many browsers took it; never its text.

A notice is kept by the push service for up to 12 hours for a device that is offline, and is sent at normal urgency rather than waking the device as a wait does. Tapping it opens the conversation.

A push is sent beside the run, never in its way: the run does not wait for it, and a push that fails is logged with the push service’s host and status (never the subscription’s address) and dropped. A browser the push service says is gone (404 or 410) is forgotten at once, and one that fails five sends in a row is forgotten too.

Notifications are off unless all three settings are set. Set them on the API Worker:

Setting What it is
FELIX_PUSH_VAPID_PUBLIC_KEY The VAPID public key: base64url of the uncompressed P-256 point (87 characters). Browsers subscribe with it.
FELIX_PUSH_VAPID_PRIVATE_KEY The matching private key: base64url of its 32 bytes (43 characters). A secret: set it with wrangler secret put.
FELIX_PUSH_SUBJECT How a push service can reach whoever runs this deployment: a mailto: or https: URL.

Push also needs sign-in (see Sign-in and sessions) and hosted threads. GET /health reports push: true where it is on. A setting that is missing or does not parse leaves push off, and the Worker logs why once (never the key).

Any VAPID key generator works. With Node.js and nothing to install:

node -e "(async () => {
const { subtle } = globalThis.crypto;
const pair = await subtle.generateKey({ name: 'ECDSA', namedCurve: 'P-256' }, true, ['sign']);
const raw = Buffer.from(await subtle.exportKey('raw', pair.publicKey));
const { d } = await subtle.exportKey('jwk', pair.privateKey);
console.log('FELIX_PUSH_VAPID_PUBLIC_KEY=' + raw.toString('base64url'));
console.log('FELIX_PUSH_VAPID_PRIVATE_KEY=' + d);
})()"

Then set them, for example:

wrangler secret put FELIX_PUSH_VAPID_PRIVATE_KEY
wrangler secret put FELIX_PUSH_VAPID_PUBLIC_KEY
wrangler secret put FELIX_PUSH_SUBJECT # mailto:ops@example.com

For local development, put them in apps/api/.dev.vars.

The web app is installable: it has a manifest and icons, so a browser can add it to the Home Screen or install it as an app, and it then opens full screen. On a phone or tablet, a conversation shows a one-line suggestion to install it, once; on iPhone and iPad it says where Add to Home Screen is, since Safari delivers notifications only to an installed web app.

Where /health reports push, a signed-in person turns notifications on for the device they are using:

  • in the account menu (their name in the header): Notifications on this device, Turn on and Turn off;
  • in the installed app, from a line above the composer.

Once notifications are on for the device, the account menu also shows Notify me about workflow approvals. It is the person’s choice for every device they use, and is shown only on a device that takes notifications.

The browser asks for permission only after that click. Signing out turns notifications off for that device, so the next person to sign in there does not get them. Nothing is offered where push is off, in a browser that cannot subscribe, or with the API token.

The service worker shows notifications and keeps the app’s own page and its built files, so an installed app opened offline shows its shell instead of the browser’s error page. It never stores or answers API requests. It is registered in a production build only.

/v1/push/subscriptions belongs to the signed-in person:

  • GET answers the deployment’s public key and the person’s subscriptions, each with its push service’s host and times, never its address or keys.
  • POST takes the browser’s PushSubscription.toJSON(). Sending the same browser again refreshes it. The address must be on a browser’s push service. A person keeps at most 10; a new one past that replaces the one heard from least recently.
  • DELETE takes { "endpoint": … } or { "id": … }.

/v1/push/preferences is the signed-in person’s choice of what to hear about:

  • GET answers { "workflowApprovals": true } until they choose.
  • PUT takes exactly { "workflowApprovals": false } (or true) and answers what is stored. Anything else is refused with 400 invalid_push_preferences.

The API token is refused with 400 push_needs_a_person; where push is off the routes answer 503 push_not_configured. Subscribing and unsubscribing are recorded in the audit log as push_subscribed and push_unsubscribed, with ids only; a changed preference as push_preferences_changed, with the names of the fields that changed and never their values. See the REST API for the rest of the API.