whatsapp-web.js: Error sending a Buttons Message in branch fix-buttons-list

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

(node:12656) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading ‘id’) at puppeteer_evaluation_script:64:51 at Array.map (<anonymous>) at Object.window.WWebJS.prepareMessageButtons (puppeteer_evaluation_script:63:71) at Object.window.WWebJS.sendMessage (puppeteer_evaluation_script:184:43) at puppeteer_evaluation_script:10:45 at ExecutionContext._evaluateInternal (C:\Users\Equipo\Desktop\wweb\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221:19) at runMicrotasks (<anonymous>) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async ExecutionContext.evaluate (C:\Users\Equipo\Desktop\wweb\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:110:16) at async Client.sendMessage (C:\Users\Equipo\Desktop\wweb\node_modules\whatsapp-web.js\src\Client.js:686:28) (Use node --trace-warnings ... to show where the warning was created) (node:12656) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:12656) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Expected behavior

It should send the buttons with no problem

Steps to Reproduce the Bug or Issue

let selectButton = new Buttons(‘Button body’, [{ body: ‘Aceptar’ }, { body: ‘rechazar’ }, { body: ‘rechazar’ }], ‘’, ‘footer’); client.sendMessage(${telf}@c.us, selectButton);

Relevant Code

No response

Browser Type

Chromium

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

Windows 11

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 20

Most upvoted comments

Hi guys to fix this problem I made these changes in src/util/Injected.js take a look at the commit of the fix: https://github.com/meetscrm/whatsapp-web.js/commit/8a46b65e2284ae2b031b5a9217e33ec2bab2e579

This branch works github:pedroslopez/whatsapp-web.js#f655453

in commit 8ae50ec99c55550aab5675b0ce1a714fc3121552 works!!!