Received Messages

These are the sample payloads for Inbound Notification you will receive on your webhook

please refer to this document as well to see the possible of received message object

Text Message

The following is an example of a text message you received from a customer:

{
    "contacts": [
        {
            "profile": {
                "name": "NAME"
            },
            "wa_id": PHONE_NUMBER
        }
    ],
    "messages": [
        {
            "from": PHONE_NUMBER,
            "id": "wamid.ID",
            "timestamp": TIMESTAMP,
            "text": {
                "body": "MESSAGE_BODY"
            },
            "type": "text"
        }
    ]
}

Media Message

When media messages are received, the Webhook notification contains information that identifies the media object and enables you to download media. see Download Media

{
    "contacts": [
        {
            "profile": {
                "name": "NAME"
            },
            "wa_id": "WHATSAPP_ID"
        }
    ],
    "messages": [
        {
            "from": PHONE_NUMBER,
            "id": "wamid.ID",
            "timestamp": TIMESTAMP,
            "type": "image",
            "image": {
                "caption": "CAPTION",
                "mime_type": "image/jpeg",
                "sha256": "IMAGE_HASH",
                "id": "ID"
            }
        }
    ]
}

Reaction Message

The following is an example of a reaction message you received from a customer.

{
    "contacts": [
        {
            "profile": {
                "name": "NAME"
            },
            "wa_id": PHONE_NUMBER
        }
    ],
    "messages": [
        {
            "from": PHONE_NUMBER,
            "id": "wamid.ID",
            "timestamp": TIMESTAMP,
            "reaction": {
                "message_id": "MESSAGE_ID",
                "emoji": "EMOJI"
            },
            "type": "reaction"
        }
    ]
}

Location Message

The following is an example of a location message you received from a customer.

{
    "contacts": [
        {
            "profile": {
                "name": "NAME"
            },
            "wa_id": "WHATSAPP_ID"
        }
    ],
    "messages": [
        {
            "from": "PHONE_NUMBER",
            "id": "wamid.ID",
            "timestamp": "TIMESTAMP",
            "location": {
                "latitude": LOCATION_LATITUDE,
                "longitude": LOCATION_LONGITUDE,
                "name": LOCATION_NAME,
                "address": LOCATION_ADDRESS,
            }
        }
    ]
}

Contact Message

The following is an example of a Contact message you received from a customer.

{
    "contacts": [
        {
            "profile": {
                "name": "NAME"
            },
            "wa_id": "WHATSAPP_ID"
        }
    ],
    "messages": [
        {
            "from": "PHONE_NUMBER",
            "id": "wamid.ID",
            "timestamp": "TIMESTAMP",
            "contacts": [
                {
                    "addresses": [
                        {
                            "city": "CONTACT_CITY",
                            "country": "CONTACT_COUNTRY",
                            "country_code": "CONTACT_COUNTRY_CODE",
                            "state": "CONTACT_STATE",
                            "street": "CONTACT_STREET",
                            "type": "HOME or WORK",
                            "zip": "CONTACT_ZIP"
                        }
                    ],
                    "birthday": "CONTACT_BIRTHDAY",
                    "emails": [
                        {
                            "email": "CONTACT_EMAIL",
                            "type": "WORK or HOME"
                        }
                    ],
                    "name": {
                        "formatted_name": "CONTACT_FORMATTED_NAME",
                        "first_name": "CONTACT_FIRST_NAME",
                        "last_name": "CONTACT_LAST_NAME",
                        "middle_name": "CONTACT_MIDDLE_NAME",
                        "suffix": "CONTACT_SUFFIX",
                        "prefix": "CONTACT_PREFIX"
                    },
                    "org": {
                        "company": "CONTACT_ORG_COMPANY",
                        "department": "CONTACT_ORG_DEPARTMENT",
                        "title": "CONTACT_ORG_TITLE"
                    },
                    "phones": [
                        {
                            "phone": "CONTACT_PHONE",
                            "wa_id": "CONTACT_WA_ID",
                            "type": "HOME or WORK>"
                        }
                    ],
                    "urls": [
                        {
                            "url": "CONTACT_URL",
                            "type": "HOME or WORK"
                        }
                    ]
                }
            ]
        }
    ]
}

Callback Message From Quick Reply Message

When your customer clicks on a quick reply button in an interactive message template, a response is sent. Below is an example of the callback format

{
    "contacts": [
        {
            "profile": {
                "name": "NAME"
            },
            "wa_id": "WHATSAPP_ID"
        }
    ],
    "messages": [
        {
            "context": {
                "from": PHONE_NUMBER,
                "id": "wamid.ID"
            },
            "from": "16315551234",
            "id": "wamid.ID",
            "timestamp": TIMESTAMP,
            "type": "button",
            "button": {
                "text": "No",
                "payload": "No-Button-Payload"
            }
        }
    ]
}

Callback Message From Reply Button

The following webhook notification is received when a user clicks on a reply button you sent. See interactive message

{
    "contacts": [
        {
            "profile": {
                "name": "NAME"
            },
            "wa_id": "PHONE_NUMBER_ID"
        }
    ],
    "messages": [
        {
            "from": PHONE_NUMBER_ID,
            "id": "wamid.ID",
            "timestamp": TIMESTAMP,
            "interactive": {
                "button_reply": {
                    "id": "unique-button-identifier-here",
                    "title": "button-text",
                },
                "type": "button_reply"
            },
            "type": "interactive"
        }
    ]
}

Callback Message From List Message

The following webhook notification is received when a user clicks on an item from a list message you sent. See interactive message

{
    "contacts": [
        {
            "profile": {
                "name": "NAME"
            },
            "wa_id": "PHONE_NUMBER_ID"
        }
    ],
    "messages": [
        {
            "from": PHONE_NUMBER_ID,
            "id": "wamid.ID",
            "timestamp": TIMESTAMP,
            "interactive": {
                "list_reply": {
                    "id": "list_reply_id",
                    "title": "list_reply_title",
                    "description": "list_reply_description"
                },
                "type": "list_reply"
            },
            "type": "interactive"
        }
    ]
}

Unknown Message

It's possible to receive an unknown message callback notification. For example, a customer could send you a message that's not supported, such as a disappearing message (in which case we'd notify the customer that the message type is not supported).

The following is an example of a message you received from a customer that is not supported.


{
    "contacts": [
        {
            "profile": {
                "name": "NAME"
            },
            "wa_id": "WHATSAPP_ID"
        }
    ],
    "messages": [
        {
            "from": "PHONE_NUMBER",
            "id": "wamid.ID",
            "timestamp": "TIMESTAMP",
            "errors": [
                {
                    "code": 131051,
                    "details": "Message type is not currently supported",
                    "title": "Unsupported message type"
                }
            ],
            "type": "unknown"
        }
    ]
}

Last updated