AWS SDK Version 3 for .NET
API Reference

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.

Inheritance Hierarchy

System.Object
  Amazon.SimpleNotificationService.Util.Message

Namespace: Amazon.SimpleNotificationService.Util
Assembly: AWSSDK.SimpleNotificationService.dll
Version: 3.x.y.z

Syntax

C#
public class Message

The Message type exposes the following members

Properties

NameTypeDescription
Public Property IsNotificationType System.Boolean

Returns true if the message type is a notification message.

Public Property IsSubscriptionType System.Boolean

Returns true if the message type is a subscription confirmation.

Public Property IsUnsubscriptionType System.Boolean

Returns true if the message type is a unsubscribe confirmation.

Public Property 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.

Public Property MessageText System.String

Gets the MessageText value specified when the notification was published to the topic.

Public Property Signature System.String

Gets the Base64-encoded "SHA1withRSA" or "SHA256withRSA" signature of the Message, MessageId, Subject (if present), Type, Timestamp, and TopicArn values.

Public Property SignatureVersion System.String

Gets the Version of the Amazon SNS signature used.

Public Property SigningCertURL System.String

Gets the URL to the certificate that was used to sign the message.

Public Property 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.

Public Property 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.

Public Property Timestamp System.DateTime

Gets the time (GMT) when the notification was published.

Public Property 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.

Public Property TopicArn System.String

Gets the Amazon Resource Name (ARN) for the topic.

Public Property Type System.String

Gets the type of message. Possible values are Notification, SubscriptionConfirmation, and UnsubscribeConfirmation.

Public Property 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.

Methods

Note:

Asynchronous operations (methods ending with Async) in the table below are for .NET 4.5 or higher. For .NET 3.5 the SDK follows the standard naming convention of BeginMethodName and EndMethodName to indicate asynchronous operations - these method pairs are not shown in the table below.

NameDescription
Public Method 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.

Public Method Static Method ParseMessage(string)

Parses the JSON message from Amazon SNS into the Message object.

Public Method SubscribeToTopic()

Uses the SubscribeURL property to subscribe to the topic

Public Method UnsubscribeFromTopic()

Uses the UnsubscribeURL property to unsubscribe from the topic

Fields

NameTypeDescription
Field Static Field MESSAGE_TYPE_NOTIFICATION System.String

The value of the Type property for a notification message

Field Static Field MESSAGE_TYPE_SUBSCRIPTION_CONFIRMATION System.String

The value of the Type property for a subscription confirmation message

Field Static Field MESSAGE_TYPE_UNSUBSCRIPTION_CONFIRMATION System.String

The value of the Type property for a unsubscribe confirmation message

Version Information

.NET Core App:
Supported in: 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5, 4.0, 3.5