Skip to Content
Short Message Service(USMS)SendBatchUSMSMessage

Batch Send USMS - SendBatchUSMSMessage

Overview

Invoke the SendBatchUSMSMessage interface to send batch messages

💡 Supports sending different short messages to multiple different phone numbers in a single request

ℹ️ In a single batch request, up to 200 numbers are supported.

Definition

Public Parameters

Parameter NameTypeDescription InformationRequired
ActionstringCorresponding API command name, the current API is SendBatchUSMSMessage.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
TaskContentstringBulk send content, this parameter is the base64 encoding result of the json array. In the send content json array, each “template + signature” combination serves as a sub-item, and multiple numbers are supported within each sub-item,
Example:
Send content json array (before base64 encoding): [{“TemplateId”: “UTA20212831C85C”, “SigContent”: “UCloud”, “Target”: [{“TemplateParams”: [“123456”], “Phone”: “18500000123”, “ExtendCode”: “123”, “UserId”: “456”} ] } ] . Definitions of various parameters in the json array: “TemplateId”: template ID, “SigContent”: SMS signature content, “Target”: send content specific to the granularity of the number. The specific fields in “Target” are: “TemplateParams”: actual template parameters sent (if a no-parameter template is used, this parameter cannot be passed), “Phone”: mobile phone number, “ExtendCode”: SMS extension code, “UserId”: custom business identification ID. The mandatory parameters are “TemplateId”, “SigContent”, “Target” (“Phone” is a mandatory parameter in “Target”).
When actually calling this interface, the TaskContent value (after base64 encoding of the send content) is: W3siVGVtcGxhdGVJZCI6ICJVVEEyMDIxMjgzMUM4NUMiLCAiU2lnQ29udGVudCI6ICJVQ2xvdWQiLCAiVGFyZ2V0IjogW3siVGVtcGxhdGVQYXJhbXMiOiBbIjEyMzQ1NiJdLCAiUGhvbmUiOiAiMTg1MDAwMDAxMjMiLCAiRXh0ZW5kQ29kZSI6ICIxMjMiLCAiVXNlcklkIjogIjQ1NiJ9IF0gfSBdIA== .
Yes

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 submitted task for this time, which can be used to query the list of messages sent this time. Note: This field is only returned when the number of successfully submitted messages is greater than 0.No
ReqUuidstringRequest Uuid this timeNo
SuccessCountintNumber of SMS (not split) successfully submittedNo
FailContentarray[BatchInfo]Details of unsuccessful sending, this field is valid when the return code is non-zero, and can be resent according to the data of this field.No

Data Model

BatchInfo

Field NameTypeDescription InformationRequired
TemplateIdstringTemplate IDYes
SigContentstringSignatureYes
Targetarray[FailPhoneDetail]Specific Number InformationYes
FailureDetailsstringDetails of unsuccessful sending. Note: This field is valid when the template/signature verification fails.No

FailPhoneDetail

Field NameTypeDescription InformationRequired
TemplateParamsarray[string]Template ParametersYes
PhonestringMobile NumberYes
ExtendCodestringExtended NumberNo
UserIdstringUser Defined IDNo
FailureDetailsstringReason for sending failure. Note: If the template/signature verification fails, this field is blank.No

Example

Request Example

https://api.ucloud-global.com/?Action=SendBatchUSMSMessage &PublicKey=vsRhB0Qzo9elXXXXXkw8o/vmss8Tb0vxi74A= &Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx &ProjectId=org1234 &TaskContent=WwogICAgewogICAgICAgICJUZW1wbGF0ZUlkIjoiVVRBMjAyMTI4MzFDODVDIiwKICAgICAgICAiU2lnQ29udGVudCI6IlVDbG91ZCIsCiAgICAgICAgIlRhcmdldCI6WwogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAiVGVtcGxhdGVQYXJhbXMiOlsKICAgICAgICAgICAgICAgICAgICAi6aG257qn6ZK755+z55So5oi35YiY5aSn6ZSkIiwKICAgICAgICAgICAgICAgICAgICAiMjQ2ODAiCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgIlBob25lIjoiMTg1WFhYWDA1MDciLAogICAgICAgICAgICAgICAgIlVzZXJJZCI6InlvdSBtYW4gYyBkZWZpbmUgdGhlIGNvbnRlbnQgYnkgeXJzZWxmIgogICAgICAgICAgICB9LAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAiVGVtcGxhdGVQYXJhbXMiOlsKICAgICAgICAgICAgICAgICAgICAi5byA5b+D5p6c5oyW5Zyf5py6IiwKICAgICAgICAgICAgICAgICAgICAiMTM1NzkiCiAgICAgICAgICAgICAgICBdLAogICAgICAgICAgICAgICAgIlBob25lIjoiMTg1WFhYWDA2MDgiLAogICAgICAgICAgICAgICAgIkV4dGVuZENvZGUiOiIxMjMiLAogICAgICAgICAgICAgICAgIlVzZXJJZCI6ImNhdGNoIHRoZSBiaWcgZmlzaCIKICAgICAgICAgICAgfQogICAgICAgIF0KICAgIH0KXQ==

Response Example

{ "Action": "SendBatchUSMSMessageResponse", "FailContent": [ { "FailureDetails": "phone in the black list", "SigContent": "UCloud", "Target": [ { "ExtendCode": "123", "Phone": "185XXXX0608", "TemplateParams": [ "开心果挖土机", "13579" ], "UserId": "catch the big fish" } ], "TemplateId": "UTA20212831C85C" } ], "Message": "submit success", "ReqUuid": "abcd-dadd-dafs-dadfa-dafdsa", "RetCode": 0, "SessionNo": "abcd-dadd-dafs-dadfa-dafdsa", "SuccessCount": 2 }