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

# How to get started with browser 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 users' browsers.

To get started with push notifications:
1. [Get your cloud ready](#before-you-begin).
1. [Create an in-browser push notification channel](#create-channel).
1. [Get the data you need to send to notifications to a user](#subscribe-notifications).
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).

## Creating an in-browser 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 the **Push notifications in browser** tab.
  1. Enter a name for your notification channel. The channel name must be unique within Cloud Notification Service.
  1. Click **Create**.

     Creating a notification channel may take some time.

{% endlist %}

## Get the data you need to send to notifications to a user {#subscribe-notifications}

For each channel, you need to create a set of [endpoints](concepts/browser.md) through which to send notifications to specific users' browsers.

To create an endpoint, get this user data:

1. From the user's browser, use [Service Worker](https://developer.mozilla.org/ru/docs/Web/API/Service_Worker_API/Using_Service_Workers) to call the JavaScript [subscribe](https://developer.mozilla.org/en-US/docs/Web/API/PushManager/subscribe#applications) method.

    The [PushSubscription](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription) object will be returned in response.

1. Convert the object you got into JSON by calling the [toJSON](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription/toJSON) method.

{% cut "Example of subscription parameters in JSON" %}

   ```json
   {
    "endpoint": "https://fcm.googleapis.com/fcm/send/abcdef123456",
    "expirationTime": 1704093740000,
    "keys": {
      "p256dh": "BOrLkr7sEt8tERyAv6c8ZG5UC********",
      "auth": "aBcDeFg12345"
    }
   }
   ```
{% endcut %}

## Create an endpoint {#create-endpoint}

{% list tabs group=instructions %}

- Management console {#console}

  1. Select the notification channel you created.
  1. Select the ![image](../_assets/console-icons/layers-3-diagonal.svg) **Endpoints** tab.
  1. Click **Create endpoint**.
  1. Enter the **Endpoint parameters in JSON** you received in the user’s browser.
  1. Click **Create**.

{% endlist %}

## Send a notification {#publish}

{% list tabs group=instructions %}

- Management console {#console}

  1. Select the endpoint you created.
  1. Enter the notification text.
  1. Click **Send**.
  
  Each sent notification is assigned a unique ID. To save it, click **Copy ID**.

{% endlist %}

## See also {#see-also}

* [How to get started with mobile push notifications](quickstart-push.md)
* [Getting started with SMS](quickstart-sms.md)
* [Tools for operations with notifications](tools/index.md)
* [Step-by-step guides](operations/index.md)
* [Service overview](concepts/index.md)
* [In-browser push notification channel](concepts/browser.md)