Sending an SMS Message (sendShort)
Scenario
This interface is invoked to send a Huawei Cloud SMS message. (A template must be used for other modules to reference.) This interface can be invoked only after you add SMS configuration information on the page. To obtain the SMS configuration information, purchase the Message & SMS service on Huawei Cloud. The configuration of the SMS template of the HUAWEI CLOUD SMS Messages type created on the page must be the same as that of the template added on the Chinese Mainland SMS > Template Management page of the Message & SMS service purchased on Huawei Cloud.
Method
POST
URI
https://Domain name/apiaccess/CCNOTIFICATION/rest/ccnotification/v1/sendmessage/sendShort
For example, the domain name is service.besclouds.com.
Request Description
|
No. |
Parameter |
Type |
Mandatory or Not |
Description |
|---|---|---|---|---|
|
1 |
X-APP-Key |
String |
Yes |
App key. Obtain the app key from the APP Service > APP Management page. |
|
2 |
Authorization |
String |
Yes |
Authentication field. The format is Bearer {Value of AccessToken returned by the tokenByAkSk interface}. (A space is required after Bearer.) |
|
3 |
X-tenantspaceId |
String |
False |
Tenant ID, which is the ID of the tenant who configures the SMS template. Obtain the tenant ID from the page. |
|
No. |
Parameter |
Type |
Mandatory or Not |
Description |
|---|---|---|---|---|
|
1 |
body |
Object |
Yes |
Request body. |
|
1.1 |
templateId |
String |
Yes |
Template ID. Obtain the template ID from the template list on the page. |
|
1.2 |
variables |
Array [String] |
No |
Variable list. A maximum of 10 variables are supported. |
|
1.3 |
receiverIds |
Array [String] |
No |
Recipient list. The total length of the recipients encrypted and stored in the table cannot exceed 4000 characters. The country code +86 is required. |
|
1.4 |
sendTime |
Number |
No |
Sending time, in timestamp format. If this parameter is not carried, the message is sent immediately. If this parameter is carried, the message is sent at the specified time. If the time is earlier than the current time, an error is reported. |
|
1.5 |
isApifabric |
string |
True |
Whether the interface is an API Fabric interface. |
Response Description
- Status code: 200
|
No. |
Parameter |
Type |
Mandatory or Not |
Description |
|---|---|---|---|---|
|
1 |
returnCode |
String |
No |
Return code. The options are as follows: 0: Success. 1: Failure. 3: Some data in the message synchronization table is sent successfully. 4: The time is earlier than the current time. 5: The SMS recipient number is empty. 8: The SMS message is empty. 9: A recipient does not exist. 10: The number of SMS messages or emails sent in a unit time exceeds the maximum. |
|
2 |
description |
String |
No |
Return description. |
|
3 |
data |
json |
False |
Returned message data. |
|
3.1 |
msgId |
string |
False |
Returned message ID. |
- Status code: 400
|
No. |
Parameter |
Type |
Mandatory or Not |
Description |
|---|---|---|---|---|
|
1 |
schema |
String |
Yes |
Incorrect request. Check the request path and parameters. |
- Status code: 401
|
No. |
Parameter |
Type |
Mandatory or Not |
Description |
|---|---|---|---|---|
|
1 |
schema |
String |
Yes |
Unauthorized operation. 1. Check whether you have purchased related services. 2. Contact customer service to check the status of your account. |
- Status code: 404
|
No. |
Parameter |
Type |
Mandatory or Not |
Description |
|---|---|---|---|---|
|
1 |
schema |
String |
Yes |
The requested content is not found. Check the request path. |
- Status code: 500
|
No. |
Parameter |
Type |
Mandatory or Not |
Description |
|---|---|---|---|---|
|
1 |
schema |
String |
Yes |
Business failure. Check the values of parameters in the request. |
Error Codes
None
Example
- Scenario: Send a Huawei Cloud SMS message. (A template must be used for other modules to reference.) This interface can be invoked only after you add SMS configuration information on the page. To obtain the SMS configuration information, purchase the Message & SMS service on Huawei Cloud. The configuration of the SMS template of the HUAWEI CLOUD SMS Messages type created on the page must be the same as that of the template added on the Chinese Mainland SMS > Template Management page of the Message & SMS service purchased on Huawei Cloud.
Request header:
X-TenantSpaceID:202101134979 Authorization:Bearer 3b5d****23c9 X-app-key:b7bd****cb8c
Request parameters:{ "templateId": "1048269332823168026", "receiverIds": [ "+8617248048759" ], "variables": [ "variables one" ], "sentTime": 1628867100, "isApifabric": "true" }Response parameters:
{ "returnCode": "0", "description": "send SMS all Success" }
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot