Send SMS Template¶
Send SMS messages based on the SMS template, specify the values for the parameters in the SMS template. Some SMS operators also support defining the SMS signature before the message body.
After the request is successful, the SMS send request will be placed in a message queue, and the API will return an eventId, which can be used to check the actual sending result via the Search Send Result API.
Request Format¶
POST https://{apigw-address}/notification-center-service/v2.0/template/sms
Request Parameters (URI)¶
Name |
Location (Path/Query) |
Required/Optional |
Data Type |
Description |
---|---|---|---|---|
orgId |
Query |
Required |
String |
The organization ID. How to get the orgId>> |
Request Parameters (Body)¶
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
variables |
Required |
Map<String, String> |
Specify the variables from the SMS template that need to be used in the SMS message, and specify the values of the variables. You can go to EnOS Application Portal > Developer Console, select Notification Management > Message Management > Templates, and check the variables of the template in the SMS tab. |
templateCode |
Required |
String |
Template identifier. |
phones |
Required |
List<Phone> |
The recipient’s mobile area code and telephone number. |
tunnelCode |
Optional, required if |
String |
SMS channel codes, all available channel codes are listed in Useful Constants > SMS Tunnel Code. Specify at least one of |
tunnelIdentifier |
Optional, required if |
String |
SMS channel ID, used to specify different SMS channels of the same operator (limited to channels defined in the current OU and system OU). If not specified, defaults to null. Specify at least one of |
signatureCode |
Optional |
String |
If you need to add an SMS signature before the message, you can specify a signature identifier. You can go to EnOS Application Portal > Developer Console, select Notification Management > Message Management > Configurations, and check the available signatures in the SMS tab. |
priority |
Optional |
Enum |
Message sending priority, supporting |
Response Parameters¶
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
eventId |
Required |
String |
You can use event ID to search the actual result after the message push request is sent. |
Useful Constants¶
Name |
Value |
Description |
---|---|---|
SMS Tunnel code |
|
SMS channel code. System channel codes are available in all OUs. The OU channel code is the operator code of the channel that has been set up in the OU, which follows the current configuration of the OU. |
Email sender code |
NOTICE_GW |
Mail sender code, system default, available in all OUs. |
Error Codes ¶
You can refer to the table below to check the specific error codes that this API may return. For the common error codes of Notification Management Service APIs, refer to the Common Error Codes.
Code |
Data Type |
Description |
---|---|---|
32404 |
signature is not exist |
The SMS signature does not exist. |
32404 |
sms template is not exist |
The SMS template does not exist. |
32400 |
variable not in template |
Error variable in template. |
32400 |
tunnel code is not existed |
Message channel parameter error. |
Samples¶
Request Sample¶
url: https://{apigw-address}/notification-center-service/v2.0/template/sms?orgId=yourOrgId
method: POST
requestBody:
{
"variables": {
"aaa": "xxx"
},
"signatureCode": "xx",
"phones": [
{
"area": "87",
"number": "23"
}
],
"templateCode": "awyfl",
"priority": "P2",
"tunnelCode": ""
}
Return Sample¶
{"code":0, "msg":"OK", "submsg":"", "requestId": null, "data":{"eventId": "evt16062008765401}}
Abnormal Sample¶
{"code":32403, "msg":"the quota is run out, test quota is limited", "submsg":"Permission denied: tunnel.quota.run.out", "data": null, "requestId": null}