Simple Message Notification
Simple Message Notification
- What's New
- Function Overview
- Service Overview
- Getting Started
-
User Guide
- Topic Management
- Subscription Management
- Message Template Management
- SMN Operation Recording
- Cloud Eye Monitoring
- Logs
- Permissions Management
- Quotas
- Appendix
- Best Practices
-
API Reference
- Before You Start
- API Overview
- Calling APIs
- Getting Started
- APIs
- Examples
- Permissions Policies and Supported Actions
- Public Parameters
- Out-of-Date APIs
- Appendix
- SDK Reference
-
FAQs
- What Are the Advantages of SMN?
- What Protocols Does SMN Support?
- How Is SMN Billed?
- What Are the Requirements for an SMN Topic Name?
- How Many Topics Can I Create?
- How Many Subscriptions Can Be Added to a Topic?
- How Many Messages Can Be Published to a Topic?
- How Many Message Templates Can I Create?
- What Are the Limitations on SMS Messages?
- Can I Add Subscriptions Using Multiple Protocols to a Topic?
- Can a Topic Creator Change Subscription Protocols in a Topic?
- Can I Change a Subscription Endpoint for a Topic?
- Can I Delete a Published Message?
- Does SMN Ensure That Messages Are Received by Subscription Endpoints?
- Will a Subscriber Receive the Same Message Multiple Times?
- Why Do Subscribers Fail to Receive Messages After I Publish Messages to a Topic?
- What Can I Do When Pictures in an Email Message Cannot Be Displayed?
- Does SMN Always Use the Same Phone Number or Sender Name to Send SMS Messages?
- How Do I Obtain My Account ID?
- How Does a DingTalk, Internal DingTalk, Lark, or WeCom Chatbot Obtain Subscription Endpoints?
- Videos
-
More Documents
-
User Guide (ME-Abu Dhabi Region)
- Overview
- Getting Started
- Topic Management
- Subscription Management
- Message Template Management
- SMN Operation Recording
- Logs
- Permissions Management
- Quotas
-
FAQs
- What Are the Advantages of SMN?
- What Protocols Does SMN Support?
- What Are the Requirements for an SMN Topic Name?
- How Many Topics Can I Create?
- How Many Subscriptions Can Be Added to a Topic?
- How Many Messages Can Be Published to a Topic?
- How Many Message Templates Can I Create?
- Can I Add Subscriptions Using Multiple Protocols to a Topic?
- Can a Topic Creator Change Subscription Protocols in a Topic?
- Can I Change a Subscription Endpoint for a Topic?
- Can I Delete a Published Message?
- Does SMN Ensure That Messages Are Received by Subscription Endpoints?
- Will a Subscriber Receive the Same Message Multiple Times?
- Why Do Subscribers Fail to Receive Messages After I Publish Messages to a Topic?
- What Can I Do When Pictures in an Email Message Cannot Be Displayed?
- How Do I Obtain My Account ID?
- Appendix
- Change History
- API Reference
-
User Guide (Paris Region)
- Overview
- Getting Started
- Topic Management
- Subscription Management
- Message Template Management
- SMN Operation Recording
- Logs
- Quotas
-
FAQs
- What Are the Advantages of SMN?
- What Protocols Does SMN Support?
- What Are the Requirements for an SMN Topic Name?
- How Many Topics Can I Create?
- How Many Subscriptions Can Be Added to a Topic?
- How Many Messages Can Be Published to a Topic?
- How Many Message Templates Can I Create?
- What Are the Limitations on SMS Messages?
- Can I Add Subscriptions Using Multiple Protocols to a Topic?
- Can a Topic Creator Change Subscription Protocols in a Topic?
- Can I Change a Subscription Endpoint for a Topic?
- Can I Delete a Published Message?
- Does SMN Ensure That Messages Are Received by Subscription Endpoints?
- Will a Subscriber Receive the Same Message Multiple Times?
- Why Do Subscribers Fail to Receive Messages After I Publish Messages to a Topic?
- What Can I Do When Pictures in an Email Message Cannot Be Displayed?
- How Do I Obtain My Account ID?
- Appendix
- Change History
- API Reference (Paris Region)
-
User Guide (Kuala Lumpur Region)
- Overview
- Getting Started
- Topic Management
- Subscription Management
- Message Template Management
- SMN Operation Recording
- Logs
- Permissions Management
- Quotas
-
FAQs
- What Are the Advantages of SMN?
- What Protocols Does SMN Support?
- What Are the Requirements for an SMN Topic Name?
- How Many Topics Can I Create?
- How Many Subscriptions Can Be Added to a Topic?
- How Many Messages Can Be Published to a Topic?
- How Many Message Templates Can I Create?
- Can I Add Subscriptions Using Multiple Protocols to a Topic?
- Can a Topic Creator Change Subscription Protocols in a Topic?
- Can I Change a Subscription Endpoint for a Topic?
- Can I Delete a Published Message?
- Does SMN Ensure That Messages Are Received by Subscription Endpoints?
- Will a Subscriber Receive the Same Message Multiple Times?
- Why Do Subscribers Fail to Receive Messages After I Publish Messages to a Topic?
- What Can I Do When Pictures in an Email Message Cannot Be Displayed?
- How Do I Obtain My Account ID?
- Appendix
- Change History
- API Reference (Kuala Lumpur Region)
-
User Guide (Ankara Region)
- Overview
- Getting Started
- Topic Management
- Subscription Management
- Message Template Management
- Permissions Management
- Quotas
-
FAQs
- What Are the Advantages of SMN?
- What Protocols Does SMN Support?
- What Are the Requirements for an SMN Topic Name?
- How Many Topics Can I Create?
- How Many Subscriptions Can Be Added to a Topic?
- How Many Messages Can Be Published to a Topic?
- How Many Message Templates Can I Create?
- Can I Add Subscriptions Using Multiple Protocols to a Topic?
- Can a Topic Creator Change Subscription Protocols in a Topic?
- Can I Change a Subscription Endpoint for a Topic?
- Can I Delete a Published Message?
- Does SMN Ensure That Messages Are Received by Subscription Endpoints?
- Will a Subscriber Receive the Same Message Multiple Times?
- Why Do Subscribers Fail to Receive Messages After I Publish Messages to a Topic?
- What Can I Do When Pictures in an Email Message Cannot Be Displayed?
- How Do I Obtain My Account ID?
- Appendix
- Change History
- API Reference (Ankara Region)
-
User Guide (ME-Abu Dhabi Region)
- General Reference
On this page
Show all
Help Center/
Simple Message Notification/
API Reference/
Examples/
Example 1: Publishing Messages to a Topic
Copied.
Example 1: Publishing Messages to a Topic
Scenarios
This section describes how to publish messages by calling APIs. For details, see Calling APIs.
Involved APIs
Procedure
- Obtain the token by following instructions in Authentication.
- Create a topic.
- Send request POST https://{SMN_Endpoint}/v2/{project_id}/notifications/topics.
- Add X-Auth-Token to the request header.
- Specify the following parameters in the request body:
For details about the parameters, see Creating a Topic.
{ "name": "test_topic_v2", //(Mandatory) Topic name "display_name": "test", //(Optional) Display name "enterprise_project_id": "0" //Enterprise project ID (mandatory in the enterprise project scenario) }
Example response{ "request_id": "6a63a18b8bab40ffb71ebd9cb80d0085", "topic_urn": "urn:smn:regionId:f96188c7ccaf4ffba0c9aa149ab2bd57:test_topic_v2" }
- Add a subscription.
- Send request POST https://{SMN_Endpoint}/v2/{project_id}/notifications/topics/{topic_urn}/subscriptions.
Set topic_urn based on the response in 2.c.
- Add X-Auth-Token to the request header.
- Specify the following parameters in the request body:
{ "protocol": "email", //(Mandatory) Subscription protocol "endpoint": "xxx@xx.com", //(Mandatory) Email address "remark": "Subscription" //(Optional) Description }
Example response{ "subscriptions_result": [{ "request_id": "126c17f805934e5eadf647b0860c7a0a", "subscription_urn": "urn:smn:regionId:f96188c7ccaf4ffba0c9aa149ab2bd57:test_topic_v2", "http_code": 201}] }
NOTE:
You can add multiple subscriptions to a topic.
- The subscription endpoint receives a confirmation message, and you must confirm the subscription in the email.
- Send request POST https://{SMN_Endpoint}/v2/{project_id}/notifications/topics/{topic_urn}/subscriptions.
- Publish a message.
- Send request POST https://{SMN_Endpoint}/v2/{project_id}/notifications/topics/{topic_urn}/publish.
- Add X-Auth-Token to the request header.
- Specify the following parameters in the request body:
{ "subject":"test message v2", //(Optional) Message subject, which is displayed in email messages "message": "Message test message v2." //(Mandatory) Message to be published }
Example response
{ "request_id": "6a63a18b8bab40ffb71ebd9cb80d0085", "message_id": "992bbd32819448af95f83814cb3c7454" }
NOTE:
Only confirmed subscription endpoints can receive the message you publish.
Parent Topic: Examples
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot