# Push Callbacks

Netmera provides the following push notification callbacks:

* **Push Register**: Triggered when a device registers for push notifications.
* **Push Receive**: Triggered when a push notification is received.
* **Push Open**: Triggered when a user taps the notification.
* **Push Dismiss ( only Android )**: Triggered when a user dismisses the notification.&#x20;
* **Push Button Click**: Triggered when a user interacts with a button inside the notification.
* **Carousel Object Select**: Triggered when a user selects an item in a carousel notification.

To enable these callbacks in your React Native project, follow the steps below:

### Step 1: Create `NetmeraPushHeadlessTask.ts`

* Create a new file named `NetmeraPushHeadlessTask.ts` in your React Native project and define the callback functions:

```typescript
import {
  NetmeraPushObject,
  NetmeraInteractiveAction,
  NetmeraCarouselObject
} from "react-native-netmera";

export const onPushRegister = async (data: { pushToken: string }) => {
  console.log('onPushRegister: ', data);
};

export const onPushReceive = async (push: NetmeraPushObject) => {
  console.log('onPushReceive: ', push);
};

export const onPushOpen = async (push: NetmeraPushObject) => {
  console.log('onPushOpen: ', push);
};

export const onPushDismiss = async (push: NetmeraPushObject) => {
  console.log('onPushDismiss: ', push);
};

export const onPushButtonClicked = async (
  push: NetmeraPushObject,
  action?: NetmeraInteractiveAction
) => {
  console.log('onPushButtonClicked: ', push);
  console.log('Clicked action: ', action);
};

export const onCarouselObjectSelected = async (
  push: NetmeraPushObject,
  carouselItem?: NetmeraCarouselObject
) => {
  console.log('onCarouselObjectSelected: ', push);
  console.log('Selected carousel item: ', carouselItem);
};
```

### Step 2: Register Callbacks in `index.js`

* In your `index.js` file, import the callback functions and call `setPushLifecycleCallbacks`:

```javascript
import {
    onCarouselObjectSelected,
    onPushButtonClicked,
    onPushDismiss,
    onPushOpen,
    onPushReceive,
    onPushRegister
} from "./NetmeraPushHeadlessTask";

Netmera.setPushLifecycleCallbacks(
    onPushRegister,
    onPushReceive,
    onPushOpen,
    onPushDismiss,
    onPushButtonClicked,
    onCarouselObjectSelected
);

// Ensure this is called after `Netmera.setPushLifecycleCallbacks`
AppRegistry.registerComponent(appName, () => App);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://user.netmera.com/netmera-developer-guide/platforms/react-native/push-notifications/push-callbacks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
