# Add Push Notifications to a React Native App

Yes. An agent adds Expo push notifications to your Expo Router app: permission flow, token registration with your API, tap handling and tests, in a pull request.

[Run this on Rush](https://cloud.getrush.ai/run/add-push-notifications/react-native/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The run starts with the Linear issue after the prompt and the repository cloned into its own cloud sandbox. In an Expo app like obytes/react-native-template-obytes, `package.json` declares `packageManager` `pnpm@10.12.3`, `expo ~54.0.32`, `react-native 0.81.5`, `expo-router ~6.0.22`, `expo-constants`, `expo-dev-client` and `expo-splash-screen`, and nothing named `expo-notifications` or `expo-device`. `app.config.ts` builds the `ExpoConfig` from `env.ts`, which maps each `EXPO_PUBLIC_APP_ENV` to its own bundle id (`com.obytes.development`, `com.obytes.preview`, `com.obytes`) and scheme, lists plugins for `expo-splash-screen`, `expo-font`, `expo-localization`, `expo-router`, `app-icon-badge` and `react-native-edge-to-edge`, sets `newArchEnabled: true` and carries the EAS project id under `extra.eas.projectId`. `eas.json` defines `production`, `preview`, `development` and `simulator` build profiles.

The app's structure decides where the pieces go. `src/app/_layout.tsx` wraps a root `Stack` with `(app)`, `onboarding` and `login` screens in `GestureHandlerRootView`, `KeyboardProvider`, `ThemeProvider`, `APIProvider`, `BottomSheetModalProvider` and a `FlashMessage`, calls `hydrateAuth()` at module load and hides the splash screen on first layout. `src/app/(app)/_layout.tsx` renders the `Tabs` for `index`, `style` and `settings` and redirects to `/onboarding` or `/login` from `useIsFirstTime` and the auth store's `status`. `src/lib/storage.tsx` wraps MMKV in `getItem`, `setItem` and `removeItem`; `src/lib/auth/utils.tsx` stores the access and refresh tokens the same way; `src/lib/api/client.tsx` is an axios instance on `EXPO_PUBLIC_API_URL`; `src/features/settings/settings-screen.tsx` lays out `SettingsContainer` groups with `LanguageItem` and `ThemeItem`; strings live in `src/translations/en.json` and `ar.json`, and `pnpm run lint:translations` checks the two files agree.

The agent runs `pnpm expo install expo-notifications expo-device` so the versions match SDK 54, adds the `expo-notifications` config plugin to `app.config.ts` with the notification icon and colour, and writes `src/lib/notifications/`: a `registerForPushNotifications` function that returns early when `Device.isDevice` is false, calls `getPermissionsAsync` then `requestPermissionsAsync`, creates the default Android channel with `setNotificationChannelAsync`, reads the project id from `Constants.expoConfig?.extra?.eas?.projectId`, calls `getExpoPushTokenAsync`, and posts the token to a devices endpoint through the shared axios `client`, keeping the last token in MMKV so the request repeats only when the token changes. `setNotificationHandler` shows foreground notifications, and a `useNotificationObserver` hook in `src/app/_layout.tsx` reads the last notification response and calls `router.push` with the `url` in its data, so a tap opens the screen the server named. Registration runs from `(app)/_layout.tsx` once `status` is `signIn`, and sign-out removes the stored token.

A `NotificationsItem` with a switch joins the settings screen, with keys added to both `en.json` and `ar.json`. Tests follow `jest.config.js`, which uses the `jest-expo` preset, `jest-setup.ts` and the `@/` alias: a mock for `expo-notifications` under `__mocks__`, and cases for the denied-permission path, the simulator path, and posting the token once. The agent runs `pnpm run check-all`, which chains `lint`, `type-check`, `lint:translations` and `test`, and `pnpm doctor` for `expo-doctor`. Delivering a real push needs an FCM key and an APNs key uploaded with `eas credentials` and a physical device, so the pull request lists those steps rather than claiming them.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Add push notifications to this Expo app and open a pull request. Read package.json, app.config.ts, env.ts, eas.json, src/app/_layout.tsx, src/app/(app)/_layout.tsx, src/lib/storage.tsx, src/lib/auth/utils.tsx, src/lib/api/client.tsx, src/features/settings/settings-screen.tsx, src/translations/en.json, src/translations/ar.json, jest.config.js and jest-setup.ts first. Install expo-notifications and expo-device with pnpm expo install and add the config plugin. Write a notifications module that skips simulators, requests permission, creates the Android channel, gets the Expo push token with the EAS project id from app config, posts it to the API through the existing axios client and stores the last token in MMKV so it is sent only when it changes. Handle foreground display and open the route named in a tapped notification's data with expo-router. Register after sign-in and clear the token on sign-out. Add a notifications switch to the settings screen with strings in both translation files. Add Jest tests with a mock for expo-notifications. Run pnpm run check-all and pnpm doctor and put the output in the pull request description. List the EAS credential steps a person must do for delivery.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a pull request on its own branch. The diff changes `package.json` and `pnpm-lock.yaml`, adds the plugin to `app.config.ts`, adds `src/lib/notifications/` with its tests and the `expo-notifications` mock, edits `src/app/_layout.tsx`, `src/app/(app)/_layout.tsx` and the auth store's sign-out, adds the settings item, and extends both translation files. The description names the devices endpoint it posts to so the API side can be matched.

The repository's own workflows run on the pull request: `test.yml` posts the Jest coverage comment, and `lint-ts.yml`, `type-check.yml` and `expo-doctor.yml` report in the checks list. The run's record keeps the `pnpm run check-all` output from the sandbox, so a reviewer can see the same four steps pass before the workflows start.

Before merging, a reviewer checks that the Android channel importance fits the app, that the token is posted with the user's auth header and removed on sign-out, that `aps-environment` lands in the iOS entitlements at prebuild, and that the FCM and APNs credentials are uploaded before a build goes to testers.

## Run it on every Linear issue labelled agent

In the console, add an automation to the Project with this prompt and a `linear` trigger on `linear.issue.labeled`, filtered to the label your team uses for agent work. Each labelled issue starts one run with the issue's title and description after the prompt, so a follow-up issue that asks for a second channel or a badge count becomes its own pull request linked back to the issue. `max_runs_per_hour` caps an issue that keeps firing.

From your own server, the same work is one `POST /o/{org}/sessions` per issue, with the repository in `resources` and the issue text in `input`; the key's `webhook_url` posts `run.completed` with `data.session_url` for the pull request link.

## Why run it on Rush?

Notifications cross the config plugin, the native permission flow, the router, the API client, storage, settings and two translation files, and the usual outcome of doing it quickly is a token posted on every launch or a tap that opens the wrong screen. In a Rush sandbox the agent installs the exact pnpm from `packageManager`, runs `expo install` so native module versions match the SDK, and executes the lint, type check, translation check and tests before it pushes.

The parts that need a device and store credentials are separated from the parts that do not, and the pull request says which is which. The same prompt runs across several Expo apps at once, each in its own sandbox reading its own `app.config.ts`, and each opens its own pull request with its own check output.

## Frequently asked questions

### Does it work on a simulator?

The module returns early when `Device.isDevice` is false, so the simulator build from `eas.json` runs without asking for permission or a token. Jest covers that path with the `expo-notifications` mock, and the `simulator` profile keeps working for the Maestro flows under `.maestro/`.

### Do I need Firebase?

For Android delivery through Expo's push service, yes: an FCM server key uploaded with `eas credentials`. iOS needs an APNs key uploaded the same way. The code does not change for either; the pull request lists the two uploads as steps a person does once per EAS project.

### Will it change my EAS build profiles?

No. `eas.json` stays as it is. The config plugin is added to `app.config.ts`, so the next `prebuild` for any profile writes the Android channel resources and the iOS entitlement, and `app-icon-badge` and the other plugins keep their order.

### What about the web target?

`react-native-web` is in the dependency list, and `expo-notifications` does not deliver pushes on web. The module checks `Platform.OS` and does nothing there, so `expo start --web` still loads, and the settings switch is hidden on web.

## More React Native jobs

- [Store Auth Tokens in Secure Storage in a React Native App](https://getrush.ai/run/add-secure-storage/react-native/)
- [Investigate a Crash Spike in a React Native App](https://getrush.ai/run/investigate-crash-spike/react-native/)
- [Review Pull Requests on a React Native App](https://getrush.ai/run/review-pull-requests/react-native/)

## The same job on other stacks

- [Add Push Notifications to an Expo App from a Linear Issue](https://getrush.ai/run/add-push-notifications/expo/)

## More jobs like this: Turn a Linear label into a PR

- [Add PWA Support to a Nuxt App](https://getrush.ai/run/add-pwa-support/nuxt/)
- [Add Query Depth Limits to a GraphQL API](https://getrush.ai/run/add-query-depth-limit/graphql/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
