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 Name | Type | Description Information | Required |
---|---|---|---|
Action | string | Corresponding API command name, the current API is SendBatchUSMSMessage . | Yes |
PublicKey | string | The user’s public key can be obtained from Console | Yes |
Signature | string | User signature generated based on public key and API command, see Signature Algorithm | Yes |
Request Parameters
Parameter Name | Type | Description Information | Required |
---|---|---|---|
ProjectId | string | Project ID. If not filled in, the default project is used, sub-accounts must be filled in. Please refer to the GetProjectList interface. | Yes |
TaskContent | string | Bulk 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 Name | Type | Description Information | Required |
---|---|---|---|
RetCode | int | Return status code. If it is 0, it means successful return. If it is not 0, it means failure. | Yes |
Action | string | Operation command name. | Yes |
Message | string | Returns an error message, providing detailed description when RetCode is non-zero. | No |
SessionNo | string | The 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 |
ReqUuid | string | Request Uuid this time | No |
SuccessCount | int | Number of SMS (not split) successfully submitted | No |
FailContent | array[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 Name | Type | Description Information | Required |
---|---|---|---|
TemplateId | string | Template ID | Yes |
SigContent | string | Signature | Yes |
Target | array[FailPhoneDetail] | Specific Number Information | Yes |
FailureDetails | string | Details of unsuccessful sending. Note: This field is valid when the template/signature verification fails. | No |
FailPhoneDetail
Field Name | Type | Description Information | Required |
---|---|---|---|
TemplateParams | array[string] | Template Parameters | Yes |
Phone | string | Mobile Number | Yes |
ExtendCode | string | Extended Number | No |
UserId | string | User Defined ID | No |
FailureDetails | string | Reason 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
}