Updated on 2026-01-09 GMT+08:00

Using an SMN Trigger

For details about the SMN event source, see Supported Event Sources.

Prerequisites

  • You have created an SMN topic, for example, smn-test. For details, see section "Creating a Topic" in the Simple Message Notification User Guide.
  • You have created a function on FunctionGraph. For details, see Creating and Initializing a Function.

Creating an SMN Trigger

  1. Log in to the FunctionGraph console, and choose Functions > Function List in the navigation pane.
  2. Click the HelloWorld function.
  3. On the HelloWorld function details page, choose Configuration > Triggers.
  4. Click Create Trigger.
  5. Set the following parameters:

    • Trigger Type: Select Simple Message Notification (SMN).
    • Topic Name: Select a topic, for example, smn-test.

  6. Click OK.

    After the SMN trigger is created, a subscription is generated for the corresponding topic on the SMN console.

Publishing a Message to Trigger the Function

On the SMN console, publish a message to the smn-test topic. For details, see section "Publishing a Text Message" in the Simple Message Notification User Guide.

Table 1 describes the parameters required for publishing a message. After the message is published, the function is automatically triggered.

Table 1 Parameters required for publishing a message

Parameter

Description

Subject

Enter SMN-Test.

Message Format

Select Text.

Message

Enter {"message":"hello"}.

Viewing the Execution Result

  1. Log in to the FunctionGraph console, and choose Functions > Function List in the navigation pane.
  2. Click the HelloWorld function.
  3. On the function details page, choose Monitoring > Logs to view function logs.