After you learn the basic concepts in SMN, you can start to create a topic, add subscriptions to the topic, and publish messages on the SMN console or by calling RESTful APIs provided by SMN.
You can publish different formats of messages using SMN.
Message Format | Scenarios | Reference |
|---|---|---|
JSON message | Send different message content to different types of subscribers with only one message publishing. | |
Template message | Send messages containing fixed content and variables that can be easily set to desired content. |
Figure 1 shows the process to publish a message to a topic.
Figure 1 Process of publishing a message

To send similar messages repeatedly, create a message template which contains fixed and changeable content. Every time you send messages using the template, you only have to replace changeable content. For example, your organization holds expositions regularly and needs to notify relevant people of the time, you can create a message template containing date variables and other fixed content.
and select the desired region and project.The SMN console is displayed.
The Topics page is displayed.
Figure 2 Create Topic

Parameter | Description |
|---|---|
Topic Name | Topic name, which:
|
Display Name | Message sender name, which can contain up to 192 bytes. NOTE: After you specify a display name, the sender in email messages will be presented as Display name<username@example.com>. Otherwise, the sender will be username@example.com. |
Enterprise Project | Name of an enterprise project. An enterprise project allows you to group cloud resources under specific projects and makes it easier to manage cloud resources and users. This parameter is for enterprise users. |
CTS Log | Whether to enable CTS log. |
Log Group | Select a log group. A log group is a group of log streams which share the same log retention settings. For details, see Log Groups. |
Log Stream | Select a log stream in the specified log group. A log stream is the basic unit for reading and writing logs. You can sort logs of different types, such as operation logs and access logs, into different log streams. For details, see Log Streams. |
Tag | A tag is a key-value pair. Tags identify cloud resources so that you can easily categorize and search for your resources.
|
The topic you created is displayed in the topic list. The system generates a topic URN, which is the unique resource identifier of the topic and cannot be changed.
To search for a topic, filter topics by project or enter the topic name or ID in the upper right corner of the topic list. Then click
or press Enter. Alternatively, click Search by Tag above the upper right corner of the topic list and search for a topic by tag key and value.
and select the desired region and project.The SMN console is displayed.
The Add Subscription dialog box is displayed.
Figure 3 Add Subscription

Parameter | Description |
|---|---|
Topic Name | Specifies the name of the topic to which messages are published. |
Protocol | Specifies the protocol over which messages are sent. Possible values are FunctionGraph (function), Email, HTTP, and HTTPS. |
Method | The following two options are available:
|
Endpoint | Specifies the subscription endpoint. You can add up to 10 email, HTTP, or HTTPS endpoints, one in each line.
|
Request Header | This parameter is only available if HTTP or HTTPS is selected for Protocol. It indicates whether to configure the request header now. If you select Configure now, specify Key and Value. You can add up to 10 request headers. The value of Key must:
|
Version | This parameter is only available if FunctionGraph (function) is selected for Protocol. Select the version for the function. |
Description | Enter the remarks for the subscription. To modify the subscription remarks, click |
The subscription you added is displayed in the subscription list.
To search for a subscription, you can filter subscriptions by protocol or subscription status in the upper right corner of the subscription list. You can also enter a subscription endpoint and click
or press Enter.
on the upper left to select the desired region and project.The SMN console is displayed.
The Create Message Template dialog box is displayed.
Parameter | Description |
|---|---|
Template Name | Template name, which:
|
Protocol | Endpoint protocol of the template, which cannot be changed once the template is created The protocol can be Default, Email, HTTP, HTTPS, or FunctionGraph (function). If you do not specify a protocol, Default is used. |
Content | Template content Use {xxx} as the placeholder to create a template. When you use this template to publish messages, replace {xxx} with specific content. xxx must start with a letter or digit and can contain up to 21 characters, including only letters, digits, hyphens (-), periods (.), and underscores (_). The message template must meet the following requirements:
|
For example, the template information is as follows:
The template you created is displayed in the template list.
To search for a template, enter the template name in the upper right corner of the message template list and click
or press Enter.
on the upper left to select the desired region and project.The SMN console is displayed.
The Topics page is displayed.
Alternatively, locate the topic and click its name. In the upper right corner of the displayed topic details page, click Publish Message.
Select Template for Message Format. Then, manually type the template content in the Message box or click Generate Template Message to generate it automatically. The message content cannot be left blank and its size cannot exceed 256 KB.
The system replaces the variables with the message content you specified. The protocols configured in the template are displayed after each variable. Only the Default protocol is specified in tem_001. Therefore, all confirmed subscribers in the topic will receive the message content in the default template.
In this example, the message generated is The Arts and Crafts Exposition will be held from February 10 through February 21. We sincerely invite you to join us..
The message that is generated contains the template name and variables.
SMN delivers your message to all subscription endpoints. For details about messages for different protocols, see Messages Using Different Protocols.
Subscription endpoints of different protocols receive different messages.
Subscription endpoints are email addresses.
Email messages contain the message subject, content, and a link to unsubscribe.
Subscription endpoints are public network URLs. For details, see section "HTTP/HTTPS Messages" in Simple Message Notification User Guide.