Publish
Written by
Updated at December 20, 2024
Sends a push notification to an endpoint.
HTTP request
POST https://notifications.yandexcloud.net/
Query parameters
Parameter | Description |
---|---|
Action |
string This is a required field. Operation type parameter. Value: Publish . |
Message |
string This is a required field. Message you want to send to the endpoint. The possible formats include:
In JSON format, you can optionally provide text for a specific mobile platform, e.g.: { "default": "This is the default message which must be present when publishing a message to a topic. The default message will only be used if a message is not present for one of the notification platforms.", "APNS": "{"aps":{"alert": "Check out these awesome deals!","url":"yandex.cloud"} }", "GCM": "{"data":{"message":"Check out these awesome deals!","url":"yandex.cloud"},"notification":{"title":"GCM notification title"}}" "HMS": "{"data":{"message":"Check out these awesome deals!","url":"yandex.cloud"},"notification":{"title":"HMS notification title"}}" } Messages for the FCM and HMS platforms must contain at least one of these fields: data or notification . |
MessageStructure |
string If providing a message in JSON format in the Message field, set the MessageStructure field to json . |
MessageAttributes.entry.N.Name |
string This is a required field. Attribute name. N is a numeric value.e.g., MessageAttributes.entry.1.Name=FirstName&MessageAttributes.entry.2.Name=SecondName . |
MessageAttributes.entry.N.Value.DataType |
string This is a required field. Attribute data type. N is a numeric value.e.g., MessageAttributes.entry.1.Value.DataType=String&MessageAttributes.entry.2.Value.DataType=Number . |
MessageAttributes.entry.N.Value.StringValue |
string This is a required field. Attribute value. N is a numeric value.e.g., MessageAttributes.entry.1.Value.StringValue=background&MessageAttributes.entry.2.Value.StringValue=5 . |
TargetArn |
string This is a required field. Mobile endpoint ID (ARN). e.g., arn:aws:sns::aoegtvhtp8ob********:endpoint/GCM/test-cns-9990/4cbe148515360244248c993abe0a12884d162bb15e87d6c16bd0c810******** . |
ResponseFormat |
string Response format. The possible values are:
|
Attributes
You can use attributes to provide mobile platform-specific parameters. You cannot provide binary data in the MessageAttributes
values.
APNS and APNS_SANDBOX attributes
Attribute | Description |
---|---|
AWS.SNS.MOBILE.APNS.TTL | Notification lifetime in seconds |
AWS.SNS.MOBILE.APNS_SANDBOX.TTL | Notification lifetime in seconds for apps under testing |
AWS.SNS.MOBILE.APNS_VOIP.TTL | Lifetime of an incoming VoIP call notification in seconds |
AWS.SNS.MOBILE.APNS_VOIP_SANDBOX.TTL | Lifetime of an incoming VoIP call notification in seconds for apps under testing |
AWS.SNS.MOBILE.APNS.COLLAPSE_ID | ID for multiple notifications that are collapsed into one |
AWS.SNS.MOBILE.APNS.PRIORITY | Notification output priority. A value from 1 to 10 . |
AWS.SNS.MOBILE.APNS.PUSH_TYPE | Notification type. See the Apple documentation |
AWS.SNS.MOBILE.APNS.TOPIC | Notification topic. See the Apple documentation |
FCM attributes
Attribute | Description |
---|---|
AWS.SNS.MOBILE.FCM.TTL | Message lifetime in seconds |
Response
Successful response
If there are no errors, Cloud Notification Service returns the 200
HTTP code.
Error response
In case of an error, Cloud Notification Service returns a message with the appropriate HTTP code.
For a list of common error codes for all actions, see Errors.