> For the complete documentation index, see [llms.txt](https://help.twinr.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.twinr.dev/website-builders/lovable/add-push-notifications.md).

# Add Push Notification Support

Ask Lovable's agent to add Twinr push notifications, and finish the setup in your dashboard.

Push notifications need two halves: your site asks the app for a device token and stores it, and Twinr sends to that token later.

## Ask the agent

With [the MCP server connected](https://help.twinr.dev/website-builders/lovable/add-mcp.md), ask Lovable:

> Add Twinr push notifications to my app. Use the Twinr MCP tools to get what you need.

The agent fetches Twinr's push guide and writes the code. You do not need to name a tool or paste any documentation.

## Answer the agent's question

It will ask who your notifications are for:

* **Everyone** — the simplest option. Every device that opens your app can receive a notification. No sign-in needed.
* **Specific people** — notifications aimed at one user. This needs sign-in and a place to store each person's device token, so the agent will add those if your project does not have them yet.

Pick the one you actually need. Per-user push is more work and the agent will build more of your app to support it.

## What the code does

The agent adds a call to `twinr_push_token_fetch()`, which asks the app for the device's push token. The call is guarded, so in an ordinary browser it does nothing and your site is unaffected.

If you chose per-user notifications, it also stores the returned token against the signed-in user, so you can send to that person later.

## Finish in the Twinr dashboard

Code alone does not switch push on. In Twinr, enable push notifications for your app — see [Push](https://help.twinr.dev/push/overview.md).

Until that is done, your site will request a token and get nothing back, which is the most common reason push "doesn't work" after the code is in place.

## Test it

1. Build your app and install it on a real device — push notifications do not work in a browser or the previewer.
2. Open the app and let it register.
3. Send a test notification from Twinr.

{% hint style="warning" %}
A device only has a token after the person allows notifications. If a test never arrives, check that the permission prompt was accepted on the device.
{% endhint %}
