AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Container for the parameters to the Publish operation.
Sends a message to an Amazon SNS topic, a text message (SMS message) directly to a
phone number, or a message to a mobile platform endpoint (when you specify the TargetArn
).
If you send a message to a topic, Amazon SNS delivers the message to each endpoint that is subscribed to the topic. The format of the message depends on the notification protocol for each subscribed endpoint.
When a messageId
is returned, the message is saved and Amazon SNS immediately
delivers it to subscribers.
To use the Publish
action for publishing a message to a mobile endpoint, such
as an app on a Kindle device or mobile phone, you must specify the EndpointArn for
the TargetArn parameter. The EndpointArn is returned when making a call with the CreatePlatformEndpoint
action.
For more information about formatting messages, see Send Custom Platform-Specific Payloads in Messages to Mobile Devices.
You can publish messages only to topics and endpoints in the same Amazon Web Services Region.
Namespace: Amazon.SimpleNotificationService.Model
Assembly: AWSSDK.SimpleNotificationService.dll
Version: 3.x.y.z
public class PublishRequest : AmazonSimpleNotificationServiceRequest IAmazonWebServiceRequest
The PublishRequest type exposes the following members
Name | Description | |
---|---|---|
![]() |
PublishRequest() |
Empty constructor used to set properties independently even when a simple constructor is available |
![]() |
PublishRequest(string, string) |
Instantiates PublishRequest with the parameterized properties |
![]() |
PublishRequest(string, string, string) |
Instantiates PublishRequest with the parameterized properties |
Name | Type | Description | |
---|---|---|---|
![]() |
Message | System.String |
Gets and sets the property Message. The message you want to send.
If you are publishing to a topic and you want to send the same message to all transport
protocols, include the text of the message as a String value. If you want to send
different messages for each transport protocol, set the value of the Constraints:
JSON-specific constraints:
|
![]() |
MessageAttributes | System.Collections.Generic.Dictionary<System.String, Amazon.SimpleNotificationService.Model.MessageAttributeValue> |
Gets and sets the property MessageAttributes. Message attributes for Publish action. Starting with version 4 of the SDK this property will default to null. If no data for this property is returned from the service the property will also be null. This was changed to improve performance and allow the SDK and caller to distinguish between a property not set or a property being empty to clear out a value. To retain the previous SDK behavior set the AWSConfigs.InitializeCollections static property to true. |
![]() |
MessageDeduplicationId | System.String |
Gets and sets the property MessageDeduplicationId.
|
![]() |
MessageGroupId | System.String |
Gets and sets the property MessageGroupId.
This parameter applies only to FIFO (first-in-first-out) topics. The
The |
![]() |
MessageStructure | System.String |
Gets and sets the property MessageStructure.
Set
You can define other top-level keys that define the message you want to send to a specific transport protocol (e.g., "http").
Valid value: |
![]() |
PhoneNumber | System.String |
Gets and sets the property PhoneNumber. The phone number to which you want to deliver an SMS message. Use E.164 format.
If you don't specify a value for the |
![]() |
Subject | System.String |
Gets and sets the property Subject. Optional parameter to be used as the "Subject" line when the message is delivered to email endpoints. This field will also be included, if present, in the standard JSON messages delivered to other endpoints. Constraints: Subjects must be UTF-8 text with no line breaks or control characters, and less than 100 characters long. |
![]() |
TargetArn | System.String |
Gets and sets the property TargetArn.
If you don't specify a value for the |
![]() |
TopicArn | System.String |
Gets and sets the property TopicArn. The topic you want to publish to.
If you don't specify a value for the |
.NET:
Supported in: 8.0 and newer, Core 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.7.2 and newer