pedroslopez / whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app
https://wwebjs.dev
Apache License 2.0
15.05k stars 3.58k forks source link

How to get product metadata of an order object #2048

Closed Tecsom closed 9 months ago

Tecsom commented 1 year ago

Is there an existing issue for this?

Describe the bug

When i get an order object from message, I try to use

product.getData(); but it returns

(node:4015) UnhandledPromiseRejectionWarning: Error: Evaluation failed: Error: DEVICE_JID: invalid jid type: Not an instance of WID at t.DEVICE_JID (https://web.whatsapp.com/app.ba661b5cb05f407d7b82.js:40:390014) at https://web.whatsapp.com/app.ba661b5cb05f407d7b82.js:46:152352 at Generator.next () at t (https://web.whatsapp.com/vendor1~app.0c8e960e5dfd7020f562.js:2:66483) at s (https://web.whatsapp.com/vendor1~app.0c8e960e5dfd7020f562.js:2:66694) at https://web.whatsapp.com/vendor1~app.0c8e960e5dfd7020f562.js:2:66753 at Y (https://web.whatsapp.com/app.ba661b5cb05f407d7b82.js:5:140123) at new y (https://web.whatsapp.com/app.ba661b5cb05f407d7b82.js:5:132690) at https://web.whatsapp.com/vendor1~app.0c8e960e5dfd7020f562.js:2:66634 at https://web.whatsapp.com/app.ba661b5cb05f407d7b82.js:46:152810 at ExecutionContext._evaluateInternal (/Users/JuanSotoM/Desktop/DELIBOT/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19) at process.processTicksAndRejections (node:internal/process/task_queues:96:5) at async ExecutionContext.evaluate (/Users/JuanSotoM/Desktop/DELIBOT/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16) at async Product.getData (/Users/JuanSotoM/Desktop/DELIBOT/node_modules/whatsapp-web.js/src/structures/Product.js:55:26) at async stepOne (/Users/JuanSotoM/Desktop/DELIBOT/src/main.js:1596:33) at async start (/Users/JuanSotoM/Desktop/DELIBOT/src/main.js:722:25) (node:4015) 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)

Expected behavior

Expected behavior is to get this data

this.id = data.id; / Retailer ID */ this.retailer_id = data.retailer_id; /* Product Name / this.name = data.name; / Product Description */ this.description = data.description;

Steps to Reproduce the Bug or Issue

  1. Send message order type to bot number.
  2. Iterate products of order and try to access metadata of each

Relevant Code

No response

Browser Type

Google Chrome

WhatsApp Account Type

WhatsApp Business

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

OS: Mac Phone OS: Android Most recent whatsapp-web.js version

Additional context

No response

faviocabral commented 1 year ago

You still have it the problem ?

Tecsom commented 1 year ago

Yes