Skip to content

Meta Cloud API: no MESSAGES_UPDATE for delivery statuses — TypeError reading 'name' when the status payload carries contacts without profile #2704

Description

@ErliSoares

What happens

On the Meta Cloud API channel (whatsapp.business.service.ts), no MESSAGES_UPDATE webhook is ever
emitted for delivery statuses
. Every sent / delivered / read callback from Meta is logged and then
lost:

ERROR [ChannelStartupService] TypeError: Cannot read properties of undefined (reading 'name')
    at Ls.messageHandle (/evolution/dist/main.js:231:774)
    at Ls.eventHandler (/evolution/dist/main.js:231:9623)

Three of these per outgoing message (one per ack). Incoming messages are unaffected.

Cause

messageHandle reads the push name before anything else:

https://github.com/EvolutionAPI/evolution-api/blob/2.3.7/src/api/integrations/channel/meta/whatsapp.business.service.ts#L390

if (received.contacts) pushName = received.contacts[0].profile.name;

This assumes contacts only ever appears on an incoming-message event, where the entry does carry
profile.name. Meta's status callback now also carries a contacts array — but without profile, only
the recipient identity (the user_id that comes along with pricing_model: "PMP" / recipient_user_id):

{
  "messaging_product": "whatsapp",
  "metadata": { "display_phone_number": "<redacted>", "phone_number_id": "<redacted>" },
  "contacts": [ { "wa_id": "<redacted>", "user_id": "BR.<redacted>" } ],
  "statuses": [
    {
      "id": "wamid.<redacted>",
      "status": "delivered",
      "timestamp": "1787583812",
      "recipient_id": "<redacted>",
      "recipient_user_id": "BR.<redacted>",
      "pricing": { "billable": true, "pricing_model": "PMP", "category": "marketing", "type": "regular" }
    }
  ]
}

So received.contacts[0].profile is undefined, and reading .name throws. The if (received.statuses)
block that would emit MESSAGES_UPDATE sits ~350 lines further down inside the same try, so it is never
reached; the catch only logs. pushName is not used on the status path at all.

main and 2.4.0-rc2 still have the same unguarded line.

Suggested fix

-      if (received.contacts) pushName = received.contacts[0].profile.name;
+      if (received.contacts) pushName = received.contacts?.[0]?.profile?.name;

Happy to open a PR if that is welcome.

Steps to reproduce

  1. Meta Cloud API channel instance, messages field subscribed in the Meta app, MESSAGES_UPDATE in the
    instance webhook events, DATABASE_SAVE_DATA_NEW_MESSAGE=true.
  2. Send any message (template or plain text) through the instance.
  3. Meta posts the sent / delivered / read callbacks; each one logs the TypeError above and no
    MESSAGES_UPDATE webhook is delivered, nor is a MessageUpdate row written.

Environment

  • Evolution API 2.3.7 (Docker image evoapicloud/evolution-api:v2.3.7), Postgres + Redis
  • Channel: Meta Cloud API (WhatsApp Business Platform), Graph API official cloud
  • Observed 2026-08-24

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions