> ## Documentation Index
> Fetch the complete documentation index at: https://moengage.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Push Callback

> Set up JavaScript callbacks for push notification click events in the MoEngage Cordova SDK.

## Callback in JavaScript on Notification Click

To get a callback in javascript on notification click you need to register for a click listener as shown below.

Minimum Plugin version required : 3.0.0

<CodeGroup>
  ```javascript JavaScript theme={null}
  var moe = MoECordova.init(YOUR_Workspace_ID);
  moe.on('onPushClick', function(payloadInfo) {
      //add logic here
  });
  ```
</CodeGroup>

## Payload

NotificationPayload received in the callback **onPushClick** will have the following structure:

<CodeGroup>
  ```auto JSON theme={null}
  {
    "accountMeta": {
      "appId": ""
    },
    "data": {
      "platform": "android/iOS",
      "isDefaultAction": false,
      "clickedAction": {
        "type": "navigation/customAction",
        "payload": {
          "type": "screenName/deepLink/richLanding",
          "value": "",
          "kvPair": {
            "key1": "value1",
            "key2": "value2"
            ...
          }
        }
      },
      "payload": {}
    }
  }
  ```
</CodeGroup>

**accountMeta.appId** - The Workspace ID of MoEngage.\
**data.platform** - Native platform from which callback is triggered. Possible values - **android**, **ios**\
**data.isDefaultAction** - This key is present only for the Android Platform. It's a boolean value indicating if the user clicked on the default content or not. true if the user clicks on the default content else false.\
**data.clickedAction** - Action to be performed on notification click.\
**data.clickedAction.type** - Type of click action. Possible values **navigation** and **customAction**. Currently, **customAction** is supported only on Android.\
**data.clickAction.payload** - Action payload for the clicked action.\
**data.clickedAction.payload.type** - Type of navigation action defined. Possible values **screenName**, **deepLink**, **richLanding**. Currently, in the case of iOS, richlanding and deep-link URL are processed internally by the SDK and not passed in this callback therefore possible value in case of iOS is only **screenName**.\
**data.clickAction.payload.value** - value entered for navigation action or custom payload.\
**data.clickAction.payload.kvPair** - Custom key-value pair entered on the MoEngage Platform.\
**data.payload** - Complete campaign payload.

### Android Payload

If the user clicks on the default content of the notification the key-value pair and campaign payload can be found inside the **payload** key. If the user clicks on the action button or a push template action the action payload would be found inside **clickedAction**.\
You can use the **isDefaultAction** key to check whether the user clicked on the default content or not and then parse the payload accordingly.

### iOS Payload

In the case of iOS, you would always receive the key-value pairs with respect to clicked action in **clickedAction** key. Refer to this [link](/developer-guide/ios-sdk/push/advanced/custom-notification-handling#notification-actions) for knowing the iOS notification payload structure.
