> ## Documentation Index
> Fetch the complete documentation index at: https://docs.elata.bio/llms.txt
> Use this file to discover all available pages before exploring further.

# Notifications

> Show reminders to users through Elata while your app is open.

## Why your app can't notify directly

Your app runs in a sandboxed, cross-origin iframe. Browsers block the
`Notification` API there: permission is stuck at `denied` and
`requestPermission()` never prompts.

There are two supported options:

| Option | Works when | Best for |
| - | - | - |
| **Elata-brokered reminders** (this page) | Elata tab is open | "Session complete", "time for your break" |
| **Installed app** | The user installed your app to their home screen | Reminders while everything is closed |

***

## Request a reminder

```js theme={null}
window.parent?.postMessage(
  {
    type: 'elata:notify:request',
    requestId: 'optional-id',
    body: 'Focus block complete. Nice work!',
  },
  '*',
);
```

* `body` is plain text. Elata strips control characters, collapses it to one line, and cuts it to **140 characters**.
* You can't set the title, icon, click URL, or actions. Elata sets them.

Elata replies with `{ type: 'elata:notify:state', requestId?, status }`:

| status | Meaning | Suggested UI |
| - | - | - |
| `shown` | A notification was shown | Show reminders as on |
| `undecided` | The user hasn't opted in yet; Elata is showing an "Allow reminders?" prompt | A neutral, pending state |
| `blocked` | The user opted out, or the OS denied permission | Stop asking; suggest installing the app |
| `rate_limited` | More than 3 requests in a minute | Back off |
| `unsupported` | This browser has no Notification API | Hide the setting |

***

## What Elata guarantees

* **Elata-authored title.** Always `Elata · <your app name>`, taken from your Elata listing, so apps can't impersonate the OS, Elata, or each other.
* **Per-app opt-in.** Off by default. The first request shows an in-frame prompt, and the choice is remembered per app.
* **Rate limit.** At most 3 reminders per app per minute.
* **Foreground only.** Reminders appear only while Elata tab is open. Clicking one focuses Elata.

***

## Detecting Elata

Use the bridge only when running inside Elata, and keep your direct path
for standalone or installed use:

```js theme={null}
const inStore = window.parent !== window;
if (inStore) {
  window.parent.postMessage({ type: 'elata:notify:request', body }, '*');
} else if (Notification.permission === 'granted') {
  new Notification('My App', { body });
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.