AddSmsTemplate

Updated at:

This operation has been discontinued.

Note

This API has been deprecated. We recommend migrating to Dysmsapi(2017-05-25) - CreateSmsTemplate for enhanced functionality and continued support. While the deprecated API remains temporarily accessible, no further updates or bug fixes will be provided.

Operation description

  • In accordance with the regulations of the Ministry of Industry and Information Technology and carrier requirements, Alibaba Cloud has upgraded the template-related API features. To improve the review efficiency and approval rate of your templates, use the new operation CreateSmsTemplate.

  • You can commit up to 100 SMS template applications per calendar day through the API. Wait at least 30 seconds between submissions. If you apply for SMS templates through the console, there is no limit on the number of submissions.

  • Template information submitted through the API is synchronized with the China Short Message Service (China SMS) console. For related operations on templates in the console, see SMS templates.

  • After you commit a template application, you can call the QuerySmsTemplate operation to query the template review status and details. You can also configure receipt messages and obtain the template review status through TemplateSmsReport.

  • China SMS templates and international/Hong Kong, Macao, and Taiwan SMS templates are not interchangeable. Apply for templates based on your business scenarios.

  • Only users who verify your identity - Enterprise account can apply for promotional SMS messages and international/Hong Kong, Macao, and Taiwan messages. For more information about the differences between individual and enterprise user privileges, see Before you begin.

QPS limit

The single-user QPS limit for this operation is 1,000 calls per second. If this limit is exceeded, the API calls are throttled, which may affect your business. Call this operation as appropriate.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

dysms:AddSmsTemplate

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

TemplateType

integer

Yes

The SMS type. Valid values:

  • 0: authenticate.

  • 1: SMS notification.

  • 2: promotional SMS.

  • 3: international/Hong Kong, Macao, and Taiwan message.

Note

Only users who verify your identity - Enterprise account can apply for promotional SMS messages and international/Hong Kong, Macao, and Taiwan messages. For details about the differences between individual and enterprise user privileges, see Before you begin.

0

TemplateName

string

Yes

The template name. The name can be up to 30 characters in length.

Verification code.

TemplateContent

string

Yes

The template content. The content can be up to 500 characters in length.

The template content and variable content must comply with the SMS template specifications. Otherwise, the template will fail the review. You can also view common template examples on the Apply for template page. Using example templates can improve the review efficiency and approval rate. For more information about variable specifications, see TemplateContent parameter variable specifications.

You are applying for mobile registration. The verification code is ${code}, valid for 5 minutes.

Remark

string

Yes

The description of the SMS template application. The description can be up to 100 characters in length.

The description serves as reference information for template review. A complete description helps reviewers understand your business scenario and improves review efficiency. Guidelines:

  • Provide the usage scenario of your launched business.

  • Provide real-scenario SMS examples that reflect your business scenario.

  • Provide the parameter values of variables and describe the business scenario and the reason for selecting the variable attributes in detail.

  • Provide the website link, ICP-filed domain name, or app marketplace download link of your actual business.

  • For logon scenarios, provide a test account and password.

Apply for verification code SMS.

Response elements

Element

Type

Description

Example

object

Code

string

The request status code.

  • OK indicates that the request was successful.

  • For other error codes, see API error codes.

OK

Message

string

The description of the status code.

OK

RequestId

string

The request ID.

F655A8D5-B967-440B-8683-DAD6FF8DE990

TemplateCode

string

The SMS template code.

After you submit a template application, you can use the SMS template code to call the QuerySmsTemplate operation to query the template review details. You can also configure receipt messages and obtain the template review status through TemplateSmsReport.

SMS_46817****

Examples

Success response

JSON format

{
  "Code": "OK",
  "Message": "OK",
  "RequestId": "F655A8D5-B967-440B-8683-DAD6FF8DE990",
  "TemplateCode": "SMS_46817****"
}

Error codes

HTTP status code

Error code

Error message

Description

400 TemplateParameterCountIllegal The verification code template only supports 1 verification code as a variable Verification code templates support only one variable, which must be a verification code.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.