Whatsapp API
  • Getting Started
    • Dashboard API Overview
    • Register WhatsApp Business API Number
    • Get Channel ID & Link Your App
    • Get Access Token
    • Create WhatsApp Template
  • Whatsapp API
    • WhatsApp API's Overview
    • Media
      • Upload Media
      • Download Media
    • Send Messages
      • Text Mesage
      • Reaction Message
      • Media Message
      • Contact Message
      • Interactive Message
      • Template Message
      • Reply Message
    • Mark Message as Read
    • Set-up Webhook
      • Received Messages
      • Message Status
    • Error Codes
Powered by GitBook
On this page
  1. Whatsapp API
  2. Set-up Webhook

Received Messages

PreviousSet-up WebhookNextMessage Status

Last updated 2 years ago

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

please refer to this 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

{
    "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

{
    "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

{
    "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

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

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

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

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

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

document
Download Media
interactive message
interactive message
interactive message template