Pareho ang envelope ng bawat messages webhook ng WhatsApp Cloud API: naka-set ang object sa whatsapp_business_account, kasunod ang entry[].changes[] na naka-set ang field sa messages at may value object. Sa loob ng value, ang messages array ay nangangahulugang may ipinadala ang isang user, at ang statuses array ay nag-uulat tungkol sa isang bagay na ipinadala mo. Nag-uulat ang errors array ng problema sa system, app o account (Messages webhook reference, na-access noong 2026-11-04). Mag-switch sa messages[].type para piliin ang parser. Galing ang mga table sa ibaba sa reference page ng Meta para sa bawat type. Sariling sample ng Meta ang mga sample, kinopya gaya ng pagkakalathala.
Ang envelope
| Path | Ano ang laman ayon sa Meta |
|---|---|
object |
whatsapp_business_account |
entry[].id |
Messaging account ID |
entry[].changes[].field |
messages |
value.messaging_product |
whatsapp |
value.metadata.display_phone_number |
Display phone number ng business |
value.metadata.phone_number_id |
Business phone number ID, ang pinagpapadalhan mo |
value.contacts[].profile.name |
Profile name ng user sa WhatsApp |
value.contacts[].wa_id |
WhatsApp user ID, na “maaaring hindi laging tumugma” sa phone number |
value.contacts[].identity_key_hash |
Kapag naka-enable lang ang identity change check |
value.messages[].from |
Phone number ng WhatsApp user |
value.messages[].id |
WhatsApp message ID (wamid.), ang dedupe key mo |
value.messages[].timestamp |
Unix time “kung kailan na-trigger ang webhook”, bilang string |
value.messages[].type |
Ang message type, na nagpapangalan sa katabing object na may hawak ng content |
value.messages[].context |
Naroon sa mga button at list reply, mga mensahe mula sa “Message business” button at mga forwarded na mensahe |
Ipinapakita nang buo ng sample sa text reference ng Meta ang envelope (Text webhook reference):
{
"object": "whatsapp_business_account",
"entry": [
{
"id": "102290129340398",
"changes": [
{
"value": {
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "15550783881",
"phone_number_id": "106540352242922"
},
"contacts": [
{
"profile": {
"name": "Sheena Nelson"
},
"wa_id": "16505551234"
}
],
"messages": [
{
"from": "16505551234",
"id": "wamid.HBgLMTY1MDM4Nzk0MzkVAgASGBQzQTRBNjU5OUFFRTAzODEwMTQ0RgA=",
"timestamp": "1749416383",
"type": "text",
"text": {
"body": "Does it come in another color?"
}
}
]
},
"field": "messages"
}
]
}
]
}
Ang bawat outgoing na mensahe ay “maaaring magkaroon ng hanggang tatlong magkakahiwalay na webhook”, isa bawat status. Nasa loob ng messages ang mga error ng incoming na mensahe, nasa loob ng statuses ang mga error ng outgoing na mensahe, at direkta sa value ang mga error sa system, app at account.
Sino ang nagpadala: from, from_user_id at contacts
Ang mga business-scoped user ID (BSUID) ay “nagsimulang lumabas sa mga webhook noong unang bahagi ng Abril 2026” (Business-scoped user IDs, na-access noong 2026-11-04). Hindi ipinapakita ng mga reference page bawat type ang mga BSUID field. Dokumentado ang mga ito sa BSUID page.
| Field | Saan | Ano ang laman |
|---|---|---|
messages[].from_user_id |
Inbound na mensahe | BSUID ng nagpadala, gaya ng US.13491208655302741918 |
messages[].from_parent_user_id |
Inbound na mensahe | Parent BSUID, kapag naka-enable lang ang parent BSUID |
contacts[].user_id |
Inbound at status | Ang BSUID, may username man o wala |
contacts[].profile.username |
Inbound at status | Ang username, wala kung hindi pa gumagamit ng username ang user |
statuses[].recipient_user_id |
Status | Laging ang BSUID, paano mo man in-address ang mensahe |
statuses[].recipient_parent_user_id |
Status | Parent BSUID, kapag naka-enable lang ang parent BSUID |
Wala ang from, wa_id at recipient_id kapag may username ang user at hindi puwedeng i-share ang phone number nila. Isinasama ng Meta ang number kung nagkapalitan kayo ng mensahe o tawag sa huling 30 araw, o kung nasa contact book mo ang user. Ipinapakita ng BSUID sample ng Meta ang kasong iyon, walang from at walang wa_id:
{
"object": "whatsapp_business_account",
"entry": [
{
"id": "102290129340398",
"changes": [
{
"value": {
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "15550783881",
"phone_number_id": "106540352242922"
},
"contacts": [
{
"profile": {
"name": "Sheena Nelson",
"username": "realsheenanelson"
},
"user_id": "US.13491208655302741918",
"parent_user_id": "US.ENT.11815799212886844830"
}
],
"messages": [
{
"from_user_id": "US.13491208655302741918",
"from_parent_user_id": "US.ENT.11815799212886844830",
"id": "wamid.HBgLMTY1MDM4Nzk0MzkVAgASGBQzQTRBNjU5OUFFRTAzODEwMTQ0RgA=",
"timestamp": "1749416383",
"type": "text",
"text": {
"body": "Does it come in another color?"
}
}
]
},
"field": "messages"
}
]
}
]
}
Basahin muna ang from at bumalik sa from_user_id kung wala. Para sa mga status, basahin ang recipient_id at bumalik sa recipient_user_id kung wala. Nagpi-print ang script na ito ng isang identity bawat event mula sa isang naka-save na payload:
# identities.py. Run: python3 identities.py payload.json
import json
import sys
def identities(payload):
for entry in payload.get("entry", []):
for change in entry.get("changes", []):
value = change.get("value", {})
profiles = {}
for c in value.get("contacts", []):
for key in (c.get("wa_id"), c.get("user_id")):
if key:
profiles[key] = c.get("profile", {})
for m in value.get("messages", []):
who = m.get("from") or m.get("from_user_id")
if who is None and m.get("type") == "system":
who = m["system"].get("user_id") # user_changed_user_id has no from
username = profiles.get(who, {}).get("username")
yield "message", m.get("id"), m.get("type"), who, username
for s in value.get("statuses", []):
who = s.get("recipient_id") or s.get("recipient_user_id")
yield "status", s.get("id"), s.get("status"), who, None
if __name__ == "__main__":
with open(sys.argv[1]) as f:
for row in identities(json.load(f)):
print(row)
Sa mga group message, group ID ang laman ng recipient_id. Nasa mga username at BSUID kung paano gawing key ng contact table ang mga field na ito.
Text at mga ad referral
Nasa text.body ang mensahe. Naglalagay ang syntax block ng Meta para sa text ng mga <!-- --> comment sa loob ng JSON, kaya template ito at hindi valid na JSON. Nasa parehong page ang mga gumaganang halimbawa.
| Field | Kailan ito lumalabas |
|---|---|
context.from, context.id, context.referred_product |
Na-tap ng user ang “Message business” sa isang produkto. May catalog_id at product_retailer_id ang referred_product |
context.forwarded |
Na-forward nang 5 beses o mas kaunti |
context.frequently_forwarded |
Na-forward nang higit sa 5 beses |
referral.source_url, source_id, source_type |
Galing ang mensahe sa isang Click to WhatsApp ad. ad ang source_type |
referral.body, headline, welcome_message.text |
Ang primary text, headline at greeting ng ad |
referral.media_type, image_url, video_url, thumbnail_url |
image o video, kasama ang URL para sa format ng ad na iyon |
referral.ctwa_clid |
Ad click ID, wala para sa mga ad placement sa WhatsApp Status |
Lumalabas din ang referral sa syntax para sa image, audio, video, document, sticker, location at contacts. Para lang sa text nagpapakita ng referral example ang mga reference page. Ito ang message object nito:
{
"referral": {
"source_url": "https://fb.me/3cr4Wqqkv",
"source_id": "120226305854810726",
"source_type": "ad",
"body": "Summer Succulents are here!",
"headline": "Chat with us",
"media_type": "image",
"image_url": "https://scontent.xx.fbcdn.net/v/t45.1...",
"ctwa_clid": "Aff-n8ZTODiE79d22KtAwQKj9e_mIEOOj27vDVwFjN80dp4_0NiNhEgpGo0AHemvuSoifXaytfTzcchptiErTKCqTrJ5nW1h7IHYeYymGb5K5J5iTROpBhWAGaIAeUzHL50",
"welcome_message": {
"text": "Hi there! Let us know how we can help!"
}
},
"from": "16505551234",
"id": "wamid.HBgLMTY1MDM4Nzk0MzkVAgASGBQzQUQ0N0VFMDA2MTQ0RkJFNkNDNAA=",
"timestamp": "1750275992",
"text": {
"body": "Can I get more info about this?"
},
"type": "text"
}
Ipinapaliwanag ng Click to WhatsApp ads kung para saan ang ctwa_clid.
Media: image, audio, video, document, sticker
| Field | Mga type | Kahulugan |
|---|---|---|
id |
Lahat ng lima | Media asset ID. Nagbabalik ng asset URL ang GET dito |
url |
Lahat ng lima | Download URL, kinukuha gamit ang access token mo. Unti-unting inilalabas mula Nobyembre 12, 2025 |
mime_type |
Lahat ng lima | MIME type |
sha256 |
Lahat ng lima | SHA-256 hash ng file |
caption |
image, video, document | Teksto ng caption |
filename |
document | Pangalan ng file |
voice |
audio | true para sa voice recording na ginawa sa WhatsApp client |
animated |
sticker | true para sa animated na sticker |
Ito ang image object mula sa sample ng Meta (Image webhook reference). Pinuputol ng Meta ang url gamit ang ... sa lahat ng limang sample:
{
"type": "image",
"image": {
"caption": "Taj Mahal",
"mime_type": "image/jpeg",
"sha256": "SfInY0gGKTsJlUWbwxC1k+FAD0FZHvzwfpvO0zX0GUI=",
"id": "1003383421387256",
"url": "https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=133..."
}
}
Ipini-print ng Meta ang fragment na ito nang walang panlabas na brace; idinagdag ang mga iyon dito para ma-parse. Pareho ang hugis ng audio, video, document at sticker sa ilalim ng sarili nilang key. Nasa mga expired na media URL ang pag-download.
Location at mga shared contact
| Type | Mga field |
|---|---|
location |
latitude, longitude (decimal degrees), name, address, url (kadalasan para lang sa mga lokasyon ng business) |
contacts |
Bawat card: name (formatted_name, first_name, last_name, middle_name, suffix, prefix), phones[] (phone, wa_id, type), emails[], addresses[], org, urls[], birthday |
Dumarating ang shared card sa messages[].contacts. Nananatili sa value.contacts ang nagpadala. Kapag pinaghalo mo ang dalawa, pangalan ng ibang tao ang malalagay sa nagpadala mo. Ang contacts sample ng Meta (Contacts webhook reference):
{
"from": "16505551234",
"id": "wamid.HBgLMTY1MDM4Nzk0MzkVAgASGBQzQTRBNjU5OUFFRTAzODEwMTQ0RgA=",
"timestamp": "1744344496",
"type": "contacts",
"contacts": [
{
"name": {
"first_name": "Barbara",
"last_name": "Johnson",
"formatted_name": "Barbara J. Johnson"
},
"org": {
"company": "Social Tsunami"
},
"phones": [
{
"phone": "+1 (415) 555-0829",
"wa_id": "14125550829",
"type": "MOBILE"
}
]
}
]
}
Mga interactive reply at template button
type / interactive.type |
Mga field | Source |
|---|---|---|
interactive / list_reply |
id (row ID), title, description |
Interactive reference |
interactive / button_reply |
id (button ID), title |
Interactive reference |
interactive / product |
retailer_id, title, description, currency_code, price_amount, sale_price_amount (kapag naka-sale lang), url |
Interactive reference |
interactive / nfm_reply |
name (flow), body (laging Sent), response_json |
Flows guide |
button |
payload, text, parehong inilalarawan bilang label ng quick reply |
Button reference |
Ang price_amount ay ang presyo na “na-multiply sa 1,000”. Nakaturo ang context.id sa isang reply sa mensaheng may hawak ng button o list. Galing ang button webhook sa quick-reply button sa isang template, samantalang galing ang button_reply sa interactive message na ipinadala mo (Interactive webhook reference, Button webhook reference).
Ang button reply sample ng Meta:
{
"context": {
"from": "15550783881",
"id": "wamid.HBgLMTY1MDM4Nzk0MzkVAgARGBI3MEM2RUJFNkI0RENGQTVDRjUA"
},
"from": "16505551234",
"id": "wamid.HBgLMTY1MDM4Nzk0MzkVAgASGBQzQTZBQzg0MzQ4QjRCM0NGNkVGOAA=",
"timestamp": "1750025136",
"type": "interactive",
"interactive": {
"type": "button_reply",
"button_reply": {
"id": "cancel-button",
"title": "Cancel"
}
}
}
String sa loob ng JSON ang Flow response, kaya i-parse ulit ang response_json. Ito ay “hindi kasama ang Flow ID”. Ilagay ang sarili mong identifier sa flow_token kapag ipinadala mo ang Flow (Receive Flow response, na-access noong 2026-11-04). Ang sample ng Meta ay isang messages fragment na may mga placeholder value:
{
"messages": [{
"context": {
"from": "16315558151",
"id": "gBGGEiRVVgBPAgm7FUgc73noXjo"
},
"from": "<USER_ACCOUNT_NUMBER>",
"id": "<MESSAGE_ID>",
"type": "interactive",
"interactive": {
"type": "nfm_reply",
"nfm_reply": {
"name": "flow",
"body": "Sent",
"response_json": "{\"flow_token\": \"<FLOW_TOKEN>\", \"optional_param1\": \"<value1>\", \"optional_param2\": \"<value2>\"}"
}
},
"timestamp": "<MESSAGE_SEND_TIMESTAMP>"
}]
}
Mga reaction, order at iba pa
| Type | Mga field | Tala |
|---|---|---|
reaction |
message_id, emoji |
Mga reaction sa mensahe ng business mula sa huling 30 araw. Kapag tinanggal ang reaction, may isa pang webhook na walang emoji |
order |
catalog_id, text, product_items[] (product_retailer_id, quantity, item_price, currency) |
Integer ang quantity at presyo |
system |
type, body, wa_id, user_id, parent_user_id, previous_user_id, previous_parent_user_id |
user_changed_number o user_changed_user_id ang type. Walang contacts array ang mga sample ng Meta, at walang from ang pagbabago ng BSUID |
unsupported |
errors[], unsupported.type |
Mga code na 131051 “Message type unknown” at 131060 “This message is currently unavailable”. Mga value ng unsupported.type: button, edit, errors, gif, group_invite, hsm, image, interactive, keep_in_chat, link_preview, list, location, media_placeholder, order, pin, poll_creation, poll_update, product, reaction |
edit |
original_message_id, message |
Sa mga coexistence number lang, sa loob ng 15 minuto mula sa pagpapadala |
revoke |
original_message_id |
Sa mga coexistence number lang, sa loob ng dalawang araw mula sa pagpapadala |
text na may group_id |
group_id |
Mga group message na ginawa gamit ang Groups API |
Sa labas ng coexistence, dumarating bilang unsupported ang edit (Unsupported webhook reference). May ligaw na > sa dulo ng id ang group sample ng Meta, kaya hindi ito mukhang totoong wamid (Group webhook reference).
Mga status
| Field | Kahulugan |
|---|---|
id |
Ang wamid ng mensaheng ipinadala mo |
status |
sent, delivered, read, failed o played (voice message na pinatugtog sa unang pagkakataon) |
timestamp |
Unix time kung kailan na-trigger ang webhook |
recipient_id |
Phone number ng user, o ang group ID |
recipient_participant_id, recipient_type |
Sa mga group message lang |
recipient_identity_key_hash |
Kapag naka-enable lang ang identity change check |
biz_opaque_callback_data |
Kung itinakda mo lang ito noong nagpadala |
conversation |
Wala sa v24.0+ maliban kung nasa free entry point conversation ang mensahe |
conversation.id |
Ang conversation ID, kapag naroon ang conversation |
conversation.expiration_timestamp |
Sa mga sent status lang |
conversation.origin.type |
authentication, authentication_international, marketing, marketing_lite, referral_conversion, service, utility |
pricing |
Sa sent at sa isa sa delivered o read, hindi kailanman sa dalawa |
errors[] |
Sa failed lang: code, title, message, error_data.details, href |
Field ng pricing |
Mga value |
|---|---|
pricing_model |
PMP. CBP lang sa mga webhook na ipinadala bago ang Hulyo 1, 2025 |
type |
regular, free_customer_service, free_entry_point, free_group_customer_service |
category |
authentication, authentication-international, group_marketing, group_service, group_utility, marketing, marketing_lite, referral_conversion, service, utility |
billable |
Ide-deprecate; sinasabi ng Meta na gamitin ang type at category |
subtype |
free_tier, kapag “libre ang service message dahil naihatid ito sa loob ng free tier ng business phone number” (status reference, na-access noong 2026-11-23); paid_exempt, para sa mga libreng service message sa ilalim ng policy para sa gobyerno at non-profit |
Ipinapaliwanag ng dalawang changelog entry ang mas bagong hugis. Noong Oktubre 8, 2025, isinulat ng Meta na ang status webhook ay “hindi na kasama ang conversation object”. Idinagdag ang played status noong Nobyembre 3, 2025 (WhatsApp changelog, na-access noong 2026-11-04).
Bilang lang ang read status kapag na-deliver na ang mensahe, at kapag binasa agad, ang delivered webhook ay “hindi ipinapadala” (Status webhook reference, na-access noong 2026-11-04). Ipinapakita pa rin ng status sample sa messages overview page ng Meta ang "pricing_model": "CBP" at isang conversation object, ang hugis bago ang Hulyo 2025. Gamitin ang mga sample ng status page. Ang failed na halimbawa nito:
{
"object": "whatsapp_business_account",
"entry": [
{
"id": "102290129340398",
"changes": [
{
"value": {
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "15550783881",
"phone_number_id": "106540352242922"
},
"statuses": [
{
"id": "wamid.HBgLMTY1MDM4Nzk0MzkVAgARGBI0QUQ2MjA4NEYyRkExNjMyREUA",
"status": "failed",
"timestamp": "1751142888",
"recipient_id": "16505551234",
"errors": [
{
"code": 131049,
"title": "This message was not delivered to maintain healthy ecosystem engagement.",
"message": "This message was not delivered to maintain healthy ecosystem engagement.",
"error_data": {
"details": "In order to maintain a healthy ecosystem engagement, the message failed to be delivered."
},
"href": "/documentation/business-messaging/whatsapp/support/error-codes"
}
]
}
]
},
"field": "messages"
}
]
}
]
}
Sa mga status sample ng BSUID page, lumalabas ang contacts sa mga delivered na status at wala sa mga failed. Wala ang recipient_user_id sa failed na status kapag sa phone number ka nagpadala. Nasa mga status webhook kung ano ang kahulugan ng bawat status para sa send logic mo, at may sariling post ang code 131049.
Mga error sa value
Dumarating ang mga problema sa system, app at account bilang value.errors[], at walang messages o statuses ang sample ng Meta (Errors webhook reference). Ang sample ng Meta, gaya ng pagkakalathala:
{
"object": "whatsapp_business_account",
"entry": [
{
"id": "102290129340398",
"changes": [
{
"value": {
"messaging_product": "whatsapp",
"metadata": {
"display_phone_number": "15550783881",
"phone_number_id": "106540352242922"
},
"errors": [
{
"code": 130429,
"title": "Rate limit hit",
"message": "Rate limit hit",
"error_data": {
"details": "Message failed to send because there were too many messages sent from this phone number in a short period of time"
},
"href": "/documentation/business-messaging/whatsapp/support/error-codes"
}
]
},
"field": "messages"
}
]
}
]
}
Tahimik na itinatapon ang mga ito ng parser na messages at statuses lang ang nilo-loop. I-log ang bawat value na walang alinman sa dalawa. Nasa post tungkol sa Express at post tungkol sa FastAPI ang mga kumpletong receiver sa Node.js at Python.
Ang Z-API Omni team