Closed trcalgaro closed 2 years ago
this should be fixed now. Please try again
@smashah
The error still persists
Request: curl -X 'POST' \ 'https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/createNewProduct' \ -H 'accept: */*' \ -H 'api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "args": { "name": "Teste From API", "price": "12", "currency": "BRL", "images": ["https://agropos.com.br/wp-content/uploads/2021/03/Estacao-meteorologica-automatica-na-fazenda.jpg"], "description": "A estação meteorológica é uma ferramenta fundamental.", "url": "https://www.google.com.br", "internalId": "000001", "isHidden": "false" } }'
Error
{ "success": false, "error": { "name": "Error", "message": "Evaluation failed: TypeError: Cannot read properties of undefined (reading 'default')\n at Object.window.WAPI.<computed> [as createNewProduct] (eval at <anonymous> (:1:10), <anonymous>:1:58957)\n at __puppeteer_evaluation_script__:1:86" } }
hi, i dont have a business MD acc so you will need to bear with me to resolve this. Please try again in a few minutes. thanks
Request
curl -X 'POST' \ 'https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxx/createNewProduct' \ -H 'accept: */*' \ -H 'api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "args": { "name": "Teste API", "price": "17", "currency": "BRL", "images": ["https://agropos.com.br/wp-content/uploads/2021/03/Estacao-meteorologica-automatica-na-fazenda.jpg"], "description": "essa é uma descrição do produto", "url": "https://www.google.com.br", "internalId": "000001", "isHidden": "false" } }'
Return
{ "success": false, "error": { "name": "Error", "message": "Evaluation failed: TypeError: Cannot destructure property 'chatParticipantCount' of 'e' as it is undefined.\n at new A (https://web.whatsapp.com/bootstrap_qr.8c19f3b9920c01c16ec8.js:69:332276)\n at Object.window.<computed>.<computed> [as procFiles] (__puppeteer_evaluation_script__:1:393775)\n at eval (eval at <anonymous> (:1:10), <anonymous>:1:85656)\n at Array.map (<anonymous>)\n at Object.window.<computed>.<computed> [as createNewProduct] (eval at <anonymous> (:1:10), <anonymous>:1:84758)" } }
Terminal
middleware -> error Error: Evaluation failed: TypeError: Cannot destructure property 'chatParticipantCount' of 'e' as it is undefined. at new A (https://web.whatsapp.com/bootstrap_qr.8c19f3b9920c01c16ec8.js:69:332276) at Object.window.<computed>.<computed> [as procFiles] (__puppeteer_evaluation_script__:1:393775) at eval (eval at <anonymous> (:1:10), <anonymous>:1:85656) at Array.map (<anonymous>) at Object.window.<computed>.<computed> [as createNewProduct] (eval at <anonymous> (:1:10), <anonymous>:1:84758) at ExecutionContext._evaluateInternal (C:\Users\xxxxxx\AppData\Local\npm-cache\_npx\21fe510f43113ad2\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221:19) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async ExecutionContext.evaluate (C:\Users\x\xxxxxAppData\Local\npm-cache\_npx\21fe510f43113ad2\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:110:16)
@smashah If you want I can provide access to my api, this number I use for testing. Call me by email if you want me to send you the API KEY
@trcalgaro i think the resolution to this issue is to make a chat with your own host account.
Do this via the mobile app then try again.
actually I think you can try again without making a chat with yourself
Runing on Linux Machine return this error:
middleware -> error Error: Evaluation failed: TypeError: Failed to execute 'readAsArrayBuffer' on 'FileReader': parameter 1 is not of type 'Blob'. at https://web.whatsapp.com/bootstrap_qr.8e365468263647825bd5.js:51:405672 at Y (https://web.whatsapp.com/bootstrap_qr.8e365468263647825bd5.js:5:273292) at new y (https://web.whatsapp.com/bootstrap_qr.8e365468263647825bd5.js:5:265859) at c (https://web.whatsapp.com/bootstrap_qr.8e365468263647825bd5.js:51:405336) at Object.<anonymous> (https://web.whatsapp.com/bootstrap_qr.8e365468263647825bd5.js:51:32595) at Generator.next (<anonymous>) at t (https://web.whatsapp.com/vendor1~bootstrap_qr.d16f7b9f073b657b8f2a.js:2:62943) at s (https://web.whatsapp.com/vendor1~bootstrap_qr.d16f7b9f073b657b8f2a.js:2:63154) at https://web.whatsapp.com/vendor1~bootstrap_qr.d16f7b9f073b657b8f2a.js:2:63213 at Y (https://web.whatsapp.com/bootstrap_qr.8e365468263647825bd5.js:5:273292) at ExecutionContext._evaluateInternal (/home/xxxxxx/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async ExecutionContext.evaluate (/home/xxxxxxx/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
When I run it with the base64 image code it works! Could it be the problem in converting the image from the web link?
{ "success": true, "response": { "id": "4868772586554448", "isHidden": true, "catalogWid": "xxxxxxxxxx@c.us", "url": "https://www.google.com.br/", "name": "Teste API", "description": "Teste vindo da API", "availability": "unknown", "reviewStatus": "NO_REVIEW", "canAppeal": true, "currency": "BRL", "priceAmount1000": 17000, "retailerId": "000001", "imageCount": 1, "imageCdnUrl": "https://mmg.whatsapp.net/v/t45.5328-4/277846910_5842124802506832_4720980944146045509_n.jpg?ccb=1-5&_nc_sid=c48759&_nc_ohc=0PQgOS2ig1UAX-jVfia&_nc_ad=z-m&_nc_cid=0&_nc_ht=mmg.whatsapp.net&oh=01_AVwYB1fKFmiK1_iTWOY98aYQZqi4RbqPiO97pwFNCX-Kkg&oe=6255319C", "imageHash": "5842124795840166", "t": 1649385963.509, "productImageCollection": [ { "id": "_0", "mediaUrl": "https://mmg.whatsapp.net/v/t45.5328-4/277846910_5842124802506832_4720980944146045509_n.jpg?ccb=1-5&_nc_sid=c48759&_nc_ohc=0PQgOS2ig1UAX-jVfia&_nc_ad=z-m&_nc_cid=0&_nc_ht=mmg.whatsapp.net&oh=01_AVwYB1fKFmiK1_iTWOY98aYQZqi4RbqPiO97pwFNCX-Kkg&oe=6255319C", "fetchedFromServer": true } ], "fetchedFromServer": true } }
@trcalgaro Yes, for now it requires a base 64 image because it doesnt get the urls itself yet. I can implement that actually to make sure the format is correct using the same convenient logic in other methods like sendFile
.
I think it makes sense that you put yes, this will make it a lot easier.
I was trying because in the documentation it brings this possibility "Parameter: {string} images An array of dataurl or base64 strings of product images, the first image will be used as the main image. At least one image is required."
@github-actions run
Are you using the latest version of the library?
What type of session are you experiencing this issue on?
Multi-device and I have set multiDevice to true in my config OR am using the --multi-device flag
What type of host account are you experiencing this issue on?
Business account
Mode
EASY API/CLI
Current Behavior
Trying to create a product via API
Expected Behavior
create a product
Steps To Reproduce
curl -X 'POST' \ 'https://xxxxxxxxxxxxxxxx/createNewProduct' \ -H 'accept: */*' \ -H 'api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \ -H 'Content-Type: application/json' \ -d '{ "args": { "name": "Produto From API", "price": "50", "currency": "BRL", "images": ["https://a-static.mlcdn.com.br/1500x1500/robo-com-movimento-tectoys-agil-emite-som-luz-polibrinq/magazineluiza/226997000/6d199b47751be62af805477eb39bda3a.jpg", "https://files.tecnoblog.net/wp-content/uploads/2022/03/mini-cheetah-mit-edited.jpg"], "description": "Isso é uma descrição", "url": "https://www.google.com.br", "internalId": "1234556", "isHidden": "false" } }'
{ "success": false, "error": { "name": "Error", "message": "Evaluation failed: TypeError: Cannot read properties of undefined (reading '_serialized')\n at Object.window.WAPI.<computed> [as createNewProduct] (eval at <anonymous> (:1:10), <anonymous>:1:79054)\n at __puppeteer_evaluation_script__:1:86" } }
Error from terminal
middleware -> error Error: Evaluation failed: TypeError: Cannot read properties of undefined (reading '_serialized') at Object.window.WAPI.<computed> [as createNewProduct] (eval at <anonymous> (:1:10), <anonymous>:1:54186) at __puppeteer_evaluation_script__:1:86 at ExecutionContext._evaluateInternal (C:\Users\xxxx\AppData\Local\npm-cache\_npx\21fe510f43113ad2\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:221:19) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async ExecutionContext.evaluate (C:\Users\xxxx\AppData\Local\npm-cache\_npx\21fe510f43113ad2\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:110:16)
create() code
No response
DEBUG INFO
Environment
Screenshots/Logs
No response
Anything else?
No response