# WhatsApp Mobile-Originated Events

Event Notification Service (ENS) supports several event notification types and their corresponding payloads for WhatsApp messages.

## Mobile-Originated Event Attributes

| Attribute           | Type   | Description                                                                     |
| ------------------- | ------ | ------------------------------------------------------------------------------- |
| `eventCategoryType` | String | A string that represents the type of event that occurred.                       |
| `eid`               | String | The Enterprise ID associated with the account that produced the event.          |
| `mid`               | String | The Business Units ID of the account that produced the event.                   |
| `senderType`        | String | The type of sender. The only supported value is `WhatsApp`.                     |
| `messageType`       | String | The type of message.                                                            |
| `channelId`         | String | The ID of the channel that sent the message.                                    |
| `messageId`         | String | A unique message ID that’s generated by WhatsApp.                               |
| `timestampUTC`      | Number | The date and time when the event occurred, represented as a UTC Unix timestamp. |
| `mobileNumber`      | String | The subscriber’s mobile number.                                                 |
| `contactId`         | String | The subscriber’s contact ID.                                                    |
| `messageBody`       | Object | The body of the message. The maximum size of the message is 5,120 characters.   |

## Mobile-Originated Event Text Payload Example

When you receive a message from a customer to your WhatsApp account, you receive a text event. This sample shows an example of a text event.

```json
[
  {
    "eventCategoryType": "EngagementEvents.OttMobileOriginated",
    "eid": 1982,
    "mid": 2507,
    "senderType": "WhatsApp",
    "messageType": "text",
    "channelId": "9988776655",
    "messageId": "db5bcd7c-4e47-46f5-9e35-26eb3e56bce0",
    "mobileNumber": "112233445566",
    "contactId": "test_ck_123",
    "messageBody": {
      "text": {
        "body": "Coffee is a cherry"
      }
    },
    "timestampUTC": 1710240312
  }
]
```

## Mobile-Originated Event Rich Media Payload Examples

The payload includes metadata about the media type but not the media itself. For example, if the media is a document, the payload provides details such as the file name, MIME type, and other relevant attributes.

To download the media, use the [Download rich media inbound messages](https://developer.salesforce.com/docs/marketing/marketing-cloud/references/mc_rest_transactional_messaging_ott?meta=Download%2BRich%2BMedia%2BInbound%2Bmessages) API.

For information about supported media types, size limitations, and usage details, see *WhatsApp Cloud API Documentation*: [Media](https://developers.facebook.com/docs/whatsapp/cloud-api/reference/media#supported-media-types).

### Document Payload Example

```json
[
  {
    "senderType": "WhatsApp",
    "messageType": "document",
    "channelId": "9988776655",
    "messageId": "wamid.HBgMOTE3ODM4NTA5NzgzFQIAEhggOUVBQzMwQzJBNDNGN0QzQkZBNkEzODE0QUI1MDc0Q0EA",
    "mobileNumber": "112233445566",
    "contactId": "77601386",
    "messageBody": {
      "document": {
        "filename": "My_Brochure.pdf",
        "mime_type": "application/pdf",
        "id": "1089682512601880"
      }
    },
    "eventCategoryType": "EngagementEvents.OttMobileOriginated",
    "eid": 530000050,
    "mid": 530000050,
    "timestampUTC": 1730196900000
  }
]
```

### Image Payload Example

```json
[
  {
    "senderType": "WhatsApp",
    "messageType": "image",
    "channelId": "9988776655",
    "messageId": "wamid.HBgMOTE3ODM4NTA5NzgzFQIAEhggMzNDNUNEQkRENDQ5RjFDRjNBNkMwOEVDRTY0MkNGQUEA",
    "mobileNumber": "112233445566",
    "contactId": "77601386",
    "messageBody": {
      "image": {
        "caption": "CAPTION",
        "id": "853002090326945",
        "mime_type": "image/jpeg"
      }
    },
    "eventCategoryType": "EngagementEvents.OttMobileOriginated",
    "eid": 530000050,
    "mid": 530000050,
    "timestampUTC": 1730197082000
  }
]
```

### Video Payload Example

```json
[
  {
    "senderType": "WhatsApp",
    "messageType": "video",
    "channelId": "9988776655",
    "messageId": "wamid.HBgMOTE3ODM4NTA5NzgzFQIAEhggRkYzMjkzOEY4QzBEREE1RTZCMUU2RTYzRjE5M0U1NzkA",
    "mobileNumber": "112233445566",
    "contactId": "77601386",
    "messageBody": {
      "video": {
        "caption": "CAPTION",
        "id": "1961433010935917",
        "mime_type": "video/mp4"
      }
    },
    "eventCategoryType": "EngagementEvents.OttMobileOriginated",
    "eid": 530000050,
    "mid": 530000050,
    "timestampUTC": 1730197197000
  }
]
```

### Audio Payload Example

```json
[
  {
    "senderType": "WhatsApp",
    "messageType": "audio",
    "channelId": "9988776655",
    "messageId": "wamid.HBgMOTE3ODM4NTA5NzgzFQIAEhggNDFBNDUwMUE5NjdDRkEwQUYxMUM5NTgzNjI0MjA0MjgA",
    "mobileNumber": "112233445566",
    "contactId": "77601386",
    "messageBody": {
      "audio": {
        "id": "1234196991167350",
        "mime_type": "audio/ogg; codecs=opus"
      }
    },
    "eventCategoryType": "EngagementEvents.OttMobileOriginated",
    "eid": 530000050,
    "mid": 530000050,
    "timestampUTC": 1730196907000
  }
]
```

## Interactive Payload Examples

Interactive messages in WhatsApp include messages with WhatsApp Flows, lists, and quick reply buttons.

### WhatsApp Flows

This example shows the payload that’s sent to ENS when a customer submits a flow in a WhatsApp message.

```json
{
  "senderType": "WhatsApp",
  "messageType": "interactive",
  "channelId": "9988776655",
  "messageId": "wamid.HBgMOTE3ODM4NTA5NzgzFQIAEhggNDFBNDUwMUE5NjdDRkEwQUYxMUM5NTgzNjI0Mexample",
  "mobileNumber": "4255550042",
  "contactId": "99887766",
  "messageBody": {
    "interactive": {
      "nfm_reply": {
        "body": "Sent",
        "name": "flow",
        "response_json": "{\"screen_0_Email_2\": \"gpatel@example.com\", \"flow_token\": \"unused\", \"screen_0_LastName_1\": \"Patel\", \"screen_0_FirstName_0\": \"Gorav\"}"
      },
      "type": "nfm_reply"
    }
  },
  "eventCategoryType": "EngagementEvents.OttMobileOriginated",
  "eid": 987654,
  "mid": 987654,
  "timestampUTC": 1741118180000
}
```

### Lists

This example shows the payload that’s sent to ENS when a customer selects a list item in a WhatsApp message.

```json
{
  "senderType": "WhatsApp",
  "messageType": "interactive",
  "channelId": "9988776655",
  "messageId": "wamid.HBgMOTE3ODM4NTA5NzgzFQIAEhggNDFBNDUwMUE5NjdDRkEwQUYxMUM5NTgzNjI0Mexample",
  "mobileNumber": "4255550042",
  "contactId": "99887766",
  "messageBody": {
    "interactive": {
      "list_reply": {
        "id": "upgrade_account",
        "title": "Upgrade my account"
      },
      "type": "list_reply"
    }
  },
  "eventCategoryType": "EngagementEvents.OttMobileOriginated",
  "eid": 987654,
  "mid": 987654,
  "timestampUTC": 1741118180000
}
```

### Quick Reply Buttons

This example shows the payload that’s sent to ENS when a customer clicks a quick reply button in a WhatsApp message.

```json
{
  "senderType": "WhatsApp",
  "messageType": "interactive",
  "channelId": "9988776655",
  "messageId": "wamid.HBgMOTE3ODM4NTA5NzgzFQIAEhggNDFBNDUwMUE5NjdDRkEwQUYxMUM5NTgzNjI0Mexample",
  "mobileNumber": "4255550042",
  "contactId": "99887766",
  "messageBody": {
    "interactive": {
      "button_reply": {
        "id": "repeat-order",
        "title": "Re-order an item"
      },
      "type": "button_reply"
    }
  },
  "eventCategoryType": "EngagementEvents.OttMobileOriginated",
  "eid": 987654,
  "mid": 987654,
  "timestampUTC": 1741118180000
}
```
