Menu
Amazon Simple Notification Service
Developer Guide (API Version 2010-03-31)

Publish to a Topic

Publishers send messages to topics. Once a new message is published, Amazon SNS attempts to deliver that message to every endpoint that is subscribed to the topic. In this section you publish a message to the email address you defined in the previous task.

To publish to a topic

  1. Open the Amazon SNS console at https://console.aws.amazon.com/sns/v2/home.

    In the left navigation pane, click Topics and then select the topic you want to publish to.

  2. Click the Publish to topic button.

    The Publish a Message page appears.

  3. In the Subject box, type a subject line for your message.

  4. In the Message box, type a brief message.

  5. Click Publish Message.

    A confirmation dialog box appears.

You can now use your email application to open the message from AWS Notifications and read the message.

Create Different Messages for Each Protocol

You can use message formatting support to customize the messages you send for each protocol. For example, a notification that goes to both email and SMS subscribers can be tailored to each type of client. SMS users can receive a short version of the message, while email users can receive a longer, more detailed version.

To publish to a topic with message formatting

  1. Sign in to the AWS Management Console and open the Amazon SNS console at https://console.aws.amazon.com/sns/v2/home.

  2. In the left navigation pane, click Topics and then select a topic.

  3. Click the Publish to topic button.

    The Publish a message page appears.

  4. Click the JSON Message Generator button.

  5. In the Message box, type a brief message.

  6. In this example for the Target Platforms, select email and sms.

  7. Click the Generate JSON button.

    You can now modify the message text so that it is tailored to each type of client.

    The SMS message can contain up to 160 ASCII (or 70 Unicode) characters. If the message exceeds this length, Amazon SNS sends it as multiple messages, each fitting within the character limit. Messages are not cut off in the middle of a word but on whole-word boundaries.

    Email messages can be up to 256 KB in size.

    In the following example, messages are specified for the default, email, and SMS protocols.

    { "default": "Message body text here.", "email": "Message body text here.", "sms": "Message body text here." }
  8. Click Publish message.

    A confirmation dialog box appears.