[Yandex Cloud documentation](../index.md) > [Yandex Cloud Notification Service](index.md) > Getting started > Getting started with mobile push notifications

# Getting started with push notifications in Yandex Cloud Notification Service

{% note info %}

The service is at the [preview stage](../overview/concepts/launch-stages.md).

{% endnote %}

To enable Cloud Notification Service, request access to the service from your account manager or [technical support](https://center.yandex.cloud/support).

Cloud Notification Service (CNS) is a service for multichannel notifications of users. The service's HTTP API is compatible with the [Amazon SNS API](https://docs.aws.amazon.com/sns/latest/api/welcome.html).

With Cloud Notification Service, you can send push notifications to apps registered in the following services:
* [Apple Push Notification service](https://developer.apple.com/notifications/) (APNs).
* [Firebase Cloud Messaging](https://firebase.google.com/) (FCM).
* [Huawei Mobile Services](https://developer.huawei.com/consumer/) (HMS).
* [RuStore](https://www.rustore.ru/help/sdk/push-notifications/).

To get started with push notifications:
1. [Get your cloud ready](#before-you-begin).
1. [Create a push notification channel](#create-channel).
1. [Create an endpoint](#create-endpoint).
1. [Send a notification](#publish).

## Get your cloud ready {#before-you-begin}

Sign up for Yandex Cloud and create a [billing account](../billing/concepts/billing-account.md):
1. Navigate to the [management console](https://console.yandex.cloud) and log in to Yandex Cloud or create a new account.
1. On the **[Yandex Cloud Billing](https://center.yandex.cloud/billing/accounts)** page, make sure you have a billing account linked and it has the `ACTIVE` or `TRIAL_ACTIVE` [status](../billing/concepts/billing-account-statuses.md). If you do not have a billing account, [create one](../billing/quickstart/index.md) and [link](../billing/operations/pin-cloud.md) a cloud to it.

If you have an active billing account, you can create or select a [folder](../resource-manager/concepts/resources-hierarchy.md#folder) for your infrastructure on the [cloud page](https://console.yandex.cloud/cloud).

[Learn more about clouds and folders here](../resource-manager/concepts/resources-hierarchy.md).

## Create a push notification channel {#create-channel}

In Cloud Notification Service, messages to end users are sent through [notification channels](concepts/index.md#channels).

To create a channel:

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select the folder you want to create a notification channel in.
  1. Navigate to **Cloud Notification Service**.
  1. Click **Create notifications channel**.
  1. Select a sending platform in the **Mobile Push notifications** tab:
  
      * `Apple iOS`: For iOS devices.
      * `Google Android`: For Android devices with Google Play services installed.
      * `Huawei Android`: For Android devices with Huawei services installed.
      * `RuStore Android`: For Android devices with the RuStore app marketplace installed.
  
  1. Depending on the platform you select, set the authentication parameters:
  
      **Apple iOS**
      
      * Select the **Authentication method**: `Token` or `Certificate`.
      
          * To authenticate with a token, you will need:
            * **Signature key**: File with the signature key that you will use to certify the authentication token.
                
                Create and download a signature key in your Apple developer account: **Certificates, Identifiers & Profiles** → **Keys** → ![image](../_assets/console-icons/circle-plus-fill.svg). You can download the key file only once.
            * **Key ID** (Key ID): Get the ID in your Apple developer account: **Certificates, Identifiers & Profiles** → **Keys**. Make sure the ID matches the signature key you downloaded in the previous step. It must be 10 characters long.
            * **Developer ID** (Team ID): You can find it in the top-right corner of your Apple developer account. It must be 10 characters long and contain only numbers and Latin letters.
            * **Bundle ID**: Get the [bundle ID](https://developer.apple.com/documentation/appstoreconnectapi/list_bundle_ids) in your Apple developer account: **Certificates, Identifiers & Profiles** → **Identifiers** or in the Xcode app: **Target** → **General** → **Identity**. It may contain only numbers, Latin letters, hyphens, and periods.
             
             Learn more about tokens in [this Apple guide](https://developer.apple.com/documentation/usernotifications/establishing-a-token-based-connection-to-apns).
          
          * To authenticate with a certificate, you will need:
            * **Certificate**: SSL certificate file in `.pem` format.
            * **Private certificate key**: Key file in `.pem` format. 
          
            Read more about certificates in [this Apple guide](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/establishing_a_certificate-based_connection_to_apns#2947597).
          
            To save the certificate and the private key in individual `.pem` files, use the [openssl](https://docs.openssl.org/1.1.1/man1/pkcs12) Linux utility:
            
            ```bash
            openssl pkcs12 -in Certificates.p12 -nokeys -nodes -out certificate.pem
            openssl pkcs12 -in Certificates.p12 -nocerts -nodes -out privatekey.pem
            ```
          
          Token-based authentication is preferred as a faster, more modern and secure option.
      
      * Select the **Environment**: `Development` or `Production`. Use `Development` to test the application.
      
      **Google Android**
      
      Specify which **FCM API version** will be used: `HTTP v1` or `Legacy`.
      
      You can authenticate with FCM using the API:
      * _HTTP v1 API_: You will need a **Google Cloud service account key in JSON format**. The key is used to generate OAuth 2.0 temporary tokens for authenticating requests in the FCM HTTP v1 API. You can get it in the Google Cloud management console.
      * _Legacy API_: You will need an **API key** (server key). You can get it in the Firebase management console.
      
      {% note info %}
      
      [FCM no longer supports](https://firebase.google.com/docs/cloud-messaging/migrate-v1) the legacy API starting June 2024.
      
      {% endnote %}
      
      For more information, see [this Firebase guide](https://firebase.google.com/docs/cloud-messaging/android/client).
      
      **Huawei Android**
      
      Explore the [HMS documentation](https://developer.huawei.com/consumer/en/doc/hmscore-common-Guides/get-started-hmscore-0000001212585589) and get the authentication parameters:
      * **Key ID**.
      * **API key**.
      
      **RuStore Android**
      
      See the [relevant RuStore article](https://www.rustore.ru/help/sdk/push-notifications/send-push-notifications) and get the authentication parameters:
      * **Project ID**.
      * **Service token**.
      
      You can get your authentication parameters in the RuStore developer console: **Push notifications** → **Projects**.
  
  1. Enter the notification channel **Name**. The channel names are unique within the entire CNS. It may contain lowercase and uppercase Latin letters, numbers, underscores, hyphens, and periods. It may be from 1 to 256 characters long. For APNs channels, we recommend specifying the bundle ID in the name; for FCM and HMS, the full package name; for RuStore, `packageName`.
  1. Optionally, click ![image](../_assets/console-icons/plus.svg) **Add description** and enter a description for your notification channel.
  1. Click **Create**.

{% endlist %}

Creating a notification channel may take some time.

## Create an endpoint {#create-endpoint}

Each channel has its own base of [endpoints](concepts/index.md#mobile-endpoints) to send notifications directly to the app on user devices.

To create an endpoint:

{% list tabs group=instructions %}

- Management console {#console}

  1. Select the notification channel you previously created.
  1. Navigate to the ![image](../_assets/console-icons/layers-3-diagonal.svg) **Endpoints** tab.
  1. Click **Create endpoint**.
  1. Enter **Device token**, a unique token residing on the user device, created by the notification service for the app.
  1. Optionally, enter **User data**, a [UTF-8](https://en.wikipedia.org/wiki/UTF-8) encoded text up to 2,048 characters long.
  1. Click **Create**.

  Creating an endpoint may take some time.

{% endlist %}

## Send a notification {#publish}

{% list tabs group=instructions %}

- Management console {#console}

  1. Select the endpoint you previously created.
  1. Under **Send messages**, select a notification format, `Text` or `JSON`.
  1. Enter notification text or a JSON object with notification data.
  1. Click **Send**.
  
  Each sent notification is assigned a unique ID. To save it, click **Copy ID**.

  You can send a new notification immediately or resend the previous one.

{% endlist %}

#### Useful links {#see-also}

* [Getting started with SMS](quickstart-sms.md)
* [Getting started with the service via the AWS CLI](tools/aws-cli.md)
* [Service overview](concepts/index.md)
* [Mobile push notification channel](concepts/push.md)