# Push Data & Taps

Handle push notification taps (cold starts included) and deep-link with the url key in your pushData object.

Every push notification you send through Native Notify can carry a **pushData** object. When a user taps the notification, that object is delivered to your app — the usual pattern is to put a `url` (or a screen name) inside it and navigate when the tap arrives.

## Sending a pushData object

Include `pushData` in your API call (or in the send form in your [NativeNotify.com dashboard](https://app.nativenotify.com)):

```bash
{
    appId: app-id-number,
    appToken: "your-app-token",
    title: "Your order shipped",
    body: "Tap to track your package",
    dateSent: "put your date here as a string",
    pushData: { url: "/orders/12345" }
}
```

## Handle taps — cold starts included

Use the `useNativeNotifyPress<T>()` hook. It returns the pushData of the last tapped notification, and it handles both cases:

- the tap that **launched a cold app** — the raw expo-notifications response listener does not fire for it, because the response happened before your listener subscribed — and
- taps that arrive while the app is running.

```jsx
import { useEffect } from 'react';
import { useNativeNotifyPress } from 'native-notify';

export default function App() {
  const { data } = useNativeNotifyPress<{ url?: string }>();

  useEffect(() => {
    if (data?.url) {
      router.push(data.url); // Expo Router — or navigation.navigate(...)
    }
  }, [data]);

  return ( ... );
}
```

`useNativeNotifyPress` also returns the full expo-notifications response as `notification` when you need the title, body, or date:

```jsx
const { data, notification } = useNativeNotifyPress<{ orderId?: string }>();
```

`getPushDataObject()` is a drop-in wrapper that returns just the data — handy if you only need the values.

## Deep linking with the url key

Convention: put a `url` key inside `pushData`, then hand it to your router when the tap arrives:

- **Expo Router:** `router.push(data.url)` — works with nested segments and typed routes.
- **React Navigation:** pass the url through your [linking configuration](https://reactnavigation.org/docs/deep-linking/), or fall back to `Linking.openURL(data.url)`.

The prebuilt [Notification Inbox](/docs/indie-notification-inbox/components) rows carry their `pushData` too, so the same convention works with the inbox's `onNotificationPress` callback — no notification listener needed.
