Yandex Cloud Notification Service overview
Cloud Notification Service (CNS) is a service for multichannel notifications of users. The service's HTTP API is compatible with the Amazon SNS API
Note
The service is at the preview stage.
To enable Cloud Notification Service, request access to the service from your account manager or technical support
Delivery channels
In Cloud Notification Service, notifications to end users are sent through delivery channels.
At the preview stage, you can send personalized push notifications to iOS and Android devices.
Moving forward, we will add SMS messaging and notifications to messengers and browsers.
Mobile push notifications
Mobile push notifications are pop-up messages on your smartphone screen with information about a service event, available services, promotions, news, and updates.
Push notifications are sent via mobile platform notification services:
- Apple Push Notification service
(APNs) - Firebase Cloud Messaging
(FCM) - Huawei Mobile Services
(HMS)
Push notification delivery algorithm using FCM as an example:
- In CNS, you create a mobile push notification delivery channel for a specific platform (FCM) and your app.
- FCM maintains a persistent network connection with all registered mobile devices to deliver push notifications to apps on those devices.
- Your app on a particular device registers in FCM and receives a unique token to send push notifications to that device.
- The token is stored in CNS as a parameter of the application's mobile endpoint.
- To send a notification, you publish a message in CNS and specify the endpoint ID (ARN) as the recipient.
Mobile push notification delivery channel
Minimum list of source data to create a mobile push notification delivery channel:
- App name
(bundle ID recommended) - APNs certificate
- Android package name
- Server key
See more in the Firebase documentation
- Android package name
- Key ID
- API key
See more in the HMS documentation
When a delivery channel is created, it is assigned an ID (ARN).
Mobile endpoints
Each delivery channel has its own base of mobile endpoints to send notifications directly to the app on user devices.
A mobile endpoint contains information about a token to send push notifications to a specific device and delivery channel ID (ARN).
Token lifetime
Push notification tokens have a limited lifetime that depends on a specific platform, user actions, and other factors.
CNS gets feedback from each platform when sending notifications and uses it to manage tokens. If the token has changed, CNS will write a new token to the endpoint, or delete the endpoint if the token is out of date.
Recommended algorithm for working with tokens using a mobile app:
- The app registers in the mobile notification service, e.g., APNs, and receives a token to send push notifications.
- The app provides the token to CNS, gets the endpoint ID (ARN), and stores it on the device.
- Each time the app is launched, it registers again in the mobile notification service, e.g., APNs, and checks to see if the token has changed.
- If the token has changed, the app provides the new token and the endpoint ID (ARN) to CNS. If such an endpoint ID (ARN) does not already exist for some reason, a new endpoint is created in CNS and stored in the app.
Tip
It is not recommended to keep overwriting the token in the endpoint each time the app is launched. If the token has not changed, in some cases this may result in lost notifications.