Azure Communication Services - Advanced Messaging イベント

この記事では、Communication Services の Advanced Messaging イベントのプロパティとスキーマを取り上げます。 イベント スキーマの概要については、「Azure Event Grid イベント スキーマ」を参照してください。

イベントの種類

Azure Communication Services から出力される Advanced Messaging イベントの種類は次のとおりです。

イベントの種類 説明
Microsoft.Communication.AdvancedMessageReceived Communication Service が WhatsApp のメッセージを受信したときに発行されます。
Microsoft.Communication.AdvancedMessageDeliveryStatusUpdated WhatsApp がメッセージ通知の状態として、送信/読み取り/失敗を送信したときに発行されます。

イベント応答

イベントがトリガーされると、Event Grid サービスにより、そのイベントに関するデータがサブスクライブしているエンドポイントに送信されます。

このセクションには、各イベントでそのデータがどのように見えるかの例が含まれています。

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"
}]

Note

Status で有効な値は、SentDeliveredRead、および Failed です。

クイックスタート

Web hook を使用して Advanced Messaging イベントをサブスクライブする方法を示すクイック スタートについては、「クイック スタート: Advanced Messaging イベントを処理する」を参照してください。