Yandex Cloud
Documentation
PresentationContact UsTry it for free
© 2026 Direct Cursus Technology L.L.C.
Yandex Cloud Notification Service
    • Overview
    • Getting started with mobile push notifications
    • Getting started with in-browser push notifications
    • Getting started with SMS
    • Getting started with topics
    • All guides
      • Creating a channel
      • Managing a channel
      • Creating an endpoint
      • Managing an endpoint
      • Sending a push notification to browser
    • Configuring logging
    • Overview
    • Mobile push notifications
    • In-browser push notifications
    • SMS
    • Topics
    • Quotas and limits
    • All tools
    • AWS CLI
    • AWS SDK for C++
    • AWS SDK for Go
    • AWS SDK for Java
    • AWS SDK for JavaScript
    • AWS SDK for Kotlin
    • AWS SDK for .NET
    • AWS SDK for PHP
    • AWS SDK for Python (boto3)
  • Pricing policy
  • Access management
  • Audit Trails events
  • Metrics Monitoring
  • Logs Cloud Logging
  • Release notes
  1. Step-by-step guides
  2. In-browser push notifications
  3. Creating an endpoint

Creating an endpoint

Written by
Yandex Cloud
Updated at September 17, 2026
View in Markdown

For each channel, you need to create a set of endpoints through which to send notifications to specific users' browsers.

To create an endpoint:

  1. From the user's browser, use a Service Worker to call the JavaScript subscribe method.

    The PushSubscription object will be returned in response.

  2. Convert the object you got to JSON by calling the toJSON method.

JSON response format:

{
  "endpoint": <string>,
  "expirationTime": <DOMHighResTimeStamp,null>,
  "keys": {
    "p256dh": <string>,
    "auth": <string>
  }
}

Where:

  • endpoint: URL the push notification will be sent to. Typically this is the address of a push notification server, e.g., Firebase Cloud Messaging (FCM).

  • expirationTime: Notification lifetime in milliseconds. The null value represents unlimited lifetime.

  • keys: Notification protection data:

    • p256dh: User's public key used to encrypt notification data.
    • auth: Authentication key to confirm the identity of the sender.
Example response in JSON
{
 "endpoint": "https://fcm.googleapis.com/fcm/send/abcdef123456",
 "expirationTime": 1704093740000,
 "keys": {
   "p256dh": "BOrLkr7sEt8tERyAv6c8ZG5UC********",
   "auth": "aBcDeFg12345"
 }
}

Once you have the data you need to send to notifications to a user, create an endpoint:

Management console
AWS CLI
AWS SDK for Python
AWS SDK for PHP
AWS SDK for JavaScript
API
  1. In the management console, select the folder containing the notification channel.
  2. Navigate to Cloud Notification Service.
  3. Select the Push notifications in browser tab.
  4. Select a notification channel.
  5. Navigate to the Endpoints tab.
  6. Click Create endpoint.
  7. Enter the Endpoint parameters in JSON received when subscribing the user.
  8. Optionally, enter User data, a UTF-8 encoded text up to 2,048 characters long.
  9. Click Create.
  1. If you do not have the AWS CLI yet, install and configure it.

  2. Run this command:

    aws sns create-platform-endpoint \
    --platform-application-arn <channel_ARN> \
    --token <pushSubscription_JSON>
    

    Where:

    • --platform-application-arn: Notification channel ID (ARN).
    • --token: PushSubscription object obtained through the user's browser, in JSON format.

    Learn more about the aws sns create-platform-endpoint command in this AWS guide.

  1. If you do not have the AWS SDK for Python (boto3) yet, install and configure it.

  2. To create an endpoint, use the following code:

    try:
     response = client.create_platform_endpoint(
       PlatformApplicationArn="<channel_ARN>",
       Token="<pushSubscription_JSON>",
     )
     print(f'Endpoint ARN: {response["EndpointArn"]}')
    
    except botocore.exceptions.ClientError as error:
     print(f"Error: {error}")
    
  1. If you do not have the AWS SDK for PHP yet, install and configure it.

  2. To create an endpoint, use the following code:

    $response = $client->createPlatformApplication(
      [
        'PlatformApplicationArn' => '<channel_ARN>',
        'Token' => '<pushSubscription_JSON>',
      ]
    );
    print('Endpoint ARN: ' . $response->get('EndpointArn'));
    
  1. If you do not have the AWS SDK for JavaScript yet, install and configure it.

  2. To create an endpoint, use the following code:

    try {
      const response = await client.send(
        new AWS.CreatePlatformEndpointCommand({
          PlatformApplicationArn: "<channel_ARN>",
          Token: "<pushSubscription_JSON>",
        }),
      );
      console.log("Endpoint ARN:", response["EndpointArn"]);
    } catch (e) {
      console.log("Error:", e)
    }
    

Use the create HTTP API method for the Endpoint resource in Yandex Cloud Notification Service.

Creating an endpoint may take some time.

Was the article helpful?

Previous
Managing a channel
Next
Managing an endpoint
© 2026 Direct Cursus Technology L.L.C.