Sends a message to the Chinese mainland by using a message template.
Operation description
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
dysms:SendMessageWithTemplate | Write |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
To | string | Yes | The mobile phone number to which the message is sent. You must add the country code to the beginning of the mobile phone number. Example: 861503871****. For more information, see Dialing codes. | 861503871**** |
From | string | Yes | The signature. To query the signature, log on to the Short Message Service (SMS) console and navigate to the Signatures tab of the Go China page. | Alicloud321 |
TemplateCode | string | Yes | The code of the message template. To query the code, log on to the SMS console and navigate to the Templates tab of the Go China page. | SMS_**** |
TemplateParam | string | No | The value of the variable in the message template. If a variable exists in the template, the parameter is required. | {"code":"1234","product":"ytx"} |
SmsUpExtendCode | string | No | The extension code of the MO message. | 90999 |
ValidityPeriod | long | No | The validity period of the message. | 1 |
ChannelId | string | No | The ID of the channel. | 5739 |
Response parameters
Examples
Sample success responses
JSON
format
{
"ResponseCode": "OK",
"NumberDetail": {
"Carrier": "China Mobile",
"Region": "Nanjing, Jiangsu",
"Country": "China"
},
"ResponseDescription": "The SMS Send Request was accepted",
"Segments": "1",
"To": "861503871****",
"MessageId": "1**************3",
"RequestId": "F655A8D5-B967-440B-8683-DAD6FF8D23D6"
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||||||
---|---|---|---|---|---|---|---|---|
2024-03-28 | The request parameters of the API has changed | see changesets | ||||||
| ||||||||
2023-06-27 | API Description Update. The request parameters of the API has changed | see changesets | ||||||
|