You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Meta Cloud API: no MESSAGES_UPDATE for delivery statuses — TypeError reading 'name' when the status payload carries contacts without profile #2704
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:
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):
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
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.
Send any message (template or plain text) through the instance.
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
Activity