分享方式:


Azure 通訊服務 - 進階傳訊事件

重要

本文中所述的功能目前處於公用預覽。 此預覽版本沒有服務等級協定,不建議用於處理生產工作負載。 可能不支援特定功能,或可能已經限制功能。 如需詳細資訊,請參閱 Microsoft Azure 預覽版增補使用條款

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

事件類型

Azure 通訊服務會發出下列進階傳訊事件類型:

事件類型 描述
Microsoft.Communication.AdvancedMessageReceived 當通訊服務收到 WhatsApp 訊息時發佈。
Microsoft.Communication.AdvancedMessageDeliveryStatusUpdated 當 WhatsApp 傳送訊息通知的狀態為已傳送/讀取/失敗時發佈。

事件回應

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

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

Microsoft.Communication.AdvancedMessageReceived event

[{
  "id": "fdc64eca-390d-4974-abd6-1a13ccbe3160",
  "topic": "/subscriptions/{subscription-id}/resourcegroups/{resourcegroup-name}/providers/microsoft.communication/communicationservices/acsxplatmsg-test",
  "subject": "advancedMessage/sender/{sender@id}/recipient/00000000-0000-0000-0000-000000000000",
  "data": {
    "content": "Hello",
    "channelType": "whatsapp",
    "from": "{sender@id}",
    "to": "00000000-0000-0000-0000-000000000000",
    "receivedTimestamp": "2023-07-06T18:30:19+00:00"
  },
  "eventType": "Microsoft.Communication.AdvancedMessageReceived",
  "dataVersion": "1.0",
  "metadataVersion": "1",
  "eventTime": "2023-07-06T18:30:22.1921716Z"
}]

Microsoft.Communication.AdvancedMessageDeliveryStatusUpdated event

[{
  "id": "48cd6446-01dd-479f-939c-171c86c46700",
  "topic": "/subscriptions/{subscription-id}/resourcegroups/{resourcegroup-name}/providers/microsoft.communication/communicationservices/acsxplatmsg-test",
  "subject": "advancedMessage/00000000-0000-0000-0000-000000000000/status/Failed",
  "data": {
    "messageId": "00000000-0000-0000-0000-000000000000",
    "status": "Sent",
    "channelType": "whatsapp",
    "from": "{sender@id}",
    "to": "{receiver@id}",
    "receivedTimestamp": "2023-07-06T18:42:28+00:00"
  },
  "eventType": "Microsoft.Communication.AdvancedMessageDeliveryStatusUpdated",
  "dataVersion": "1.0",
  "metadataVersion": "1",
  "eventTime": "2023-07-06T18:42:28.8454662Z"
}]
[{
  "id": "48cd6446-01dd-479f-939c-171c86c46700",
  "topic": "/subscriptions/{subscription-id}/resourcegroups/{resourcegroup-name}/providers/microsoft.communication/communicationservices/acsxplatmsg-test",
  "subject": "advancedMessage/00000000-0000-0000-0000-000000000000/status/Failed",
  "data": {
    "messageId": "00000000-0000-0000-0000-000000000000",
    "status": "Failed",
    "channelType": "whatsapp",
    "from": "{sender@id}",
    "to": "{receiver@id}",
    "receivedTimestamp": "2023-07-06T18:42:28+00:00",
    "error": {
      "channelCode": "131026",
      "channelMessage": "Message Undeliverable."
    }
  },
  "eventType": "Microsoft.Communication.AdvancedMessageDeliveryStatusUpdated",
  "dataVersion": "1.0",
  "metadataVersion": "1",
  "eventTime": "2023-07-06T18:42:28.8454662Z"
}]

注意

Status 的可能值為 SentDeliveredReadFailed

快速入門

如需快速入門,了解如何使用 Webhook 訂閱進階傳訊事件,請參閱快速入門:處理進階傳訊事件