共用方式為


Azure 通訊服務 - SMS 事件

本文提供通訊服務 SMS 事件的屬性和架構。 如需事件結構描述的簡介,請參閱 Azure Event Grid 事件結構描述

事件類型

Azure 通訊服務 發出下列SMS事件類型:

事件類型 描述
Microsoft.Communication.SMSReceived 當 SMS 是由與通訊服務相關聯的電話號碼接收時發佈。
Microsoft.Communication.SMSDeliveryReportReceived 在收到通訊服務所傳送 SMS 的傳遞報告時發佈。

事件回應

觸發事件時,事件方格服務會將該事件的相關資料傳送至訂閱端點。

本節包含每個事件的資料外觀範例。

Microsoft.Communication.SMSDeliveryReportReceived 事件

[{
  "id": "Outgoing_202009180022138813a09b-0cbf-4304-9b03-1546683bb910",
  "topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/microsoft.communication/communicationservices/{communication-services-resource-name}",
  "subject": "/phonenumber/15555555555",
  "data": {
    "MessageId": "Outgoing_202009180022138813a09b-0cbf-4304-9b03-1546683bb910",
    "From": "15555555555",
    "To": "+15555555555",
    "DeliveryStatus": "Delivered",
    "DeliveryStatusDetails": "No error.",
    "ReceivedTimestamp": "2020-09-18T00:22:20.2855749Z",
    "DeliveryAttempts": [
      {
        "Timestamp": "2020-09-18T00:22:14.9315918Z",
        "SegmentsSucceeded": 1,
        "SegmentsFailed": 0
      }
    ],
    "Tag": "Optional customer-tag set in the original message"
  },
  "eventType": "Microsoft.Communication.SMSDeliveryReportReceived",
  "dataVersion": "1.0",
  "metadataVersion": "1",
  "eventTime": "2020-09-18T00:22:20Z"
}]

注意

DeliveryStatus 的可能值為:DeliveredFailed

Microsoft.Communication.SMSReceived 事件

[{
  "id": "Incoming_20200918002745d29ebbea-3341-4466-9690-0a03af35228e",
  "topic": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourcegroups/acse2e/providers/microsoft.communication/communicationservices/{communication-services-resource-name}",
  "subject": "/phonenumber/15555555555",
  "data": {
    "MessageId": "Incoming_20200918002745d29ebbea-3341-4466-9690-0a03af35228e",
    "From": "15555555555",
    "To": "15555555555",
    "Message": "Great to connect with Azure Communication Services events",
    "ReceivedTimestamp": "2020-09-18T00:27:45.32Z",
    "SegmentCount": 1
  },
  "eventType": "Microsoft.Communication.SMSReceived",
  "dataVersion": "1.0",
  "metadataVersion": "1",
  "eventTime": "2020-09-18T00:27:47Z"
}]

下一步

請參閱下列教學課程: 快速入門: 處理 SMS 和傳遞報告事件