# Inbound messages

## Upstream message

### Response parameters

| Field           | Data type | Required | Description                                                                                                                                                                                                                                                                                                                                                                                         |
| --------------- | --------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id              | String    | Yes      | Message ID                                                                                                                                                                                                                                                                                                                                                                                          |
| accountName     | String    | Yes      | API account name                                                                                                                                                                                                                                                                                                                                                                                    |
| wabaId          | String    | Yes      | Waba Id                                                                                                                                                                                                                                                                                                                                                                                             |
| wamid           | String    | Yes      | Meta WhatsApp message ID                                                                                                                                                                                                                                                                                                                                                                            |
| from            | String    | Yes      | User phone number                                                                                                                                                                                                                                                                                                                                                                                   |
| to              | String    | Yes      | Merchant phone number                                                                                                                                                                                                                                                                                                                                                                               |
| sendTime        | String    | Yes      | Send time, format: 2023-02-22T12:00:00.000Z                                                                                                                                                                                                                                                                                                                                                         |
| customerProfile | JSON      | Yes      | User information                                                                                                                                                                                                                                                                                                                                                                                    |
| type            | String    | Yes      | Message type; text: text message reaction: emoji message image: image message audio: audio message video: video message sticker: sticker message unknown: unknown message location: location message contacts: contact message button: template button reply message interactive: interactive message/interactive button reply message order: order message system: user number change notification |
| text            | JSON      | No       | Present when type=text                                                                                                                                                                                                                                                                                                                                                                              |
| reaction        | JSON      | No       | Present when type=reaction                                                                                                                                                                                                                                                                                                                                                                          |
| image           | JSON      | No       | Present when type=image                                                                                                                                                                                                                                                                                                                                                                             |
| audio           | JSON      | No       | Present when type=audio                                                                                                                                                                                                                                                                                                                                                                             |
| video           | JSON      | No       | Present when type=video                                                                                                                                                                                                                                                                                                                                                                             |
| errors          | JSON      | No       | Present when type=unknown                                                                                                                                                                                                                                                                                                                                                                           |
| location        | JSON      | No       | Present when type=location                                                                                                                                                                                                                                                                                                                                                                          |
| contacts        | JSON      | No       | Present when type=contacts                                                                                                                                                                                                                                                                                                                                                                          |
| button          | JSON      | No       | Present when type=button                                                                                                                                                                                                                                                                                                                                                                            |
| system          | JSON      | No       | Present when type=system                                                                                                                                                                                                                                                                                                                                                                            |
| context         | JSON      | No       | Context message, present when replying to a quoted message                                                                                                                                                                                                                                                                                                                                          |

### **text: reply example**

| Field     | Data type | Required | Description                 |
| --------- | --------- | -------- | --------------------------- |
| text.body | String    | Yes      | Indicates the reply content |

```json
{
    "id": "b5e984b3-21b2-42a9-b08b-72e5a4096ac6",
    "type": "whatsapp_mo_message_received",
    "eventTime": "2023-02-22T12:00:00.000Z",
    "body": {
        "id": "63f5d602367ea403f8175a6c",
        "accountName": "IW123456",
        "wabaId": "WHATSAPP_BUSINESS_ACCOUNT_ID",
        "wamid": "wamid.BgNODYxN...",
        "from": "PHONE-NUMBER",
        "customerProfile": {
            "name": "Jack"
        },
        "to": "BUSINESS-PHONE-NUMBER",
        "sendTime": "2023-02-22T12:00:00.000Z",
        "type": "text",
        "text": {
            "body": "OK"
        }
    }
}
```

### **reaction: reply example**

| Field              | Data type | Required | Description                                                     |
| ------------------ | --------- | -------- | --------------------------------------------------------------- |
| reaction.messageId | String    | Yes      | Indicates the wamid of the quoted message (original message ID) |
| reaction.emoji     | String    | Yes      | Indicates the emoji used in the reply                           |
| sendTime           | String    | Yes      | Indicates the time when the customer sent the emoji             |

```json
{
    "id": "b5e984b3-21b2-42a9-b08b-72e5a4096ac6",
    "type": "whatsapp_mo_message_received",
    "eventTime": "2023-02-22T12:00:00.000Z",
    "body": {
        "id": "63f5d602367ea403f8175a6c",
        "accountName": "IW123456",
        "wabaId": "WHATSAPP_BUSINESS_ACCOUNT_ID",
        "wamid": "wamid.HBgNOD...",
        "from": "PHONE-NUMBER",
        "customerProfile": {
            "name": "Jack"
        },
        "to": "BUSINESS-PHONE-NUMBER",
        "sendTime": "2023-02-22T12:00:00.000Z",
        "type": "reaction",
        "reaction": {
            "messageId": "wamid.HBgNODY...",
            "emoji": "EMOJI"
        }
    }
}
```

| Field          | Data type | Required | Description                          |
| -------------- | --------- | -------- | ------------------------------------ |
| image.caption  | String    | Yes      | Media description or title           |
| image.mimeType | String    | Yes      | Media format type: image/jpeg        |
| image.sha256   | String    | Yes      | Hash code of the media resource file |
| image.link     | String    | Yes      | Download link for the media file     |

```json
{
    "id": "b5e984b3-21b2-42a9-b08b-72e5a4096ac6",
    "type": "whatsapp_mo_message_received",
    "eventTime": "2023-02-22T12:00:00.000Z",
    "body": {
        "id": "63f5d602367ea403f8175a6c",
        "accountName": "IW123456",
        "wabaId": "WHATSAPP_BUSINESS_ACCOUNT_ID",
        "wamid": "wamid.HBgNOD...",
        "from": "PHONE-NUMBER",
        "customerProfile": {
            "name": "Jack"
        },
        "to": "BUSINESS-PHONE-NUMBER",
        "sendTime": "2023-02-22T12:00:00.000Z",
        "type": "image",
        "image": {
            "caption": "CAPTION",
            "mimeType": "image/jpeg",
            "sha256": "IMAGE_HASH",
            "link": "http://xxxxxxxxxx"
        }
    }
}
```

### **sticker: reply example**

| Field            | Data type | Required | Description                            |
| ---------------- | --------- | -------- | -------------------------------------- |
| sticker.mimeType | String    | Yes      | Sticker format type: image/webp        |
| sticker.sha256   | String    | Yes      | Hash code of the sticker resource file |
| sticker.link     | String    | Yes      | Download link for the sticker file     |

```json
{
    "id": "b5e984b3-21b2-42a9-b08b-72e5a4096ac6",
    "type": "whatsapp_mo_message_received",
    "eventTime": "2023-02-22T12:00:00.000Z",
    "body": {
        "id": "63f5d602367ea403f8175a6c",
        "accountName": "IW123456",
        "wabaId": "WHATSAPP_BUSINESS_ACCOUNT_ID",
        "wamid": "wamid.HBgNOD...",
        "from": "PHONE-NUMBER",
        "customerProfile": {
            "name": "Jack"
        },
        "to": "BUSINESS-PHONE-NUMBER",
        "sendTime": "2023-02-22T12:00:00.000Z",
        "type": "sticker",
        "sticker": {
            "mimeType": "image/webp",
            "sha256": "HASH",
            "link": "http://xxxxxxxxxx"
        }
    }
}
```

### **video: reply example**

| Field          | Data type | Required | Description                          |
| -------------- | --------- | -------- | ------------------------------------ |
| video.mimeType | String    | Yes      | Video format type: video/mp4         |
| video.sha256   | String    | Yes      | Hash code of the video resource file |
| video.link     | String    | Yes      | Download link for the video file     |

```json
{
    "id": "b5e984b3-21b2-42a9-b08b-72e5a4096ac6",
    "type": "whatsapp_mo_message_received",
    "eventTime": "2023-02-22T12:00:00.000Z",
    "body": {
        "id": "63f5d602367ea403f8175a6c",
        "accountName": "IW123456",
        "wabaId": "WHATSAPP_BUSINESS_ACCOUNT_ID",
        "wamid": "wamid.HBgNOD...",
        "from": "PHONE-NUMBER",
        "customerProfile": {
            "name": "Jack"
        },
        "to": "BUSINESS-PHONE-NUMBER",
        "sendTime": "2023-02-22T12:00:00.000Z",
        "type": "video",
        "video": {
            "mimeType": "video/mp4",
            "sha256": "G4fboj5cKcAbCdefzhcAcRdnXJqFJAyTSlNmJANhu4M=",
            "link": "http://xxxxxxxxxx"
        }
    }
}
```

### **Audio: reply example**

| Field          | Data type | Required | Description                          |
| -------------- | --------- | -------- | ------------------------------------ |
| audio.mimeType | String    | Yes      | Audio format type: video/mp4         |
| audio.sha256   | String    | Yes      | Hash code of the audio resource file |
| audio.link     | String    | Yes      | Download link for the audio file     |

```json
{
    "id": "b5e984b3-21b2-42a9-b08b-72e5a4096ac6",
    "type": "whatsapp_mo_message_received",
    "eventTime": "2023-02-22T12:00:00.000Z",
    "body": {
        "id": "63f5d602367ea403f8175a6c",
        "accountName": "IW123456",
        "wabaId": "WHATSAPP_BUSINESS_ACCOUNT_ID",
        "wamid": "wamid.HBgNOD...",
        "from": "PHONE-NUMBER",
        "customerProfile": {
            "name": "Jack"
        },
        "to": "BUSINESS-PHONE-NUMBER",
        "sendTime": "2023-02-22T12:00:00.000Z",
        "type": "audio",
        "audio": {
            "mimeType": "audio/ogg; codecs=opus",
            "sha256": "ffRSAbcDeff3mJ2hBhpzuFY7pYEugTfglD+zx4Qv8X4=",
            "link": "http://xxxxxxxxxx"
        }
    }
}
```

### **Document: reply example**

| Field             | Data type | Required | Description                             |
| ----------------- | --------- | -------- | --------------------------------------- |
| document.mimeType | String    | Yes      | Document format type: video/mp4         |
| document.sha256   | String    | Yes      | Hash code of the document resource file |
| document.link     | String    | Yes      | Download link for the document file     |
| document.caption  | String    | Yes      | Document description or title           |
| document.filename | String    | Yes      | Document file name                      |

```json
{
    "id": "b5e984b3-21b2-42a9-b08b-72e5a4096ac6",
    "type": "whatsapp_mo_message_received",
    "eventTime": "2023-02-22T12:00:00.000Z",
    "body": {
        "id": "63f5d602367ea403f8175a6c",
        "accountName": "IW123456",
        "wabaId": "WHATSAPP_BUSINESS_ACCOUNT_ID",
        "wamid": "wamid.HBgNOD...",
        "from": "PHONE-NUMBER",
        "customerProfile": {
            "name": "Jack"
        },
        "to": "BUSINESS-PHONE-NUMBER",
        "sendTime": "2023-02-22T12:00:00.000Z",
        "type": "document",
        "document": {
            "caption": "pdf caption",
            "filename": "filename.pdf",
            "mimeType": "application/pdf",
            "sha256": "TJGGMF5tdw3XApVHbABCdeffI7w4OW7GqYEN736PW0s=",
            "link": "http://xxxxxxxxxx"
        }
    }
}
```

### **Location: reply example**

| Field              | Data type | Required | Description                 |
| ------------------ | --------- | -------- | --------------------------- |
| location.latitude  | String    | Yes      | Indicates latitude          |
| location.longitude | String    | Yes      | Indicates longitude         |
| location.name      | String    | Yes      | Indicates the location name |
| location.address   | String    | Yes      | Indicates the address       |

```json
{
    "id": "b5e984b3-21b2-42a9-b08b-72e5a4096ac6",
    "type": "whatsapp_mo_message_received",
    "eventTime": "2023-02-22T12:00:00.000Z",
    "body": {
        "id": "63f5d602367ea403f8175a6c",
        "accountName": "IW123456",
        "wabaId": "WHATSAPP_BUSINESS_ACCOUNT_ID",
        "wamid": "wamid.HBgNOD...",
        "from": "PHONE-NUMBER",
        "customerProfile": {
            "name": "Jack"
        },
        "to": "BUSINESS-PHONE-NUMBER",
        "sendTime": "2023-02-22T12:00:00.000Z",
        "type": "location",
        "location": {
            "latitude": 39.90539,
            "longitude": 116.39134,
            "name": "LOCATION_NAME",
            "address": "LOCATION_ADDRESS",
        }
    }
}
```

### **Contact: reply example**

```json
{
    "body": {
        "accountName": "IW31****5",
        "contact": [
            {
                "addresses": [
                    {
                        "city": "CONTACT_CITY1",
                        "country": "CONTACT_COUNTRY1",
                        "countryCode": "CONTACT_COUNTRY_CODE1",
                        "state": "CONTACT_STATE1",
                        "street": "CONTACT_STREET1",
                        "type": "HOME or WORK1",
                        "zip": "CONTACT_ZIP1"
                    }
                ],
                "birthday": "CONTACT_BIRTHDAY1",
                "emails": [
                    {
                        "email": "CONTACT_EMAIL1",
                        "type": "WORK or HOME1"
                    }
                ],
                "name": {
                    "firstName": "CONTACT_FIRST_NAME1",
                    "formattedName": "CONTACT_FORMATTED_NAME1",
                    "lastName": "CONTACT_LAST_NAME1",
                    "middleName": "CONTACT_MIDDLE_NAME1",
                    "prefix": "CONTACT_PREFIX1",
                    "suffix": "CONTACT_SUFFIX1"
                },
                "org": {
                    "company": "CONTACT_ORG_COMPANY1",
                    "department": "CONTACT_ORG_DEPARTMENT1",
                    "title": "CONTACT_ORG_TITLE1"
                },
                "phones": [
                    {
                        "phone": "CONTACT_PHONE1",
                        "type": "HOME or WORK>1",
                        "wa_id": "CONTACT_WA_ID1"
                    }
                ],
                "urls": [
                    {
                        "type": "HOME or WORK1",
                        "url": "CONTACT_URL1"
                    }
                ]
            }
        ],
        "customerProfile": {
            "name": "Jack"
        },
        "from": "86183****2197",
        "id": "a1301cb6d0094b2fae36546c22e09044",
        "sendTime": "2024-03-07T10:46:24.000Z",
        "to": "62811****6819",
        "type": "contacts",
        "wabaId": "1**********9",
        "wamid": "wamid.HBgNODYxODM1NTA5MjE5NxUCABIYIDg3RDVFMzQyRjIwQkM5NDQyMDI5OTRERERGNUYx*****=="
    },
    "eventTime": "2024-03-08T09:42:06.363Z",
    "id": "e2bafad5-0aa9-4465-9ed1-c5c01741c5e1",
    "type": "whatsapp_mo_message_received"
}
```

### **Button: reply example**

When the customer clicks a quick reply button in an interactive message template, the system will send a response. The following is an example callback format.

| Field        | Data type | Required | Description                                                                                        |
| ------------ | --------- | -------- | -------------------------------------------------------------------------------------------------- |
| context.from | String    | Yes      | The WhatsApp ID of the sender of the interactive message (the phone number without the “+” prefix) |
| context.id   | String    | Yes      | The original message ID on the WhatsApp platform.                                                  |

```json
{
    "id": "b5e984b3-21b2-42a9-b08b-72e5a4096ac6",
    "type": "whatsapp_mo_message_received",
    "eventTime": "2023-02-22T12:00:00.000Z",
    "body": {
        "id": "63f5d602367ea403f8175a6c",
        "accountName": "IW123456",
        "wabaId": "WHATSAPP_BUSINESS_ACCOUNT_ID",
        "wamid": "wamid.HBgNOD...",
        "from": "PHONE-NUMBER",
        "customerProfile": {
            "name": "Jack"
        },
        "to": "BUSINESS-PHONE-NUMBER",
        "sendTime": "2023-02-22T12:00:00.000Z",
        "type": "button",
        "button": {
            "text": "No",
            "payload": "No-Button-Payload"
        },
        "context": {
            "from": "PHONE_NUMBER",
            "id": "wamid.ID"
        }
    }
}
```

### **Unknown: reply example**

&#x20; You may receive an unknown message callback notification. For example, a customer may send you an unsupported message, such as a timed message (in which case, we notify the customer that the message type is unsupported).

| Field          | Data type | Required | Description                 |
| -------------- | --------- | -------- | --------------------------- |
| errors.code    | String    | Yes      | Indicates the error code    |
| errors.details | String    | Yes      | Indicates the error details |
| errors.title   | String    | Yes      | Indicates the error name    |

```json
{
    "id": "b5e984b3-21b2-42a9-b08b-72e5a4096ac6",
    "type": "whatsapp_mo_message_received",
    "eventTime": "2023-02-22T12:00:00.000Z",
    "body": {
        "id": "63f5d602367ea403f8175a6c",
        "accountName": "IW123456",
        "wabaId": "WHATSAPP_BUSINESS_ACCOUNT_ID",
        "wamid": "wamid.HBgNOD...",
        "from": "PHONE-NUMBER",
        "customerProfile": {
            "name": "Jack"
        },
        "to": "BUSINESS-PHONE-NUMBER",
        "sendTime": "2023-02-22T12:00:00.000Z",
        "type": "unknown",
        "errors": [
            {
                "code": 131051,
                "details": "Message type is not currently supported",
                "title": "Unsupported message type"
            }
        ]
    }
}
```

### **Interactive: reply example**

When the user clicks**an item in the list message you sent**you will receive the following Webhooks notification:

| Field        | Data type | Required | Description                                                                                        |
| ------------ | --------- | -------- | -------------------------------------------------------------------------------------------------- |
| context.from | String    | Yes      | The WhatsApp ID of the sender of the interactive message (the phone number without the “+” prefix) |
| context.id   | String    | Yes      | The original message ID on the WhatsApp platform.                                                  |

```json
{
    "id": "b5e984b3-21b2-42a9-b08b-72e5a4096ac6",
    "type": "whatsapp_mo_message_received",
    "eventTime": "2023-02-22T12:00:00.000Z",
    "body": {
        "id": "63f5d602367ea403f8175a6c",
        "accountName": "IW123456",
        "wabaId": "WHATSAPP_BUSINESS_ACCOUNT_ID",
        "wamid": "wamid.HBgNOD...",
        "from": "PHONE-NUMBER",
        "customerProfile": {
            "name": "Jack"
        },
        "to": "BUSINESS-PHONE-NUMBER",
        "sendTime": "2023-02-22T12:00:00.000Z",
        "type": "interactive",
        "interactive": {
            "listReply": {
                "id": "list_reply_id",
                "title": "list_reply_title",
                "description": "list_reply_description"
            },
            "type": "listReply"
        },
        "context": {
            "from": "PHONE_NUMBER",
            "id": "wamid.ID"
        }
    }
}
```

When the user clicks**the reply button you sent**you will receive the following Webhooks notification:

```json
{
    "id": "b5e984b3-21b2-42a9-b08b-72e5a4096ac6",
    "type": "whatsapp_mo_message_received",
    "eventTime": "2023-02-22T12:00:00.000Z",
    "body": {
        "id": "63f5d602367ea403f8175a6c",
        "accountName": "IW123456",
        "wabaId": "WHATSAPP_BUSINESS_ACCOUNT_ID",
        "wamid": "wamid.HBgNOD...",
        "from": "PHONE-NUMBER",
        "customerProfile": {
            "name": "Jack"
        },
        "to": "BUSINESS-PHONE-NUMBER",
        "sendTime": "2023-02-22T12:00:00.000Z",
        "type": "interactive",
        "interactive": {
            "buttonReply": {
                "id": "unique-button-identifier-here",
                "title": "button-text"
            },
            "type": "buttonReply"
        },
         "context": {
            "from": "PHONE_NUMBER",
            "id": "wamid.ID"
        }
    }
}
```
