# Priority and quiet hours

> Your agent says how urgent a Message is; the person decides when their phone may ring.

Whether a phone rings is decided by two people. Your agent says how urgent a Message is; the person says when they do not want to be disturbed. Neither decides whether the Message is kept: it always lands in the Inbox.

## The sender decides the priority

Every Request and every Notification takes a `priority`:

- `low`: no push at all. The Message waits in the Inbox.
- `normal`, the default: a standard push.
- `high`: a push that may ring through quiet hours, if the person allows it.

Once the invoice is filed, `invoice-flow` has nothing urgent to say, so it says it at `low`:

TypeScript:

```ts
import { Card, Column, Nibify, Text } from '@nibify/sdk';

const nibify = new Nibify({ apiKey: 'sk_test_…' });

const surface = {
  root: 'root',
  dataModel: {},
  components: [
    Card('root', { child: 'body' }),
    Column('body', { children: ['title', 'text'] }),
    Text('title', { text: 'Kiwi Studio invoice filed', variant: 'h4' }),
    Text('text', { text: '$1,420, consulting, due Oct 30.' }),
  ],
};

await nibify.notify({
  sender: { name: 'invoice-flow' },
  notification: {
    title: 'Kiwi Studio invoice filed',
    body: '$1,420, consulting, due Oct 30.',
  },
  priority: 'low',
  surface,
});
```

curl:

```bash
curl -X POST https://api.nibify.app/v1/notifications \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{
    "sender": { "name": "invoice-flow" },
    "notification": {
      "title": "Kiwi Studio invoice filed",
      "body": "$1,420, consulting, due Oct 30."
    },
    "surface": {
      "root": "root",
      "dataModel": {},
      "components": [
        { "id": "root", "component": "Card", "child": "body" },
        {
          "id": "body",
          "component": "Column",
          "children": ["title", "text"]
        },
        {
          "id": "title",
          "component": "Text",
          "text": "Kiwi Studio invoice filed",
          "variant": "h4"
        },
        {
          "id": "text",
          "component": "Text",
          "text": "$1,420, consulting, due Oct 30."
        }
      ]
    },
    "priority": "low"
  }'
```

The person finds it the next time they open the app. Keep `high` for what cannot wait until morning.

## The person decides the quiet hours

In the Nibify app the person sets a daily window, such as 22:00 to 07:00, in their own time zone. Inside it, `low` and `normal` do not ring: the Message still arrives, silently.

Whether `high` rings inside the window is the person's switch, on unless they turn it off. Your agent says a Message is urgent; the person decides whether urgent may wake them.

Quiet hours belong to the person, not to a Project: they hold for every agent that writes to them.

## Who wins

- `low` never rings.
- `normal` rings, except inside quiet hours.
- `high` rings, and inside quiet hours only if the person allows it.

Your agent is never told whether the phone rang: that would tell it when somebody sleeps. A `201` means the Message is stored and on its way.

A nudge follows the same rules, with the priority the Request was sent with: a `normal` Request nudged at three in the morning does not ring.

## A ceiling on the noise

An agent stuck in a loop could ring a phone twenty times a minute. If the person's phone rang a moment ago, Nibify keeps the next push silent, whichever agent sends it. Every Message is still stored and listed in the Inbox: only the ringing is held back.

## Next

- [Surfaces](https://nibify.app/docs/surfaces): The UI a Request carries: components, a data model, and the actions that send values back.
- [Environments](https://nibify.app/docs/environments): Every Project has a test half and a live half, and the prefix of the API key says which one you are in.
