> 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/replit/add-push-notifications.md). Agents can also search and read this documentation through its [MCP server](https://help.twinr.dev/~gitbook/mcp).

# Add Push Notification Support

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

Push notifications need two halves: your app asks Twinr 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/replit/add-mcp.md), ask Replit:

> 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.

## Answer the agent's question

It will ask who your notifications are for:

* **Everyone** — 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 somewhere to store each person's device token, so the agent will add those if your project lacks them.

## 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 stores the 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. Enable push notifications for your app in Twinr — see [Push](https://help.twinr.dev/push/overview.md).

Until that is done your app requests a token and gets nothing back, which is the usual reason push appears not to work after the code is in place.

## Test it

1. Build your app and install it on a real device — push does 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 once the person allows notifications. If tests never arrive, check the permission prompt was accepted on the device.
{% endhint %}
