> For the complete documentation index, see [llms.txt](https://navixy.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://navixy.com/docs/navixy-api/user-api/guides/rules-notifications/get-push-notifications.md).

# Receiving push notifications in your app

Push notifications enable your app to receive new events instantly without requiring continuous polling via API calls. These notifications can be used to trigger actions such as updates to trackers, configurations, tasks, or even to send alerts to platforms like Telegram.

Whether your app is mobile or web-based, the subscription process for push notifications varies. Below, we outline the specific steps for each case.

## Mobile apps

The Navixy platform supports Firebase Cloud Messaging (FCM).

To get push notifications on mobile devices, follow these steps to obtain the app's push token:

1. Firebase projects support Google [service accounts](https://console.firebase.google.com/project/_/settings/serviceaccounts/adminsdk), which you can use to call Firebase server APIs from the app server. To authenticate a service account and authorize it to access Firebase services, you must [generate a private key file in JSON format](https://firebase.google.com/docs/cloud-messaging/auth-server#provide-credentials-manually).
2. Contact our support team at <support@navixy.com> with the generated private key, platform (Android/iOS), and your app's name.
3. We will provide you with the application ID for an API call to bind your app.
4. Obtain the push token of your app from Google Play Market or App Store.
5. Use the `push_token/bind` API call from your app. Substitute the push token and the application ID received from our support team.

## Web apps

To start receiving push notifications in your web application, follow these steps:

When creating a subscription, you must specify the [applicationServerKey](https://web.dev/push-notifications-subscribing-a-user/#applicationserverkey-option). It should be in bytes, not as a base64 string.

Our public key in base64 is:

```
BKPE9clw-_CxWE-WlqSkVpLnHT-7rE637udxtfGRUfXshjfCgatSNqNtRp5HjwEukACcdhIPMwPc9Ch7UsZXxY
```

Here is a function example:

```js
return navigator.serviceWorker
    .register('/service-worker.js')
    .then(function (registration) {
      const subscribeOptions = {
        userVisibleOnly: true,
        applicationServerKey: urlBase64ToUint8Array(
          'BKPE9clw-_CxWE-WlqSkVpLnHT-7rE637udxtfGRUfXshjfCgatSNqNtRp5HjwEukACcdhIPMwPXc9Ch7UsZXxY'
        ),
      };

      return registration.pushManager.subscribe(subscribeOptions);
    })
    .then(function (pushSubscription) {
      console.log(
        'Received PushSubscription: ',
        JSON.stringify(pushSubscription),
      );
      return pushSubscription;
    });
```

Take the `endpoint` and keys `p256dh` and `auth` from the `pushSubscription` object.

Example:

```json
{
  "endpoint": "https://some.pushservice.com/something-unique",
  "keys": {
    "p256dh": "BIPUL12DLfytvTajnryr2PRdAgXS3HGKiLqndGcJGabyhHheJYlNGCeXl1dn18gSJ1WAkAPIxr4gK0_dQds4yiI=",
    "auth": "FPssNDTKnInHVndSTdbKFw=="
  }
}
```

Use the `push_token/bind` API call with parameters:

* `application=w3c_pushapi`
* `token=whole endpoint from pushSubscription, full URL like https://fcm.googleapis.com/fcm/send/f6kicrBn7S0:APA91b......`
* `parameters=object with keys from pushSubscription {"p256dh": "...", "auth":"..."}`

You will receive the notification in `event.data` in JSON format.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://navixy.com/docs/navixy-api/user-api/guides/rules-notifications/get-push-notifications.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
