Skip to content

fix: Send image/video status#201816

Open
lucianobustos wants to merge 5 commits into
wwebjs:mainfrom
lucianobustos:fix/status-media-lid-signature
Open

fix: Send image/video status#201816
lucianobustos wants to merge 5 commits into
wwebjs:mainfrom
lucianobustos:fix/status-media-lid-signature

Conversation

@lucianobustos

Copy link
Copy Markdown

Problem

Posting an image/video status via client.sendMessage('status@broadcast', media) throws:

TypeError: Cannot read properties of undefined (reading 'id')
    at ... (WhatsApp Web bundle)
    at window.WWebJS.sendMessage (Utils.js — sendStatusMediaMsgAction(msg, mediaUpdate))
    at Client.sendMessage (src/Client.js)

Text status is unaffected.

Fixes #201807.

Cause

Current WhatsApp Web builds changed WAWebSendStatusMsgAction.sendStatusMediaMsgAction:

  • it now takes a single object { mediaMsgData, beforeSend, funnelContext } (it reads arg.mediaMsgData.id), so the existing positional call (msg, mediaUpdate) leaves arg.mediaMsgData undefined → the crash;
  • it requires LID identities — PN (@c.us) WIDs are no longer accepted.

Separately, WAWebStatusGatingUtils.canCheckStatusRankingPosterGating is missing from some builds, so the shared model construction can throw before the send is even reached.

Fix

In the isStatus branch of WWebJS.sendMessage:

  • Media: build the status message data with LID WIDs (getMeDeviceLidOrThrow() for from, getMaybeMeLidUser() for author/participant) and call the current signature:
    await StatusAction.sendStatusMediaMsgAction({
        mediaMsgData,
        beforeSend: async () => {},
        funnelContext: undefined,
    });
  • Text: unchanged behaviour (still sendStatusTextMsgAction(statusOptions)), but the canCheckStatusRankingPosterGating call is guarded with ?.() ?? false.

Testing

Verified end-to-end on a fully LID-migrated account (whatsapp-web.js 1.34.7):

  • sendMessage('status@broadcast', <image MessageMedia>, { caption }) → posts and renders as a story; internal result { messageSendResult: 'OK', msg }.
  • Same for video.
  • Text status still works.

Recipe originally identified by @diun935 in #201807 — thanks!

Notes

Uses stable module IDs (WAWebSendStatusMsgAction, WAWebUserPrefsMeUser, WAWebMsgKey, WAWebWidFactory), not bundle offsets. Happy to adjust naming/style to match project conventions.

…ignature

Sending an image/video status (`sendMessage('status@broadcast', media)`)
crashed with "Cannot read properties of undefined (reading 'id')".

Current WhatsApp Web builds changed `WAWebSendStatusMsgAction
.sendStatusMediaMsgAction` to take a single object
`{ mediaMsgData, beforeSend, funnelContext }` and to require LID
identities, so the previous positional `(msg, mediaUpdate)` call left
`arg.mediaMsgData` undefined. Build the media status message with LID
WIDs (`getMeDeviceLidOrThrow` / `getMaybeMeLidUser`) and call the new
signature. Text status is split out and keeps its existing path; its
`canCheckStatusRankingPosterGating` call is guarded since that helper is
also missing from some builds.

Verified end-to-end on a LID-migrated account: image and video status
now post and render (result `{ messageSendResult: 'OK', msg }`).

Fixes wwebjs#201807
@github-actions github-actions Bot added api changes API modifications utility Utility code labels Jul 2, 2026
@BenyFilho

Copy link
Copy Markdown
Member

Esse código poderia ser bem mais simples

@BenyFilho BenyFilho left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing unnecessary things

@BenyFilho BenyFilho changed the title fix: post image/video status via current LID-era sendStatusMediaMsgAction signature fix: Send image/video status Jul 3, 2026
@lucianobustos

Copy link
Copy Markdown
Author

Great @BenyFilho
My solution is tested and working e2e

Is working by removing this too ??

@BenyFilho

Copy link
Copy Markdown
Member

Great @BenyFilho My solution is tested and working e2e

Is working by removing this too ??

Just test it

@BenyFilho BenyFilho added the approved Confirmed by maintainers label Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api changes API modifications approved Confirmed by maintainers utility Utility code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Media status (image/video) posting crashes in sendStatusMediaMsgAction on LID-era WhatsApp Web ('Cannot read properties of undefined (reading id)')

3 participants