Sends a text message by using a message template. This operation supports sending text messages only to the Chinese mainland.
Operation description
Usage notes
The SendMessageWithTemplate operation only supports sending text messages to the Chinese mainland.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dysms:SendMessageWithTemplate |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| To |
string |
Yes |
The phone number of the recipient. Format: country code + phone number. Example: 861503871****. For more information about country codes, see Dialing codes. |
861503871**** |
| From |
string |
Yes |
The sender identifier. Specify the name of the text message signature. You can log on to the Short Message Service console, choose Send to Chinese Mainland > Signatures, and view the signature name in the signature list. |
Alicloud321 |
| TemplateCode |
string |
Yes |
The code of the text message template. You can log on to the Short Message Service console, choose Send to Chinese Mainland > Message Templates, and view the template code in the template list. |
SMS_**** |
| TemplateParam |
string |
No |
The actual values of the variables in the text message template. This parameter is required if the template contains variables. |
{"code":"1234","product":"ytx"} |
| SmsUpExtendCode |
string |
No |
The extension code for upstream text messages. |
90999 |
| ValidityPeriod |
integer |
No |
The validity period of the text message. |
1 |
| ChannelId |
string |
No |
The channel ID. |
5739 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| ResponseCode |
string |
The submission status of the text message. |
OK |
| NumberDetail |
object |
The details of the phone number. |
|
| Carrier |
string |
The carrier network to which the phone number belongs. |
China Mobile |
| Region |
string |
The region to which the phone number belongs. |
Nanjing, Jiangsu |
| Country |
string |
The country to which the phone number belongs. |
China |
| ResponseDescription |
string |
The detailed description of the text message submission status. |
The SMS Send Request was accepted |
| Segments |
string |
The number of billed text message segments. |
1 |
| To |
string |
The phone number of the recipient. Format: country code + phone number. Example: 861503871****. |
861503871**** |
| MessageId |
string |
The message ID. |
1**************3 |
| RequestId |
string |
The request ID. |
F655A8D5-B967-440B-8683-DAD6FF8D23D6 |
Examples
Success response
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
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.