Updated on 2024-07-30 GMT+08:00

Adding a Subscription to a Topic

Scenarios

To deliver messages published to a topic to endpoints, you must add the subscription endpoints to the topic.

To Add a Subscription

  1. Log in to the management console.
  2. In the upper left corner of the page, click and select the desired region and project.
  3. Click . Select Simple Message Notification under Management & Governance.

    The SMN console is displayed.

  4. In the navigation pane, choose Topic Management > Topics.

    The Topics page is displayed.

  5. Locate the topic that you want to add a subscription to. In the Operation column, click Add Subscription.

    Alternatively, click a topic name. In the upper right corner of the displayed page, click Add Subscription.

    The Add Subscription dialog box is displayed.

    Figure 1 Add Subscription
  6. Specify the subscription protocol and endpoints.
    Table 1 Parameters for adding a 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 SMS, HTTP, HTTPS, FunctionGraph (function), Voice notification, DingTalk chatbot, WeCom chatbot, Lark chatbot, and Email.

    NOTE:
    • DingTalk chatbot, voice notification, WeCom chatbot, and Lark chatbot are in the open beta test (OBT). To use any of these, submit a service ticket to apply for the OBT.
    • After the OBT is enabled, the current token will be invalid. Log in to the console again, and a new token will be generated.
    • The number of WeCom, DingTalk, or Lark messages that can be sent is limited, and the recipient system may be faulty.

      In this case, SMN cannot ensure successful message delivery.

    Endpoint

    Specifies the subscription endpoint. You can add up to 10 SMS, email, HTTP, or HTTPS endpoints, one in each line.

    • SMS: Enter one or more valid phone numbers.

      Examples:

      18512345678

      +8618512345678

    • Email: Enter one or more valid email addresses.

      Examples:

      username@example.com

      username2@example.com

    • HTTP: Enter one or more public network URLs.

      Example:

      http://example.com/notification/action

    • HTTPS: Enter one or more public network URLs.

      Example:

      https://example.com/notification/action

    • FunctionGraph (function): Click to select a function and specify its version.
    • Voice notification: Enter one or more valid phone numbers.

      A phone number must be preceded by a plus sign (+) and a country code. If you enter a phone number used in the Chinese mainland, the plus sign (+) and the country code are not required.

      Voice subscriptions are only available in some regions of the Chinese mainland. Voice notification is not supported in Hong Kong, Macao, Taiwan, Xinjiang, and Tibet.

    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:

    • be case insensitive and unique.
    • start with x- but cannot start with x-smn.
    • contain only digits, letters, and hyphens (-), but not end with a hyphen nor contain consecutive hyphens.

    Availability Test

    This parameter is only available if HTTP or HTTPS is selected for Protocol. Click Start to check the real-time connectivity between SMN and HTTP/HTTPS endpoints.

    Version

    This parameter is only available if FunctionGraph (function) is selected for Protocol. Select the version for the function. For details about how to create a version, see Version Management.

    Description

    Specifies the remarks of the subscription.

  7. (Optional) Configure a subscription filtering policy to limit the scope of message publishing.

    The default filtering policy applies to message attributes. If you have set a filtering policy and message attributes when publishing a message, the system determines whether to push the messages to subscribers based on the filtering policy.

    Subscription filtering policies are configured in JSON. The following is an example.
    {
        "filter_polices": [
            {
                "name": "policy_name",
                "string_equals": [
                    "policy_value"
                ]
            }
        ]
    }
  8. Click OK.

    The subscription you added is displayed in the subscription list.

    • To prevent malicious users from attacking subscription endpoints, SMN limits the number of confirmation messages that can be sent to an endpoint within a specified period. For details, see section "Traffic Control on Subscription Confirmation" in Simple Message Notification User Guide.
    • SMN does not check whether subscription endpoints exist when you add subscriptions.
    • After you add a subscription, SMN will send a confirmation message to the endpoints, and the link in the confirmation message will be valid for 48 hours.
    • Subscription confirmation messages will be counted as messages sent and will be billed.