All Products
Search
Document Center

Short Message Service:SMS webhook

Last Updated:Jul 04, 2024

You can specify a callback URL to retrieve delivery receipts from the HTTP server. By setting up a callback URL, you can ensure that you receive timely and accurate information about the status of your SMS messages.

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

Parameter

Description

Protocol

HTTP + JSON

Encoding

UTF-8

Request parameters

The data of a POST request is in the JSON Array format. Multiple delivery receipts may be pushed to the HTTP server at a time.

Parameter

Type

Example

Description

To

String

8521234****

The mobile phone number that receives delivery receipts.

Status

String

1

The status of the message.

  • 1: The message was sent.

  • 2: The message failed to be sent.

  • 6: The message expired.

MessageId

String

123456789****

The ID of the delivery receipt.

SmsSize

String

1

The number of messages. A long message is split into multiple messages.

TaskId

String

123456

The ID of the task.

SendDate

String

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

The time when the message was sent 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 parameters

If a delivery receipt is pushed to your HTTP server, 200 is returned. Otherwise, the system tries to push the delivery receipt again.

  • Sample response

    {
      "code" : 0,
      "msg" : "The message is received."
    }
  • Response parameters

    Parameter

    Type

    Required

    Example

    Description

    code

    Number

    Yes

    0

    The code of the response.

    msg

    String

    No

    Received

    The error message.

Retries

After the system fails to push a delivery receipt, it tries to push the delivery receipt again 1 minute or 5 minutes later until the delivery receipt is pushed. If the system fails to push a delivery receipt for three consecutive times, it stops pushing the delivery receipt.