SmsReport: HTTP batch push pattern

Updated at:

You can specify an HTTP URL to receive SMS delivery reports. After you send a text message by calling an API, SmsReport pushes the message status to the URL that you provided.

Important

The idempotence of delivery receipts cannot be guaranteed. We recommend that you take appropriate measures to ensure the correctness and consistency of your data after receiving a delivery receipt.

Protocol description

Parameter

Description

Protocol

HTTP + JSON

Encoding

UTF-8

SmsReport delivery receipt format

The POST data is a JSON array. Delivery receipts are merged, so a single push can contain multiple status reports.

Name

Type

Example

Description

To

String

8521234****

The recipient's phone number.

Status

String

1

The sending status.

  • 1: Success

  • 2: Failed

  • 6: Invalid

MessageId

String

123456789****

The delivery receipt ID.

SmsSize

String

1

The number of text messages. Long text messages are split and sent as multiple messages.

TaskId

String

123456

The batch ID. This is the taskId passed when you call the sending API.

SendDate

String

Thu, 25 Nov 2021 10:27:00 +0800

The time when the message was submitted to the carrier.

ReceiveDate

String

Thu, 25 Nov 2021 10:27:33 +0800

The time when the delivery receipt was received from the carrier.

ErrorCode

String

success

The error code.

ErrorDescription

String

success

The error message.

Example

[{
    "To" : "8521111****",
    "SendDate" : "Thu, 25 Nov 2021 10:25:00 +0800",
    "ReceiveDate" : "Thu, 25 Nov 2021 10:25:33 +0800",
    "Status" : "1",
    "ErrorCode" : "success",
    "ErrorDescription" : "success",
    "TaskId" : "67890",
    "SmsSize":"2",
    "MessageId" : "123450000****"
  }]

Response description

After you receive a delivery receipt, the response must have an HTTP status code of 200 and a response body in the following format. Otherwise, the push fails and a retry is triggered.

  • Response example

    {
      "code" : 0,
      "msg" : "Accepted successfully"
    }
  • Field description

    Name

    Type

    Required

    Example

    Description

    code

    Number

    Yes

    0

    The acknowledgement code.

    msg

    String

    No

    Accepted successfully

    The description.

Retries

If the initial push fails, the system retries after 1 minute and again after 5 minutes. If the push still fails after a total of three attempts, the system stops retrying.