This topic describes how to set the modes in which the delivery reports of text messages are consumed.
Consumption mode of Message Service (MNS) message queue
Short Message Service (SMS) can push message delivery reports to MNS queues. You can enable this feature in the SMS console. The system creates a message queue, and displays the name of the queue. You can call the SDK to pull the reports based on the message type (MNS subscription) and queue name.
The following table describes the parameters of a message delivery report.
Parameter | Type | Description | Example |
---|---|---|---|
PhoneNumber | String | The mobile phone number of the recipient. | 1300***0000 |
SendStatus | String | The sending status.
|
Deliverd |
BizId | String | The ID of the delivery receipt. | 1234^345 |
ExternalId | String | The ID of the batch. Set this parameter to the value of the outId parameter that is specified when you call an API operation to send text messages. | 123456 |
SendDate | String | The time when the text message was sent. | 2017-06-01 10:00:00 |
ReceiveDate | String | The time when the SMS delivery receipt was received from the carrier. | 2017-06-01 10:00:05 |
ErrorCode | String | The error code. | UNKNOW |
ErrorMessage | String | The error message. | Unknown error. |
SmsQuantity | String | Each text message must be 1 to 140 bytes in length. If a text message exceeds 140 bytes, it is separated into multiple text messages. | 1, 2, 3 |
Push message delivery reports in batches to an HTTP URL
SMS can send HTTP POST requests to push message delivery reports in batches to an HTTP URL (callback URL). You can enable this feature in the SMS console and set the URL that receives the reports. Then, you can pull the reports from the URL.
The following table describes the parameters of a message delivery report.
Parameter | Description |
---|---|
Protocol | HTTP + JSON |
Encoding | UTF-8 |
Each HTTP request is formatted as a JSON array, and can contain multiple message delivery reports.
Request description
- Sample request
[ { "PhoneNumber" : "13900000001", "SendDate" : "2017-01-01 00:00:00", "ReceiveDate" : "2017-01-01 00:00:00", "SendStatus" : DELIVERD, "ErrorCode" : "UNKNOW", "ErrorMessage" : "Unknown error.", "SmsQuantity" : "1,2,3", "BizId" : "1234567^0", "ExternalId" : "67890" } ]
- Parameters
Parameter Type Description Example Required PhoneNumber String The mobile phone number of the recipient. 13900000001 Yes SendDate String The time when the text message was sent. 2017-01-01 00:00:00 Yes ReceiveDate String The time when the SMS delivery receipt was received from the carrier. 2017-01-01 00:00:00 Yes SendStatus String The sending status. - 1 Deliverd
- 2 Failed
- 6 Expired
Deliverd Yes ErrorCode String The error code. UNKNOW Yes ErrorMessage String The error message. Unknown error. Yes SmsQuantity String Each text message must be 1 to 140 bytes in length. If a text message exceeds 140 bytes, it is separated into multiple text messages. 1,2,3 Yes BizId String The ID of the delivery receipt. 1234567^0 Yes ExternalId String The ID of the batch. Set this parameter to the value of the outId parameter that is specified when you call an API operation to send text messages. 67890 Yes
Response description
- Sample response
{ "code" : 0, "msg" : "The message is received." }
- Parameters
Parameter Type Description Example Required code Number The code of the response 0 Yes msg String The description of the response Received The message is received.