5GSmsReport
5GSmsReport pushes the delivery status of each 5G message to an HTTP endpoint that you specify. After you send a 5G message by calling SendRCS or SendRCSReply, the platform pushes the delivery status report to your endpoint, and your endpoint must respond in the format that the platform requires.
Usage instructions
Each report provides the delivery status of a 5G message and related information, including whether the message reached the end user.
Endpoint requirements
The platform pushes each delivery status report to your endpoint as an HTTP POST request. Make sure that your endpoint meets the following requirements:
Protocol — Your endpoint must accept HTTP POST requests with an
application/jsonrequest body. For details, see Protocol.Response status code — Your endpoint must return HTTP status code
200. If it returns any other status code, or if the response times out, the platform retries the push.Response body — Your endpoint must respond in the JSON format described in Response format.
Failure handling — If a system exception or consumption failure occurs, your endpoint must return HTTP status code
5xxso that the platform retries the push.Retries — The platform retries a failed push three times and then stops. For the retry intervals, see Retry mechanism.
Idempotency — Pushes are not guaranteed to be idempotent. Deduplicate reports by
rcs_idorbiz_idin your business logic.
Request parameters
The platform pushes the request parameters in JSON Array format. A single request can contain multiple delivery status reports. Reports are pushed in the same format whether you sent the messages individually or in a batch.
Protocol
Parameter | Description |
Request protocol | HTTP (POST method) |
Request format |
|
Encoding | UTF-8 |
Request example
The following example shows a push request that contains one delivery status report:
[
{
"phone_number" : "1350001234",
"send_time" : "2017-01-01 00:00:00",
"report_time" : "2017-01-01 00:00:00",
"send_status" : "SEND_SUCCESS",
"err_code" : "DELIVERED",
"err_message" : "User received successfully",
"rcs_template_code" : "RCS_SMS_10001052",
"rcs_template_type" : "0",
"rcs_template_format" : "PLAIN_TEXT",
"rcs_size" : 2,
"rcs_id" : "100000096034031_1552101_03304904325170151776946304855",
"in_reply_to_rcs_id" : "100000096034031_1552101_03304904325170151776946304856",
"biz_id" : "217124476946304664",
"out_id" : "12391244932857"
}
]Request fields
Name | Type | Description |
phone_number | String | The mobile phone number. |
send_time | String | The time when the message was sent. |
report_time | String | The time when the delivery status report was generated. |
send_status | String | The delivery status of the message. Valid values: - SEND_SUCCESS: The message was sent successfully. - SEND_FAILED: The message failed to send. |
err_code | String | The status report code. For valid values and descriptions, see err_code values. |
err_message | String | The delivery status report description. |
rcs_template_code | String | The 5G message template code. |
rcs_template_type | String | The message template type. Valid values: - 0: Verification code. - 1: Notification. - 2: Promotional message. |
rcs_template_format | String | The message template format. Valid values: - PLAIN_TEXT: Plain text template. - RCS: Rich media template. |
rcs_size | Integer | The number of message segments. The segment count is based on the byte length of the message text in UTF-8 encoding. One English letter or digit equals one byte. One Chinese character, including a traditional Chinese character, equals three bytes. Chinese punctuation equals three bytes, and English punctuation equals one byte. For example, a text message that contains 70 Chinese characters has a byte length of 210. |
rcs_id | String | The unique ID of the 5G message. |
in_reply_to_rcs_id | String | The ID of the message to which this message replies. |
biz_id | String | The delivery status report ID, which is the sending sequence number. This value is the |
out_id | String | The custom sequence number that was passed when the message was sent. This value is the |
err_code values
Category | err_code | Description |
Delivery successful | DELIVERED | The message was sent successfully. |
Parameter issue | PARAMS_ILLEGAL | The message sending parameters are invalid. |
Number/device issue | MOBILE_NOT_ON_SERVICE | A user-side issue, such as service suspension, an empty or unassigned number, account cancellation, mobile number portability, the 5G switch not being turned on, insufficient storage, or an invalid number. |
Number/device issue | MOBILE_NOT_SUPPORT_RCS | The device does not support 5G (RCS) messages. |
Number/device issue | MOBLLE_TERMINAL_ERROR | Another device issue, such as an unreachable device. |
Number/device issue | MOBILE_SEND_LIMIT | The number triggered rate limiting, such as a daily or monthly sending limit for an individual number, exceeding the rate limit, or sending messages too frequently. |
Number/device issue | MOBILE_IN_BLACK | The mobile phone number is on the blocklist. |
Number/device issue | USER_REJECT | The user requested to opt out of this service, or the product is not enabled. |
Signature issue | CHATBOT_NOT_USABLE | The signature is not published or is unavailable. |
System issue | SP_UNKNOWN_ERROR | An unknown carrier error occurred. |
Response format
After your endpoint receives the request parameters, it must respond in the following format.
Response example
The following example shows a valid response body:
{
"code" : 0,
"msg" : "Received successfully"
}Response fields
Name | Type | Required | Example value | Description |
code | Number | Yes | 0 | The response code. The platform checks only whether |
msg | String | No | Received successfully | The response description. |
If the HTTP status code is
200, the request succeeds. If the HTTP status code is not200or the response times out, the platform retries the push.If a system exception or consumption failure occurs, return HTTP status code
5xxto trigger a retry.
Retry mechanism
If a push fails, the platform retries at intervals of 1 minute, 5 minutes, and 10 minutes. If the push still fails after three retries, the platform makes no further retries.
Delivery status report pushes are not guaranteed to be idempotent. Network errors or response timeouts can cause duplicate pushes. If your downstream processing requires idempotence, implement idempotent processing based on rcs_id or biz_id for your business scenario.
Code example
The following Java snippet shows how to receive delivery status reports by using a Spring Boot controller:
@PostMapping("/resMsg")
public JSONObject resMsg(@RequestBody JSONArray array) {
// TODO: You need to handle delivery receipt messages yourself. This example only prints receipt information.
System.out.println(array.toJSONString());
JSONObject json = new JSONObject();
json.put("code", 0);
json.put("msg", "Received successfully");
return json;
}The controller prints each received report to standard output and returns the response body described in Response format. Make sure that the Receiving Address that you configured in the SMS Service console is the complete HTTP URL of the endpoint that handles the push. In this example, the endpoint path is /resMsg.