SmsReport: MNS message queue consumption pattern

更新时间:
复制 MD 格式

You can use an MNS message queue to receive SMS delivery reports.

Prerequisites

  • You have an Alibaba Cloud account and have created an AccessKey. For more information, see Create an AccessKey.

  • Ensure that the environment where your MNS message consumption program runs can access the following two addresses: dybaseapi.ap-southeast-1.aliyuncs.com or 1493622401794734.mns.ap-southeast-1.aliyuncs.com.

Important

Delivery receipts do not guarantee idempotence. You must handle idempotence. After you receive a receipt, take appropriate steps to ensure data correctness and consistency.

SmsReport delivery receipt message body format

Name

Type

Example

Description

To

String

8521234****

The recipient's phone number.

Status

String

1

The delivery status.

  • 1: Success

  • 2: Failed

  • 6: Expired

MessageId

String

123456789****

The ID of the delivery receipt.

SmsSize

String

1

The number of text messages.

Long text messages are split into multiple parts.

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" : "8521234****",
    "SendDate" : "Thu, 25 Nov 2021 10:27:00 +0800",
    "ReceiveDate" : "Thu, 25 Nov 2021 10:27:33 +0800",
    "Status" : "1",
    "SmsSize":"1",
    "ErrorCode" : "success",
    "ErrorDescription" : "success",
    "MessageId" : "123456789****"
  }