Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 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
    • 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
    • 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
  • Monitoring metrics
  • Logs Cloud Logging
  • Release notes
  1. Step-by-step operations
  2. In-browser push notifications
  3. Creating an endpoint

Creating an endpoint

Written by
Yandex Cloud
Updated at April 17, 2025

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 Service Worker to call the JavaScript subscribe method.

    The PushSubscription object will be returned in response.

  2. Convert the object you got into 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, go to the folder containing the notification channel.
  2. From the list of services, select Cloud Notification Service.
  3. Select the Push notifications in browser tab.
  4. Select a notification channel.
  5. Select 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, in JSON format received in the user's browser.

    For more information about the aws sns create-platform-endpoint command, see the AWS documentation.

  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
© 2025 Direct Cursus Technology L.L.C.