5GSmsUp
When a user replies to or interacts with a 5G message, Alibaba Cloud pushes the mobile originated message to your specified HTTP endpoint. You must receive the message and return a response in the format required by the platform.
Description
By subscribing to 5GSmsUp mobile originated messages, you can receive mobile originated message content from end users, including three mobile originated types: user active input, user shortcut reply, and user click interaction.
Prerequisites
Before you can receive 5GSmsUp callbacks, complete the following steps:
Enable 5GSmsUp (mobile originated message reception) in the Short Message Service console.
Configure the Receiving Endpoint to specify the HTTP URL that receives callbacks.
Request parameters
The request body is in JSON array format. A single request may contain multiple mobile originated message entries.
Protocol
Parameter | Description |
Protocol | HTTP, POST method |
Content Type | application/json |
Encoding | UTF-8 |
Parameters
Name | Type | Required | Description |
| String | Yes | Phone number. Example: |
| String | Yes | Mobile originated type. Valid values: 1: User active input. 2: User shortcut reply. 3: User click interaction. |
| String | Yes | Mobile originated message content. The value depends on |
| String | Yes | Mobile originated message send time. Example: 2017-01-01 00:00:00. |
| String | Yes | Unique 5G message ID for this mobile originated message. When calling the |
| String | No | The ID of the message being replied to, that is, the 5G message ID of the mobile terminated message that the user is replying to. |
Request example
The following example shows a callback request body that contains one mobile originated message of click interaction type:
[
{
"phone_number": "1301122****",
"mobile_originated_type": "3",
"content": "{\"display_text\":\"xxxx\",\"post_data\":\"xxxx\",\"url\":\"xxxx\",\"application\":\"xxxx\"}",
"send_time": "2017-01-01 00:00:00",
"rcs_id": "100000096034031_1552101_03304904325170151776946304857",
"in_reply_to_rcs_id": "100000096034031_1552101_03304904325170151776946304858"
}
]Response parameters
After your HTTP endpoint receives the request, respond in the following format.
Parameters
Name | Type | Required | Example | Description |
| Number | Yes | 0 | Response code. The system only checks whether code is a number; the actual value is not validated. |
| String | No | received successfully | Description. |
Response example
The following example shows a successful response:
{
"code": 0,
"msg": "received successfully"
}- If the HTTP status code is 200, the request is successful. If the HTTP status code is non-200 or the response times out, the system retries the push. - If system errors or consumption failures occur, return an HTTP status code of 50X.
Retry mechanism
After the first push failure, the system retries at 1-minute, 5-minute, and 10-minute intervals until the push succeeds. If the push fails after 3 retries, no further retries are attempted.
Mobile originated message push notifications do not guarantee idempotence. In the event of network exceptions or response timeouts, duplicate delivery of messages may occur. If your downstream processing logic requires idempotence, implement deduplication based on rcs_id according to your business scenario.
Code sample
The following Java example demonstrates how to receive and respond to 5GSmsUp callbacks. For production deployments, implement deduplication based on rcs_id as described in the retry mechanism section.
@PostMapping("/resMsg")
public JSONObject resMsg(@RequestBody JSONArray array) {
// TODO: Process the mobile originated message content yourself.
// This example only prints the message information.
System.out.println(array.toJSONString());
JSONObject json = new JSONObject();
json.put("code", 0);
json.put("msg", "received successfully");
return json;
}