To use a third-party SMS platform in the Quick Audience User Marketing module, you must follow these API specifications during development.
Common parameters for SMS requests
URL parameter | Meaning | Example |
timestamp | Timestamp in seconds | 1631865523 |
nonce | 32-character random string | 2e6eceb5737b473284c930c8ef79090e |
Example request URL:
{URL of the third-party SMS API}?timestamp=1631865523&nonce=2e6eceb5737b473284c930c8ef79090eHeader | Meaning | Description |
X-QA-Hmac-Signature | Authentication signature | Used when authentication is enabled. For the authentication method, see the following section. If authentication is disabled, set this header to an empty string (""). |
SMS request authentication
If text messages require authentication, you must enable authentication and enter a key when you configure the third-party SMS API. For more information, see Create a Third-party SMS Platform API.
Quick Audience uses the key that you provide, along with the `timestamp` and `nonce` URL parameters, to generate an HmacSHA256Hex signature. This signature is then passed in the request header. After your service receives the request, it performs the same HmacSHA256Hex encryption using the URL parameters and the key that is configured for the webhook channel. If the calculated value matches the signature from the request header, authentication is successful and the request is confirmed to be from Quick Audience.
Parameter | Meaning | Example |
key | The key configured for the webhook. | 123456789 |
Example signature algorithm:
public String makeSignature(String key, String timestamp, String nonce) {
String str = generateStr(key, timestamp, nonce);
return HmacUtils.hmacSha256Hex(key, str.replaceAll("\\s+", ""));
}
/**
* Concatenates the string to be signed.
*/
public static String generateStr(String key, String timestamp, String nonce){
String[] array = new String[] { key, timestamp, nonce};
StringBuffer sb = new StringBuffer();
// Sorts the strings.
Arrays.sort(array);
for (int i = 0; i < 3; i++) {
sb.append(array[i]);
}
return sb.toString();
}1. Query the review status of an SMS signature
API description | Query the review status of an SMS signature. | |||
URL | ${prefix}/sms/smsSign/{signName}?timestamp=&nonce= | |||
Request method | get | |||
Request type | application/json | |||
Return type | */* | |||
Parameter name | Data type | Parameter type | Required | Description |
1.signName | string | path | Yes | The SMS signature. |
Status code | Description | Description | ||
200 | OK | The request is successful. | ||
401 | Unauthorized | The request is not authorized. | ||
403 | Forbidden | The request is denied. | ||
404 | Not Found | The requested resource does not exist. | ||
Return Property Name | Type | Description | ||
1.platformName | string | The name of the SMS service provider. This must be the same as the API name that you entered during configuration. | ||
2.code | string | The status code of the request. A value of 200 or OK indicates that the request is successful. | ||
3.createDate | string | The date and time when the SMS signature was created. For example: 2019-01-08 16:44:13. | ||
4.message | string | The description of the status code. | ||
5.reason | string | The review comments. If the review status is "Approved" or "Pending review", the Reason parameter displays "No review comments". If the review status is "Rejected", the Reason parameter displays the specific reason for rejection. | ||
6.requestId | string | The request ID. | ||
7.signName | string | The SMS signature. | ||
8.signStatus | integer(int32) | The review status of the signature.
| ||
Example | ||||
Request parameters | No example | |||
Return value | {"reason":"string","code":"string","signName":"string","requestId":"string","signStatus":0,"platformName":"string","message":"string","createDate":"string"} | |||
2. Create a text SMS template
API description | SMS template review | |||
URL | ${prefix}/sms/smsTemplate?timestamp=&nonce= | |||
Request method | post | |||
Request type | application/json | |||
Return type | */* | |||
Parameter | Data type | Parameter type | Required | Description |
1.remark | string | body | Yes | The description for the SMS template request. Describe the business scenario in the request description. The description must be 1 to 100 characters in length. |
2.templateContent | string | Yes | The template content. The content must be 1 to 500 characters in length. | |
3.templateName | string | Yes | The template name. The name must be 1 to 30 characters in length. | |
4.templateType | string | Yes | The type of the text message.
| |
5.creatorAccount | string | Yes | The Quick Audience account of the user who created the template. The account name must be 1 to 255 characters in length. | |
Status code | Description | Description | ||
200 | OK | The request is successful. | ||
401 | Unauthorized | The request is not authorized. | ||
403 | Forbidden | The request is denied. | ||
404 | Not Found | The requested resource does not exist. | ||
Returned Property Name | Type | Description | ||
1.platformName | string | The name of the SMS service provider. This must be the same as the API name that you entered during configuration. | ||
2.code | string | The status code of the request. A value of 200 or OK indicates that the request is successful. | ||
3.message | string | The description of the status code. | ||
4.requestId | string | The request ID. | ||
5.templateCode | string | The code of the SMS template. This code is used to check the status and result of the template request. | ||
Example | ||||
Request parameters | -d '{"remark":"string","templateContent":"string","templateName":"string","templateSubject":"string","templateType":0,"creatorAccount":"string"}' | |||
Return value | {"platformName":"string","code":"string","templateCode":"string","message":"string","requestId":"string"} | |||
3. Modify a text SMS template
API description | Modify an SMS template. | |||
URL | ${prefix}/sms/smsTemplate/{templateCode}?timestamp=&nonce= | |||
Request method | put | |||
Request type | application/json | |||
Response type | */* | |||
Parameter | Data type | Parameter type | Required | Description |
1.remark | string | body | Yes | The description for the SMS template request. Describe the business scenario in the request description. The description must be 1 to 100 characters in length. |
2.templateContent | string | Yes | The template content. The content must be 1 to 500 characters in length. | |
3.templateName | string | Yes | The template name. The name must be 1 to 30 characters in length. | |
4.templateType | string | Yes | The type of the text message.
| |
5.modifierAccount | string | Yes | The Quick Audience account of the user who modified the template. The account name must be 1 to 255 characters in length. | |
Status code | Description | Description | ||
200 | OK | The request is successful. | ||
401 | Unauthorized | The request is not authorized. | ||
403 | Forbidden | The request is denied. | ||
404 | Not Found | The requested resource does not exist. | ||
Return Property Name | Type | Description | ||
1.platformName | string | The name of the SMS service provider. This must be the same as the API name that you entered during configuration. | ||
2.code | string | The status code of the request. A value of 200 or OK indicates that the request is successful. | ||
3.message | string | The description of the status code. | ||
4.requestId | string | The request ID. | ||
5.templateCode | string | The code of the SMS template. This code is used to check the status and result of the template request. | ||
Example | ||||
Request parameters | -d '{"remark":"string","templateContent":"string","templateName":"string","templateSubject":"string","templateType":0,"modifierAccount":"string"}' | |||
Return value | {"platformName":"string","code":"string","templateCode":"string","message":"string","requestId":"string"} | |||
4. Query the review status of an SMS template
API description | Query the review status of an SMS template. | |||
URL | ${prefix}/sms/smsTemplate/{templateCode}?timestamp=&nonce= | |||
Request method | get | |||
Request type | application/json | |||
Response type | */* | |||
Parameter | Data type | Parameter type | Required | Description |
1.templateCode | string | path | Yes | The template code. |
Status code | Description | Description | ||
200 | OK | The request is successful. | ||
401 | Unauthorized | The request is not authorized. | ||
403 | Forbidden | The request is denied. | ||
404 | Not Found | The requested resource does not exist. | ||
Returned Property Name | Type | Description | ||
1.platformName | string | The name of the service provider. This must be the same as the API name that you entered during configuration. | ||
2.code | string | The status code of the request. A value of 200 or OK indicates that the request is successful. | ||
3.createDate | string | The date and time when the template was created. For example: 2019-01-08 16:44:13. | ||
4.message | string | The description of the status code. | ||
5.reason | string | The review comments. If the review status is "Approved" or "Pending review", the Reason parameter displays "No review comments". If the review status is "Rejected", the Reason parameter displays the specific reason for rejection. | ||
6.requestId | string | The request ID. | ||
7.templateCode | string | The template code. | ||
8.templateContent | string | The template content. | ||
9.templateName | string | The template name. | ||
10.templateStatus | integer(int32) | The review status of the template.
| ||
11.templateType | integer(int32) | The type of the SMS template.
| ||
Example | ||||
Request parameters | No example | |||
Return value | {"templateStatus":0,"templateType":0,"reason":"string","code":"string","templateName":"string","requestId":"string","templateContent":"string","platformName":"string","templateCode":"string","message":"string","createDate":"string"} | |||
5. Batch send text messages API 1 (Not recommended)
This API sends text messages in batches by specifying a file of mobile phone numbers that is stored in OSS. This API is being deprecated. We recommend that you use 6. Batch send text messages API 2 (Recommended) instead.
API description | Send text messages in batches. The mobile phone numbers are stored in OSS. | |||
URL | ${prefix}/sms/sendBatch?timestamp=&nonce= | |||
Request method | post | |||
Request type | application/json | |||
Return type | */* | |||
Parameter Name | Data type | Parameter type | Required | Description |
1.limit | integer(int64) | body | No | The maximum number of recipients. |
2.outId | string | Yes | The external transaction extension field. | |
3.phoneOssUrl | string | Yes | The OSS path of the file that contains the mobile phone numbers of the recipients. The file must be in .txt format. For Domestic SMS, use 11-digit mobile phone numbers, such as 159********. For international messages or messages to Hong Kong (China), Macao (China), and Taiwan (China), use the format of `area code`+`number`, such as 85200******. Each number must be on a new line. For messages with variables, add the variable name and its replacement value after the mobile phone number on each line. For example: `{"name":"TemplateParamJson","age":"age"}`. | |
4.signName | string | Yes | The name of the SMS signature. | |
5.templateCode | string | Yes | Template code. | |
6.isVariable | integer(int64) | Yes | Specifies whether the message contains variables.
| |
Status code | Description | Description | ||
200 | OK | The request is successful. | ||
401 | Unauthorized | The request is not authorized. | ||
403 | Forbidden | The request is denied. | ||
404 | Not Found | The requested resource does not exist. | ||
Returned Property Name | Type | Description | ||
1.bizId | string | The ID of the delivery receipt. | ||
2.platformName | string | The name of the service provider. This must be the same as the API name that you entered during configuration. | ||
3.code | string | The status code of the request. A value of 200 or OK indicates that the request is successful. | ||
4.message | string | The description of the status code. | ||
5.requestId | string | The request ID. | ||
Example | ||||
Request parameters | -d '{"limit":0,"outId":"string","phoneOssUrl":"string","signName":"string","templateCode":"string","isVariable":"string"}' | |||
Return value | {"bizId":"string","platformName":"string","code":"string","message":"string","requestId":"string"} | |||
6. Batch send text messages API 2 (Recommended)
This API sends text messages to a list of mobile phone numbers.
API description | Batch send text messages | |||
URL | ${prefix}/sms/sendBatchList?timestamp=&nonce= | |||
Request method | post | |||
Request type | application/json | |||
Response type | */* | |||
Parameter | Data type | Parameter type | Required | Description |
1.limit | integer(int64) | body | No | The maximum number of recipients. |
2.outId | string | Yes | The external transaction extension field. | |
3.phoneNumberJson | List | Yes | A list of mobile phone numbers to receive the text messages. For example: `["1390000****","1390001****"]`. Note: The asterisks (****) are used for data masking in this document. Use 11-digit plaintext mobile phone numbers in actual use. | |
4.templateParamJson | string | No | A list of actual values for the variables in the SMS template. For example: `[{"name":"aaa","age":123},{"name":"bbb","age":456}]`. The values within each pair of curly braces `{}` correspond to the variables for one mobile phone number. The order of the value sets must match the order of the mobile phone numbers. | |
5.signName | string | Yes | The name of the SMS signature. | |
6.templateCode | string | Yes | The template code. | |
7.relatedAudienceId | string | No | The associated audience group ID. If the associated marketing campaign is an Automated Marketing campaign that starts with a Behavior Event Component, pass `null` for the audience group ID. If the campaign starts with a Target Audience Component, there may be multiple audience group IDs. Separate multiple IDs with commas (,). Note: This parameter only indicates the associated audience group IDs and does not represent the actual number of text messages sent. | |
8.relatedTaskId | string | No | The associated marketing campaign ID. | |
9.relatedTaskType | integer(int64) | No | The type of the associated marketing campaign.
| |
10.taskCreatorAccount | string | No | The Quick Audience account of the user who created the associated marketing campaign. The maximum length is 36 characters. | |
Status code | Description | Description | ||
200 | OK | The request is successful. | ||
401 | Unauthorized | The request is not authorized. | ||
403 | Forbidden | The request is denied. | ||
404 | Not Found | The requested resource does not exist. | ||
Returned Property Name | Type | Description | ||
1.bizId | string | The ID of the delivery receipt. | ||
2.platformName | string | The name of the service provider. This must be the same as the API name that you entered during configuration. | ||
3.code | string | The status code of the request. A value of 200 or OK indicates that the request is successful. | ||
4.message | string | The description of the status code. | ||
5.requestId | string | The request ID. | ||
Example | ||||
Request parameters | -d '{"limit":0,"relatedAudienceId":"string","relatedTaskId":"string","relatedTaskType":1,"taskCreatorAccount":"string","outId":"string","signName":"string","templateCode":"string","phoneNumberJson":["1390000****","1390001****"],"templateParamJson":[{"name":"aaa","age":123},{"name":"bbb","age":456}]}' Note: The asterisks (****) in the mobile phone numbers are used for data masking in this document. Use 11-digit plaintext mobile phone numbers in actual use. | |||
Return value | {"bizId":"string","platformName":"string","code":"string","message":"string","requestId":"string"} | |||
7. Create a digital message template
This API sends batch text messages to a list of mobile phone numbers.
API description | Create a digital message template. | |||
URL | ${prefix}/sms/digitalSmsTemplate?timestamp=&nonce= | |||
Request method | post | |||
Request type | application/json | |||
Return type | */* | |||
Parameter | Data type | Parameter type | Required | Description |
1.remark | string | body | Yes | The description for the SMS template request. Describe the business scenario in the request description. The description must be 1 to 100 characters in length. |
2.templateContent | string | Yes | The template content. This is a list that can include text, images, and videos. Each element in the list is a key-value pair. For example: `[{"fileSuffix":"jpg","fileName":"File Name","fileSize":"23","fileContents":"url","index":"1"},{"fileSuffix":"txt","fileName":"","fileSize":"10","fileContents":"Text","index":"2"}]` | |
3.templateTheme | string | Yes | The template subject. The subject must be 1 to 30 characters in length. | |
4.smsSignName | Yes | The SMS signature. | ||
5.creatorAccount | string | Yes | The Quick Audience account of the user who created the template. The account name must be 1 to 255 characters in length. | |
6.isVariable | boolean | Yes | Specifies whether the template contains variables. `true`: The template contains variables. `false`: The template does not contain variables. | |
Status code | Description | Description | ||
200 | OK | The request is successful. | ||
401 | Unauthorized | The request is not authorized. | ||
403 | Forbidden | The request is denied. | ||
404 | Not Found | The requested resource does not exist. | ||
Returned Property Name | Type | Description | ||
1.platformName | string | The name of the SMS service provider. This must be the same as the API name that you entered during configuration. | ||
2.code | string | The status code of the request. A value of 200 or OK indicates that the request is successful. | ||
3.message | string | The description of the status code. | ||
4.requestId | string | The request ID. | ||
5.templateCode | string | The code of the SMS template. This code is used to check the status and result of the template request. The template code must be 30 characters or less in length. | ||
Example | ||||
Request parameters | -d '{"remark":"string","templateContent":"[{"fileSuffix":"jpg","fileName":"File Name","fileSize":"23","fileContents":"url","index":"1"},{"fileSuffix":"txt","fileName":"","fileSize":"10","fileContents":"Text","index":"2"}]","templateTheme":"string","templateSubject":"string","creatorAccount":"string","isVariable":true}' Note: `templateContent` is a list converted to a string. `fileSuffix` is the file extension. `fileName` is the file name. `fileSize` is the file size. `fileContents` is the file content. For text, this is the text itself. For images, videos, or audio, this is a publicly accessible OSS URL from Quick Audience that is valid for one year. You can download the file from this URL. `index` is the order of the file. | |||
Return value | {"platformName":"string","code":"string","templateCode":"string","message":"string","requestId":"string"} | |||
8. Edit a digital message template
API description | Creating Digital SMS Templates | |||
URL | ${prefix}/sms/digitalSmsTemplate/{templateCode}?timestamp=&nonce= | |||
Request method | put | |||
Request type | application/json | |||
Response type | */* | |||
Parameter name | Data type | Parameter type | Required | Description |
1.remark | string | body | Yes | The description for the SMS template request. Describe the business scenario in the request description. The description must be 1 to 100 characters in length. |
2.templateContent | string | Yes | The template content. This is a list that can include text, images, and videos. Each element in the list is a key-value pair. For example: `[{"fileSuffix":"jpg","fileName":"File Name","fileSize":"23","fileContents":"url","index":"1"},{"fileSuffix":"txt","fileName":"","fileSize":"10","fileContents":"Text","index":"2"}]` | |
3.templateTheme | string | Yes | The template subject. The subject must be 1 to 30 characters in length. | |
4.smsSignName | Yes | The SMS signature. | ||
5.creatorAccount | string | Yes | The Quick Audience account of the user who created the template. The account name must be 1 to 255 characters in length. | |
6.isVariable | boolean | Yes | Specifies whether the template contains variables. `true`: The template contains variables. `false`: The template does not contain variables. | |
Status code | Description | Description | ||
200 | OK | The request is successful. | ||
401 | Unauthorized | The request is not authorized. | ||
403 | Forbidden | The request is denied. | ||
404 | Not Found | The requested resource does not exist. | ||
Return Property Name | Type | Description | ||
1.platformName | string | The name of the SMS service provider. This must be the same as the API name that you entered during configuration. | ||
2.code | string | The status code of the request. A value of 200 or OK indicates that the request is successful. | ||
3.message | string | The description of the status code. | ||
4.requestId | string | The request ID. | ||
5.templateCode | string | The code of the SMS template. This code is used to check the status and result of the template request. | ||
Example | ||||
Request parameters | -d '{"remark":"string","templateContent":"[{"fileSuffix":"jpg","fileName":"File Name","fileSize":"23","fileContents":"url","index":"1"},{"fileSuffix":"txt","fileName":"","fileSize":"10","fileContents":"Text","index":"2"}]","templateTheme":"string","templateSubject":"string","creatorAccount":"string","isVariable":true}' Note: `templateContent` is a list converted to a string. `fileSuffix` is the file extension. `fileName` is the file name. `fileSize` is the file size. `fileContents` is the file content. For text, this is the text itself. For images, videos, or audio, this is a publicly accessible OSS URL from Quick Audience that is valid for one year. You can download the file from this URL. `index` is the order of the file. | |||
Return value | {"platformName":"string","code":"string","templateCode":"string","message":"string","requestId":"string"} | |||
9. Delete a digital message template
API description | Creating a digital message template | |||
URL | ${prefix}/sms/digitalSmsTemplate/{templateCode}?timestamp=&nonce= | |||
Request method | delete | |||
Request type | application/json | |||
Response type | */* | |||
Parameter | Data type | Parameter type | Required | Description |
templateCode | string | Yes | The template code. This is the code returned when the template was created. | |
Status code | Description | Description | ||
200 | OK | The request is successful. | ||
401 | Unauthorized | The request is not authorized. | ||
403 | Forbidden | The request is denied. | ||
404 | Not Found | The requested resource does not exist. | ||
Returned Property Name | Type | Description | ||
1.platformName | string | The name of the SMS service provider. This must be the same as the API name that you entered during configuration. | ||
2.code | string | The status code of the request. A value of 200 or OK indicates that the request is successful. | ||
3.message | string | The description of the status code. | ||
4.requestId | string | The request ID. | ||
5.templateCode | string | The code of the SMS template. This code is used to check the status and result of the template request. | ||
Example | ||||
Request parameters | No example | |||
Return value | {"platformName":"string","code":"string","templateCode":"string","message":"string","requestId":"string"} | |||
10. Query the review status of a digital message template
API description | Query the review status of an SMS template. | |||
URL | ${prefix}/sms/digitalSmsTemplate/{templateCode}?timestamp=&nonce= | |||
Request method | get | |||
Request type | application/json | |||
Response type | */* | |||
Parameter | Data type | Parameter type | Required | Description |
1.templateCode | string | path | Yes | The template code. |
Status code | Description | Description | ||
200 | OK | The request is successful. | ||
401 | Unauthorized | The request is not authorized. | ||
403 | Forbidden | The request is denied. | ||
404 | Not Found | The requested resource does not exist. | ||
Returned Property Name | Type | Description | ||
1.platformName | string | The name of the service provider. This must be the same as the API name that you entered during configuration. | ||
2.code | string | The status code of the request. A value of 200 or OK indicates that the request is successful. | ||
3.createDate | string | The date and time when the template was created. For example: 2019-01-08 16:44:13. | ||
4.message | string | The description of the status code. | ||
5.reason | string | The review comments. If the review status is "Approved" or "Pending review", the Reason parameter displays "No review comments". If the review status is "Rejected", the Reason parameter displays the specific reason for rejection. | ||
6.requestId | string | The request ID. | ||
7.templateCode | string | The template code. | ||
8.supportFactory | string | The review status from each carrier. This is a map where the key is the carrier's name, such as UNICOM for China Unicom, MOBILE for China Mobile, and TELCOM for China Telecom. For example: {"UNICOM":"Success","MOBILE":"Reason for failure","TELCOM":"Reason for failure"} | ||
9.templateName | string | The template name. | ||
10.templateStatus | integer(int32) | The review status of the template.
| ||
Example | ||||
Request parameters | No example | |||
Return value | {"templateStatus":0,"reason":"string","code":"string","templateName":"string","requestId":"string","supportFactory":"{\"UNICOM\":\"Success\",\"MOBILE\":\"Reason for failure\",\"TELCOM\":\"Reason for failure\"}","platformName":"string","templateCode":"string","message":"string","createDate":"string"} | |||
11. Batch send digital messages
This API sends a batch of digital messages to multiple mobile phone numbers.
API description | Batch send text messages | |||
URL | ${prefix}/sms/sendDigitalBatchList?timestamp=&nonce= | |||
Request method | post | |||
Request type | application/json | |||
Return type | */* | |||
Parameter name | Data type | Parameter type | Required | Description |
1.limit | integer(int64) | body | No | The maximum number of recipients. |
2.outId | string | Yes | The external transaction extension field. | |
3.phoneNumberJson | List | Yes | A list of mobile phone numbers to receive the text messages. For example: `["1390000****","1390001****"]`. Note: The asterisks (****) are used for data masking in this document. Use 11-digit plaintext mobile phone numbers in actual use. | |
4.templateParamJson | string | No | A list of actual values for the variables in the SMS template. For example: `[{"name":"aaa","age":123},{"name":"bbb","age":456}]`. The values within each pair of curly braces `{}` correspond to the variables for one mobile phone number. The order of the value sets must match the order of the mobile phone numbers. | |
5.signName | string | Yes | The name of the SMS signature. | |
6.templateCode | string | Yes | The template code. | |
7.relatedAudienceId | string | No | The associated audience group ID. If the associated marketing campaign is an Automated Marketing campaign that starts with a Behavior Event Component, pass `null` for the audience group ID. If the campaign starts with a Target Audience Component, there may be multiple audience group IDs. Separate multiple IDs with commas (,). Note: This parameter only indicates the associated audience group IDs and does not represent the actual number of text messages sent. | |
8.relatedTaskId | string | No | The associated marketing campaign ID. | |
9.relatedTaskType | integer(int64) | No | The type of the associated marketing campaign.
| |
10.taskCreatorAccount | string | No | The Quick Audience account of the user who created the associated marketing campaign. The maximum length is 36 characters. | |
Status code | Description | Description | ||
200 | OK | The request is successful. | ||
401 | Unauthorized | The request is not authorized. | ||
403 | Forbidden | The request is denied. | ||
404 | Not Found | The requested resource does not exist. | ||
Return Property Name | Type | Description | ||
1.bizId | string | The ID of the delivery receipt. | ||
2.platformName | string | The name of the service provider. This must be the same as the API name that you entered during configuration. | ||
3.code | string | The status code of the request. A value of 200 or OK indicates that the request is successful. | ||
4.message | string | The description of the status code. | ||
5.requestId | string | The request ID. | ||
Example | ||||
Request parameters | -d '{"limit":0,"relatedAudienceId":"string","relatedTaskId":"string","relatedTaskType":1,"taskCreatorAccount":"string","outId":"string","signName":"string","templateCode":"string","phoneNumberJson":["1390000****","1390001****"],"templateParamJson":[{"name":"aaa","age":123},{"name":"bbb","age":456}]}' Note: The asterisks (****) in the mobile phone numbers are used for data masking in this document. Use 11-digit plaintext mobile phone numbers in actual use. | |||
Return value | {"bizId":"string","platformName":"string","code":"string","message":"string","requestId":"string"} | |||
12. Query SMS sending details (Not recommended)
Note: This API is not recommended. We recommend that you use the 13. Push delivery receipts (Recommended) API instead.
API description | Query SMS sending details. | |||
URL | ${prefix}/sms/sendDetails?timestamp=&nonce= | |||
Request method | post | |||
Request type | application/json | |||
Response type | */* | |||
Parameter name | Data type | Parameter type | Required | Description |
1.outId | string | body | Yes | The external transaction extension field. |
2.currentPage | integer(int64) | Yes | The current page number of the sending records to view. This is used for paging. | |
3.pageSize | integer(int64) | Yes | The number of SMS records to display on each page. This is used for paging. The value must be between 1 and 1,000. | |
4.startDate | string | Yes | The start time. The time span between the start and end times cannot exceed 30 days. The format is yyyy-MM-dd HH:mm:ss. | |
5.endDate | string | Yes | The end time. The time span between the start and end times cannot exceed 30 days. The format is yyyy-MM-dd HH:mm:ss. | |
Status code | Description | Description | ||
200 | OK | The request is successful. | ||
401 | Unauthorized | The request is not authorized. | ||
403 | Forbidden | The request is denied. | ||
404 | Not Found | The requested resource does not exist. | ||
Returned Property Name | Type | Description | ||
1.platformName | string | The name of the SMS service provider. This must be the same as the API name that you entered during configuration. | ||
2.code | string | The status code of the request. A value of 200 or OK indicates that the request is successful. | ||
3.message | string | The description of the status code. | ||
4.requestId | string | The request ID. | ||
5.sendDetailDTOs | array:SmsSendDetailDTO | The details of the sent text messages. | ||
5.1.content | string | The content of the text message. | ||
5.2.errCode | string | The carrier's SMS status code. If the message is sent successfully, the value is DELIVERED. If the message fails to be sent, an error code is returned. | ||
5.3.outId | string | The external transaction extension field. | ||
5.4.phoneNum | string | The mobile phone number of the recipient. | ||
5.5.receiveDate | string | The date and time when the text message was received. | ||
5.6.sendDate | string | The date and time when the text message was sent. | ||
5.7.sendStatus | integer(int64) | Text message send status.
| ||
5.8.templateCode | string | The ID of the SMS template. | ||
6.totalCount | integer(int32) | The total number of text messages sent. | ||
Example | ||||
Request parameters | -d '{"outId":"string","currentPage":0,"pageSize":0,"startDate":"string","endDate":"string"}' | |||
Return value | {"platformName":"string","code":"string","message":"string","totalCount":0,"requestId":"string","sendDetailDTOs":[{"content":"string","errCode":"string","outId":"string","phoneNum":"string","receiveDate":"string","sendDate":"string","sendStatus":0,"templateCode":"string"}]} | |||
13. Push delivery receipts (Recommended)
Note:
1. This callback can be used for the delivery receipts of both text messages and digital messages.
2. For a single API call, all entries in the delivery receipt list must have the same `outId`.
3. You must use the key, timestamp, and nonce to calculate a signature and include the signature in the request header. If authentication fails repeatedly and exceeds the limit, the IP address is blocked.
4. Data authentication is required.
URL:
Environment prefix + /restapi/marketing2/third/sms/callback/send/details?timestamp=xxx&nonce=xxx
URL parameter descriptions:
Parameter | Type | Description |
Environment prefix | String | The callback address for Quick Audience. Zhangbei: https://quicka.aliyun.com Shanghai: https://quicka-shanghai.aliyun.com |
timestamp | String | The timestamp. Used with `nonce` to prevent replay attacks. |
nonce | String | A random number. Used with `timestamp` to prevent replay attacks. |
Header:
Header | Meaning | Description |
X-QA-Hmac-Signature | Authentication signature | Used when authentication is enabled. For the authentication method, see the following section. If authentication is disabled, set this header to an empty string (""). |
Content-Type | Request type | application/json |
Returned Property Name | Type | Description | ||
1.code | string | The status code of the request. A value of 200 or OK indicates that the request is successful. 401: The request is not authorized. 403: The request is denied. 404: The requested resource does not exist. | ||
2.message | string | The description of the status code. | ||
Body:
{
"thirdSmsSendDetailModelList":[
{
"outId":"The outId passed during the third-party SMS sending.",
"phoneNum":"The mobile phone number.",
"sendStatus":"The SMS sending status. 1: Failed. 2: Successful.",
"sendDate":"The time when the text message was sent, in the format yyyy-MM-dd HH:mm:ss.",
"receiveDate":"The time when the delivery receipt was received, in the format yyyy-MM-dd HH:mm:ss.",
"errCode":"The status code after a failed SMS delivery.",
"message":"The error message after a failed SMS delivery."
}
]
}14. SMS reply callback
Note:
1. This callback can be used for the replies to both text messages and digital messages.
URL:
Environment prefix + /restapi/marketing2/third/sms/callback/send/reply?timestamp=xxx&nonce=xxx
URL parameter descriptions:
Parameter | Type | Description |
Environment prefix | String | The callback address for Quick Audience. Zhangbei: https://quicka.aliyun.com Shanghai: https://quicka-shanghai.aliyun.com |
timestamp | String | The timestamp. Used with `nonce` to prevent replay attacks. |
nonce | String | A random number. Used with `timestamp` to prevent replay attacks. |
Header:
Header | Meaning | Description |
X-QA-Hmac-Signature | Authentication signature | Used when authentication is enabled. For the authentication method, see the following section. If authentication is disabled, set this header to an empty string (""). |
Body:
{
"thirdSmsSendReplyModelList":[
{
"outId":"The outId passed during the third-party SMS sending.",
"phoneNum":"The mobile phone number.",
"sendTime":"The reply time, in the format yyyy-MM-dd HH:mm:ss.",
"content":"The reply content."
}
]
}