Updated on 2024-04-15 GMT+08:00

Publishing a JSON Message

Scenarios

In a JSON message, you can specify different message content for different protocols, including SMS, email, HTTP, and HTTPS.

Prerequisites

Subscribers in the topic must have confirmed the subscription, or they will not be able to receive any messages.

Procedure

  1. Select Simple Message Notification under Application.

    The SMN console is displayed.

  2. In the navigation pane, choose Topics.

    The Topics page is displayed.

  3. In the topic list, locate the topic that you need to publish a message to and click Publish Message in the Operation column.
  4. Configure parameters by referring to Table 1.
    Table 1 Parameters required for publishing a message

    Parameter

    Description

    Subject

    (Optional) Specifies the message subject, which must be fewer than 512 bytes.

    Message Format

    Specifies in which format a message is published. You can select only one message format each time you publish a message.

    Message

    Specifies the message content. The message content cannot be left blank nor exceed 256 KB.

    Select JSON for Message Format. Then, manually type the JSON message in the Message box or click Generate JSON Message to generate it automatically.

    • If you choose to manually type the JSON message, see JSON Message Format.
    • If you choose to automatically generate the JSON message, proceed with steps 5 through 8.
  5. Click Generate JSON Message.
  6. Enter your message content, for example, This is a default message., in the Message box and select the desired message protocols.

    The size of a JSON message varies depending on the protocol combinations. As you type in the message content, the system will calculate the number of bytes you have entered, the size of the JSON message, and how many bytes are left. The total size of a JSON message includes braces, quotation marks, spaces, line breaks, and message content. For details about how to calculate the size of a JSON message, see Calculation on the Size of a JSON Message in JSON Message Format.

  7. Click OK.
  8. Modify the message content for each protocol so that different messages are sent to endpoints of different protocols. The system generates JSON-formatted content that includes a default message and content for each protocol. When SMN fails to match any specific message protocol, it sends the default message. For detailed, see JSON Message Format.
  9. Click OK.

    SMN delivers your message to all subscription endpoints. For details about the messages received by each endpoint, see Messages Using Different Protocols.