Getting started with Yandex Cloud Notification Service
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
Cloud Notification Service (CNS) is a service for multichannel notifications of users. The service's HTTP API is compatible with the Amazon SNS API
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.
With Cloud Notification Service, you can send notifications to apps registered in the following services:
- Apple Push Notification service
(APNs) - Firebase Cloud Messaging
(FCM) - Huawei Mobile Services
(HMS)
Push notifications via the RuStore
To get started with the service:
Prepare your cloud
Sign up for Yandex Cloud and create a billing account:
- Go to the management console
and log in to Yandex Cloud or create an account if you do not have one yet. - On the Yandex Cloud Billing
page, make sure you have a billing account linked and it has theACTIVE
orTRIAL_ACTIVE
status. If you do not have a billing account, create one.
If you have an active billing account, you can go to the cloud page
Learn more about clouds and folders.
Create a notification channel
In Cloud Notification Service, messages to end users are sent through notification channels.
To create a channel:
-
In the management console
, select the folder where you want to create your notification channel. -
In the list of services, select Cloud Notification Service.
-
Click Create notification channel.
-
Select a platform for sending mobile push notifications:
Apple iOS
: For iOS devices.Google Android
: For Android devices with Google Play services installed.Huawei Android
: For Android devices with Huawei services installed.
-
Depending on the platform you select, set the authentication parameters:
Apple iOS
-
For Authentication method, select either
Token
orCertificate
.You can authenticate with APNs using either a token or a certificate:
-
To authenticate using a token, you will need the following data:
- Token: To get a token in
.p8
format, create an authentication key in your Apple developer account: Certificates, Identifiers & Profiles → Keys → . You can download the token file only once. - Token ID: Get the ID in your Apple developer account: Certificates, Identifiers & Profiles → Keys. Make sure the ID matches the token you want to use. It must be 10 characters long.
- 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
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.
- Token: To get a token in
-
To authenticate using a certificate, you will need the following data:
- Certificate: SSL certificate file in
.p12
format. - Certificate private key.
For more information about the certificate, see the Apple documentation
. - Certificate: SSL certificate file in
Token-based authentication is preferred as it is more progressive.
-
-
For Environment, select either
Development
orProduction
. UseDevelopment
to test the application.
Google Android
Specify which FCM API version will be used:
HTTP v1
orLegacy
.You can authenticate with FCM using either the HTTP v1 API or Legacy API:
- To authenticate using the 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.
- To authenticate using the Legacy API, you will need an API key (server key). You can get it in the Firebase management console.
Note
The HTTP v1 API is preferred as FCM will no longer support
the Legacy API starting from June 2024.See more in the Firebase documentation
.Huawei Android
You can authenticate with HMS using the following parameters:
- Key ID
- API key
See more in the HMS documentation
. -
-
Enter a name for your notification channel. The name must be unique within the cloud. It may contain lowercase and uppercase Latin letters, numbers, underscores, hyphens, and periods. It may be 1 to 256 characters long. For APNs channels, we recommend specifying the bundle ID in the name, and for FCM and HMS, the full package name.
-
(Optional) Click
Add description and enter a description for your notification channel. -
Click Create.
Creating a notification channel may take some time.
Create an endpoint
Each channel has its own base of endpoints to send notifications directly to the app on user devices.
To create an endpoint:
- Select the notification channel you previously created.
- Go to the
Endpoints tab. - Click Create endpoint.
- Enter the Device token, i.e., a unique token on the user device created by the notification service for the app.
- (Optional) Enter the User data: UTF-8
encoded text up to 2,048 characters long. - Click Create.
Creating an endpoint may take some time.
Send a notification
- Select the endpoint you previously created.
- Under Sending notifications, select the notification format:
Text
orJSON
. - Enter the notification text or a JSON object with the notification data.
- 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.