Skip to Content

Send USMS - SendUSMSMessage

Overview

Invoke the SendUSMSMessage interface to send a message

💡 Supports sending the same content to multiple different phone numbers in a single request;

ℹ️ In a single request, you can send the same content to up to 1000 mobile numbers via SMS.

Definition

Public Parameters

Parameter NameTypeDescription InformationRequired
ActionstringCorresponding API command name, the current API is SendUSMSMessage.Yes
PublicKeystringThe user’s public key can be obtained from ConsoleYes
SignaturestringUser signature generated based on public key and API command, see Signature AlgorithmYes

Request Parameters

Parameter NameTypeDescription InformationRequired
ProjectIdstringProject ID. If not filled in, the default project is used, sub-accounts must be filled in. Please refer to the GetProjectList interface.Yes
PhoneNumbers.NstringArray of phone numbers, the format of the phone number is (60)1xxxxxxxx, where () is the international long-distance area code (such as 86 or 0086 for China, both formats are supported), followed by the phone number. If the international area code is not input, such as 1851623xxxx, it is defaulted as a domestic mobile number.Yes
TemplateIdstringTemplate ID (also known as the work order ID when applying for a text message template), please go to the USMS console template management page to view; the text message template used must be applied for and approved;Yes
SigContentstringFor the content of the SMS signature, please go to the signature management page of the USMS console to view; the SMS signature used must be applied for and approved; (Note: Domestic SMS is a mandatory parameter, international SMS is an optional parameter)No
TemplateParams.NstringTemplate variable parameters, filled in the form of an array, for example, TemplateParams.0, TemplateParams.1, … If there are no variable parameters in the template, this item can be left blank; if there are variable parameters in the template, this item is required, and the number of parameters must be consistent with the number of variables, otherwise it cannot be sent;No
ExtendCodestringSMS extension code, formatted as an Arabic numeral string, is not enabled by default. If you need to enable it, please contact UCloud Technical Support.No
UserIdstringCustom business identification ID, string (length cannot exceed 32 bits), does not support special characters such as single quotes, emoji symbols, etc.No

Response Field

Field NameTypeDescription InformationRequired
RetCodeintReturn status code. If it is 0, it means successful return. If it is not 0, it means failure.Yes
ActionstringOperation command name.Yes
MessagestringReturns an error message, providing detailed description when RetCode is non-zero.No
SessionNostringThe unique ID of the SMS sent in this submission, you can query the list of SMS sent this time based on this value.No
UserIdstringThe custom business ID submitted this time will only be returned when a valid UserId is input during sending.No

Example

Request Example

https://api.ucloud-global.com/?Action=SendUSMSMessage &ProjectId=org-xxxxxx &PhoneNumbers.0=185xxxxxxxx &PhoneNumbers.1=131xxxxxxxx &TemplateParams.0=123456 &TemplateParams.1=10 &SigContent=UCloud &TemplateId=UTA20210101xxxx &PublicKey=vsRhB0Qzo9elXXXXXkw8o/vmss8Tb0vxi74A= &Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx &UserId=hGBCrtQw &SenderId=VnxRzuQo

Response Example

{ "Action": "SendUSMSMessageResponse", "Message": "提交发送成功", "RetCode": 0, "SessionNo": "5a3XXXXXXb-7XXXX2-4XXX", "UserId": "najiyZOy" }