All Products
Search
Document Center

Message Service:NotifyContentFormat

Last Updated:Jul 19, 2023

When you send a message from Message Service (MNS) to an endpoint, you can use the NotifyContentFormat parameter to specify the format of the message body. Valid values: XML, JSON, and SIMPLIFIED.

  • XML

      • If you set the NotifyContentFormat parameter to XML, the message body contains the message content and related parameters.

      • This format is supported by HTTP endpoints and queue endpoints.

      • Example:

        <?xml version="1.0" encoding="utf-8"?>
            <Notification xlmns="http://mns.aliyuncs.com/doc/v1/">
                <TopicOwner>TopicOwner</TopicOwner>
                <TopicName>TopicName</TopicName>
                <Subscriber>Subscriber</Subscriber>
                <SubscriptionName>SubscriptionName</SubscriptionName>
                <MessageId>6CC4D900CA59A2CD-1-15180534A8F-20000****</MessageId>
                <Message>{1:"a", 2:"b"}</Message>
                <MessageMD5>F1E92841751D795AB325861034B5****</MessageMD5>
                <MessageTag>important</MessageTag>
                <PublishTime>1449556920975</MessagePublishTime>
            </Notification>
  • JSON

      • If you set the NotifyContentFormat parameter to JSON, the message body contains the message content and related parameters.

      • This format is supported by HTTP endpoints and queue endpoints.

      • Example:

        {
            "TopicOwner":"TopicOwner",
            "TopicName":"TopicName",
            "Subscriber":"Subscriber",
            "SubscriptionName":"SubscriptionName",
            "MessageId":"6CC4D900CA59A2CD-1-15180534A8F-20000****",
            "Message":"xxxxx",
            "MessageMD5":"F1E92841751D795AB325861034B5****",
            "MessageTag":"important",
            "PublishTime":"1449556920975"
        }
  • SIMPLIFIED

      • If you set the NotifyContentFormat parameter to SIMPLIFIED, the message body contains only the message content.

      • This format is supported by HTTP endpoints, queue endpoints, and email addresses.

      • Example:

        {1:"a", 2:"b"}