Creating an endpoint
Each channel has its own base of endpoints to send notifications directly to the app on user devices.
To create an endpoint:
- In the management console
, go to the folder containing your endpoint. - From the list of services, select Cloud Notification Service.
- Select a push notification channel.
- Navigate to the
Endpoints tab. - Click Create endpoint.
- Enter Device token, a unique token on the user device, the one created by the notification service for the app.
- Optionally, enter User data, a UTF-8
encoded text up to 2,048 characters long. - Click Create.
-
If you do not have the AWS CLI yet, install and configure it.
-
Run this command:
aws sns create-platform-endpoint \ --platform-application-arn <notification_channel_ARN> \ --token <push_token>
Where:
--platform-application-arn
: Notification channel ID (ARN).--token
: Unique push token for the application on the user’s device.
As a result, you will get a mobile endpoint ID (ARN). Save it for future use.
For more information about the
aws sns create-platform-endpoint
command, see the AWS documentation .
-
If you do not have the AWS SDK for Python (boto3) yet, install and configure it.
-
To create an endpoint, use the following code:
response = client.create_platform_endpoint( PlatformApplicationArn="<notification_channel_ARN>", Token="<push_token>", ) print ("Endpoint ARN:", response["EndpointArn"])
Where:
PlatformApplicationArn
: Notification channel ID (ARN).Token
: Unique push token for the app on the user’s device.
As a result, you will get a mobile endpoint ID (ARN).
-
If you do not have the AWS SDK for PHP yet, install and configure it.
-
To create an endpoint, use the following code:
$response = $client->createPlatformEndpoint( [ 'PlatformApplicationArn' => '<notification_channel_ARN>', 'Token' => '<push_token>', ] ); print($response->get('EndpointArn'));
Where:
PlatformApplicationArn
: Notification channel ID (ARN).Token
: Unique push token for the app on the user’s device.
As a result, you will get a mobile endpoint ID (ARN).
Use the create HTTP API method for the Endpoint resource in Yandex Cloud Notification Service.
Creating an endpoint may take some time.