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.
This class reads in JSON formatted Amazon SNS messages into Message objects. The messages can also be verified using the IsMessageSignatureValid operation.
Namespace: Amazon.SimpleNotificationService.Util
Assembly: AWSSDK.SimpleNotificationService.dll
Version: 3.x.y.z
public class Message
The Message type exposes the following members
Name | Type | Description | |
---|---|---|---|
IsNotificationType | System.Boolean |
Returns true if the message type is a notification message. |
|
IsSubscriptionType | System.Boolean |
Returns true if the message type is a subscription confirmation. |
|
IsUnsubscriptionType | System.Boolean |
Returns true if the message type is a unsubscribe confirmation. |
|
MessageId | System.String |
Gets a Universally Unique Identifier, unique for each message published. For a notification that Amazon SNS resends during a retry, the message ID of the original message is used. |
|
MessageText | System.String |
Gets the MessageText value specified when the notification was published to the topic. |
|
Signature | System.String |
Gets the Base64-encoded "SHA1withRSA" or "SHA256withRSA" signature of the Message, MessageId, Subject (if present), Type, Timestamp, and TopicArn values. |
|
SignatureVersion | System.String |
Gets the Version of the Amazon SNS signature used. |
|
SigningCertURL | System.String |
Gets the URL to the certificate that was used to sign the message. |
|
Subject | System.String |
Gets the Subject parameter specified when the notification was published to the topic. Note that this is an optional parameter. If no Subject was specified, then this name/value pair does not appear in this JSON document. |
|
SubscribeURL | System.String |
Gets the URL that you must visit in order to re-confirm the subscription. Alternatively, you can instead use the Token with the ConfirmSubscription action to re-confirm the subscription. |
|
Timestamp | System.DateTime |
Gets the time (GMT) when the notification was published. |
|
Token | System.String |
Gets a value you can use with the ConfirmSubscription action to re-confirm the subscription. Alternatively, you can simply visit the SubscribeURL. |
|
TopicArn | System.String |
Gets the Amazon Resource Name (ARN) for the topic. |
|
Type | System.String |
Gets the type of message. Possible values are Notification, SubscriptionConfirmation, and UnsubscribeConfirmation. |
|
UnsubscribeURL | System.String |
Gets a URL that you can use to unsubscribe the endpoint from this topic. If you visit this URL, Amazon SNS unsubscribes the endpoint and stops sending notifications to this endpoint. |
Name | Description | |
---|---|---|
IsMessageSignatureValid() |
Verifies the authenticity of a message sent by Amazon SNS. This is done by computing a signature from the fields in the message and then comparing the signature to the signature provided as part of the message. |
|
ParseMessage(string) |
Parses the JSON message from Amazon SNS into the Message object. |
|
SubscribeToTopic() |
Uses the SubscribeURL property to subscribe to the topic |
|
UnsubscribeFromTopic() |
Uses the UnsubscribeURL property to unsubscribe from the topic |
Name | Type | Description | |
---|---|---|---|
MESSAGE_TYPE_NOTIFICATION | System.String |
The value of the Type property for a notification message |
|
MESSAGE_TYPE_SUBSCRIPTION_CONFIRMATION | System.String |
The value of the Type property for a subscription confirmation message |
|
MESSAGE_TYPE_UNSUBSCRIPTION_CONFIRMATION | System.String |
The value of the Type property for a unsubscribe confirmation message |
.NET Core App:
Supported in: 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.5, 4.0, 3.5