

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

# Format pesan dan acara di AWS End User Messaging Social
<a name="managing-event-destination-dlrs"></a>

Objek JSON untuk suatu acara berisi header AWS acara dan payload WhatsApp JSON. Untuk daftar payload dan nilai WhatsApp notifikasi JSON, lihat Referensi Payload [Pemberitahuan Webhook dan [Status Pesan](https://developers.facebook.com/docs/whatsapp/conversation-types#message-status) di Referensi](https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components) API Cloud Platform *WhatsApp Bisnis*.

## AWS Header acara Sosial Pesan Pengguna Akhir
<a name="managing-event-destination-dlrs_body"></a>

Objek JSON untuk suatu acara berisi header AWS acara dan WhatsApp JSON. Header berisi AWS pengidentifikasi dan ARNs Akun WhatsApp Bisnis Anda (WABA) dan nomor telepon.

```
{
  "context": {
    "MetaWabaIds": [
      {
        "wabaId": "1234567890abcde",
        "arn": "arn:aws:social-messaging:us-east-1:123456789012:waba/fb2594b8a7974770b128a409e2example"
      }
    ],
    "MetaPhoneNumberIds": [
      {
        "metaPhoneNumberId": "abcde1234567890",
        "arn": "arn:aws:social-messaging:us-east-1:123456789012:phone-number-id/976c72a700aac43eaf573ae050example"
      }
    ]
  },
  "whatsAppWebhookEntry": "{\"...JSON STRING....",
  "aws_account_id": "123456789012",
  "message_timestamp": "2025-01-08T23:30:43.271279391Z",
  "messageId": "6d69f07a-c317-4278-9d5c-6a84078419ec"
}
//Decoding the contents of whatsAppWebhookEntry
{
//WhatsApp notification payload
}
```

Dalam contoh peristiwa sebelumnya:
+ *1234567890abcde*adalah id WABA dari Meta.
+ *abcde1234567890*adalah id nomor telepon dari Meta.
+ *fb2594b8a7974770b128a409e2example*adalah ID Akun WhatsApp Bisnis (WABA).
+ *976c72a700aac43eaf573ae050example*adalah ID dari nomor telepon.

## Contoh WhatsApp JSON untuk menerima pesan
<a name="managing-event-destination-dlrs-example-receive-text"></a>

Berikut ini menunjukkan catatan peristiwa untuk pesan masuk dari WhatsApp. JSON yang diterima dari WhatsApp dalam `whatsAppWebhookEntry` diterima sebagai string JSON dan dapat dikonversi ke JSON. Untuk daftar bidang dan artinya, lihat Referensi [Payload Pemberitahuan Webhook di Referensi](https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components) API *Cloud Platform WhatsApp Bisnis*.

```
{
  "context": {
    "MetaWabaIds": [
      {
        "wabaId": "1234567890abcde",
        "arn": "arn:aws:social-messaging:us-east-1:123456789012:waba/fb2594b8a7974770b128a409e2example"
      }
    ],
    "MetaPhoneNumberIds": [
      {
        "metaPhoneNumberId": "abcde1234567890",
        "arn": "arn:aws:social-messaging:us-east-1:123456789012:phone-number-id/976c72a700aac43eaf573ae050example"
      }
    ]
  },
  "whatsAppWebhookEntry": "{\"...JSON STRING....",
  "aws_account_id": "123456789012",
  "message_timestamp": "2025-01-08T23:30:43.271279391Z",
  "messageId": "6d69f07a-c317-4278-9d5c-6a84078419ec"
}
```

Anda dapat menggunakan alat, seperti [jq](https://jqlang.org/), untuk mengonversi string JSON ke JSON. Berikut ini adalah `whatsAppWebhookEntry` dalam bentuk JSON:

```
{
  "id": "503131219501234",
  "changes": [
    {
      "value": {
        "messaging_product": "whatsapp",
        "metadata": {
          "display_phone_number": "14255550123",
          "phone_number_id": "46271669example"
        },
        "statuses": [
          {
            "id": "wamid.HBgLMTkxNzM5OTI3MzkVAgARGBJBMTM4NDdGRENEREI5Rexample",
            "status": "sent",
            "timestamp": "1736379042",
            "recipient_id": "01234567890",
            "conversation": {
              "id": "62374592e84cb58e52bdaed31example",
              "expiration_timestamp": "1736461020",
              "origin": {
                "type": "utility"
              }
            },
            "pricing": {
              "billable": true,
              "pricing_model": "CBP",
              "category": "utility"
            }
          }
        ]
      },
      "field": "messages"
    }
  ]
}
```

## Contoh WhatsApp JSON untuk menerima pesan media
<a name="managing-event-destination-dlrs-example-receive-media"></a>

Berikut ini menunjukkan catatan acara untuk pesan media yang masuk. Untuk mengambil file media, gunakan perintah GetWhatsAppMessageMedia API. Untuk daftar bidang dan artinya, lihat Referensi Payload [Pemberitahuan Webhook](https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components)

```
{
//AWS End User Messaging Social header
}
//Decoding the contents of whatsAppWebhookEntry
{
  "id": "365731266123456",
  "changes": [
    {
      "value": {
        "messaging_product": "whatsapp",
        "metadata": {
          "display_phone_number": "12065550100",
          "phone_number_id": "321010217760100"
        },
        "contacts": [
          {
            "profile": {
              "name": "Diego"
            },
            "wa_id": "12065550102"
          }
        ],
        "messages": [
          {
            "from": "14255550150",
            "id": "wamid.HBgLMTQyNTY5ODgzMDIVAgASGCBDNzBDRjM5MDU2ODEwMDkwREY4ODBDRDE0RjVGRkexample",
            "timestamp": "1723506230",
            "type": "image",
            "image": {
              "mime_type": "image/jpeg",
              "sha256": "BTD0xlqSZ7l02o+/upusiNStlEZhA/urkvKf143Uqjk=",
              "id": "530339869524171"
            }
          }
        ]
      },
      "field": "messages"
    }
  ]
}
```