Updated on 2025-11-13 GMT+08:00

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 Configuration Center > Access Configuration > SMS Configuration 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 Configuration Center > Workbench Configuration > Administrator Notification Template Configuration 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

Table 1 Request header parameters

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 Configuration Center > System Management > Tenant Information page.

Table 2 Request body parameters

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 Configuration Center > Workbench Configuration > Administrator Notification Template Configuration 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
Table 3 Response body parameters

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
Table 4 Response body parameters

No.

Parameter

Type

Mandatory or Not

Description

1

schema

String

Yes

Incorrect request. Check the request path and parameters.

  • Status code: 401
Table 5 Response body parameters

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
Table 6 Response body parameters

No.

Parameter

Type

Mandatory or Not

Description

1

schema

String

Yes

The requested content is not found. Check the request path.

  • Status code: 500
Table 7 Response body parameters

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 Configuration Center > Access Configuration > SMS Configuration 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 Configuration Center > Workbench Configuration > Administrator Notification Template Configuration 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"
    }