• Simple Message Notification

smn
  1. Help Center
  2. Simple Message Notification
  3. API Reference
  4. APIs
  5. Template Operation
  6. Creating a Message Template

Creating a Message Template

Description

  • API name

    CreateMessageTemplate

  • Function

    Create a message template for quick message sending to reduce the request data volume. Each user can create a maximum of 100 templates.

URI

  • URI format

    POST /v2/{project_id}/notifications/message_template

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID

Request

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    message_template_name

    Yes

    String

    Template name

    The template name is a string of 1 to 64 characters. It must contain upper- or lower-case letters, digits, hyphens (-), and underscores (_), and must start with a letter or digit.

    content

    Yes

    String

    Template content, which currently supports plain text only

    The template content cannot be left blank or larger than 256 KB.

    protocol

    Yes

    String

    Protocol supported by the template

    NOTE:

    Currently, email, sms, dms, http, and https are supported.

  • Request example
    POST /v2/{project_id}/notifications/message_template
    {
        "message_template_name": "confirm_message",
        "protocol": "https",
        "content": "(1/2)You are invited to subscribe to topic({topic_id}). Click the following URL to confirm subscription:(If you do not want to subscribe to this topic, ignore this message.)"
    }

Response

  • Parameter description

    Parameter

    Type

    Description

    request_id

    String

    Request ID, which is unique

    message_template_id

    String

    Resource identifier of the template, which is unique

  • Response example
    { 
        "request_id":"ca03efa691624d8eb2dfeba01a1bcf6e",
        "message_template_id":"57ba8dcecda844878c5dd5815b65d10f"
    }

Returned Value

See section Returned Value.

Error Code

See section Error Code.