wa-automate-nodejs icon indicating copy to clipboard operation
wa-automate-nodejs copied to clipboard

API Error: Unable to Post Poll Due to Incorrect Argument Parsing

Open pavankpdev opened this issue 1 year ago • 3 comments

Are you using the latest version of the library?

  • [X] I have checked and am using the latest version of the library.

What type of session are you experiencing this issue on?

Legacy (Normal)

What type of host account are you experiencing this issue on?

Personal account (normal)

Mode

EASY API/CLI

Current Behavior

I'm trying to call the /sendPoll API from Swagger, but it fails with the following error:

Request Body

{
    "args": {
        "to": "****************@g.us",
        "name": "Where shall we eat?",
        "options": [
            "Pizza Express",
            "Pizza Hut",
            "Pizza Fusion"
        ],
        "allowMultiSelect": false
    }
}

Response

{
    "success": false,
    "error": {
        "name": "Error",
        "message": "Please set arguments in request json body, not in params. Evaluation failed: TypeError: _0x3037c7[(_0x2267e9(...) + \"FE\")](...) is not a function\n    at window.<computed>.<computed> [as sendPoll] (pptr://__puppeteer_evaluation_script__:1:655267)\n    at pptr://__puppeteer_evaluation_script__:2:29"
    }
}

I tried the same request with Postman and cURL, and the result is the same error.

Expected Behavior

The expected behavior is that the API should successfully post a poll in my group chat, allowing group members to vote on where we should eat.

Steps To Reproduce

  1. Run npx @open-wa/wa-automate -w https://webhook.site/87c9b01e-ba82-415a-9d0e-af6cabd4f2ce -p 8008
  2. Open swagger docs at http://localhost:8008/api-docs/#/default/post_sendPoll
  3. Try to call sendPoll API

create() code OR full CLI command + CONFIG

npx @open-wa/wa-automate -w https://webhook.site/87c9b01e-ba82-415a-9d0e-af6cabd4f2ce -p 8008

DEBUG INFO

┌─────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ (index)             │ Values                                                                                                                                     │
├─────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ WA_VERSION          │ '2.3000.1014228662'                                                                                                                        │
│ PAGE_UA             │ 'WhatsApp/2.2147.16 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36' │
│ WA_AUTOMATE_VERSION │ '1.0.0'                                                                                                                                    │
│ BROWSER_VERSION     │ 'HeadlessChrome/112.0.5614.0'                                                                                                              │
│ OS                  │ 'macOS Unknown'                                                                                                                            │
│ START_TS            │ 1718387007090                                                                                                                              │
│ RAM_INFO            │ 'Total: 17.18 GB | Free: 1.88 GB'                                                                                                          │
│ PPTR_VERSION        │ '19.11.1'                                                                                                                                  │
└─────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Environment

- OS: MacOS
- Node: v21.7.3
- npm: 10.5.0

Screenshots/Logs

image

Anything else?

Additional Attempts

I also tried sending the request using Postman and cURL with the same request body, but I encountered the same error message each time. It seems the API is not accepting the arguments as they are currently structured in the request body.

pavankpdev avatar Jun 14 '24 18:06 pavankpdev

when was the last time you tried this? im unable to replicate the problem

smashah avatar Jun 29 '24 19:06 smashah

@smashah I tried this two weeks ago, please try to call the API to send Poll to replicate this issue. I used the CLI to bootstrap the project

Both sending poll and reason the poll API doesn't work.

pavankpdev avatar Jun 29 '24 19:06 pavankpdev

@smashah I tried the same using the docker version of openwa, I get this below error when I try sendPoll

Body

{
  "args": {
    "to": "[email protected]",
    "name": "string",
"localId": "123",
    "options": ["dad", "DAdad"],
    "allowMultiSelect": "boolean"
  }
}

Response

{
  "success": false,
  "error": {
    "name": "TypeError",
    "message": "Please set arguments in request json body, not in params. Cannot read properties of undefined (reading 'id')\nj (https://static.whatsapp.net/rsrc.php/v3i8Ri4/yB/l/rt/HOH2o6x2WEY.js?_nc_x=Ij3Wp8lg5Kz:172:1135)\nObject.<anonymous> (https://static.whatsapp.net/rsrc.php/v3i8Ri4/yB/l/rt/HOH2o6x2WEY.js?_nc_x=Ij3Wp8lg5Kz:172:561)"
  }
}

pavankpdev avatar Jun 30 '24 09:06 pavankpdev