open-wa / wa-automate-nodejs

💬 🤖 The most reliable tool for chatbots with advanced features. Be sure to 🌟 this repository for updates!
https://docs.openwa.dev/
Other
3.09k stars 591 forks source link

QR URL for easyAPI #3016

Open scropion86 opened 1 year ago

scropion86 commented 1 year ago

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?

Personal account (normal)

Mode

EASY API/CLI

Current Behavior

When enabling --ezqr --popup true --ev 'https://webhook.site/7dce32e9…..

the webhock received everything at launch except the QR URL such this message“Scan the qr code at https://qr.openwa.cloud/1681d”

and since I enabled popup flag I was expecting to be able to see the QR from “server:port/qr" but because I am using API key o got “{"error":"unauthorised"}”

Expected Behavior

Steps To Reproduce

npx @open-wa/wa-automate -p 1234 --ezqr --popup true --ev 'https://webhook.site/7dce32e9-561d-4.........'

create() code OR full CLI command + CONFIG

npx @open-wa/wa-automate -p 1234 --ezqr --popup true --ev 'https://webhook.site/7dce32e9-561d-4.........'

DEBUG INFO

┌─────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│       (index)       │                                                                   Values                                                                   │
├─────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│     WA_VERSION      │                                                                 '2.2301.6'                                                                 │
│       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 │                                                                  '4.55.0'                                                                  │
│   BROWSER_VERSION   │                                                       'HeadlessChrome/109.0.5412.0'                                                        │
│         OS          │                                                                'Linux 5.15'                                                                │
│      START_TS       │                                                               1673879684176                                                                │
│      RAM_INFO       │                                                      'Total: 8.20 GB | Free: 7.25 GB'                                                      │
│    PPTR_VERSION     │                                                                  '19.5.2'                                                                  │
└─────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Environment

- OS: 
- Node: 
- npm:

Screenshots/Logs

No response

Anything else?

No response

fire17 commented 1 year ago

watching :)

i am spinning up open-wa with npx on a python subprocess, i can create a new directory, open the process from there, and get a fresh wa api ready for qr scanning... I wish to know how to export it and also get the changing qr if it wasn't scanned it time. I assume this is what the webhook option is for.. Some guidance or material would help :) thanks alot

scropion86 commented 1 year ago

Yes this might be a smart workaround , environment variable or CLI flag in case of EasyApi

On Mon, Jan 16, 2023 at 7:43 PM Mohammed Shah @.***> wrote:

Hmmm, it's assumed that you want to block public access to the qr code if you set the api key.

Maybe there can be an environment variable to bypass any authentication specifically on the popup?

— Reply to this email directly, view it on GitHub https://github.com/open-wa/wa-automate-nodejs/issues/3016#issuecomment-1384309222, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKPXPW2T5ZSX2RQMTWSEPTWSV3CNANCNFSM6AAAAAAT42IUMU . You are receiving this because you authored the thread.Message ID: @.***>

scropion86 commented 1 year ago

watching :)

  • can anyone share a link to docs where this is officially covered ?

i am spinning up open-wa with npx on a python subprocess, i can create a new directory, open the process from there, and get a fresh wa api ready for qr scanning... I wish to know how to export it and also get the changing qr if it wasn't scanned it time. I assume this is what the webhook option is for.. Some guidance or material would help :) thanks alot

if you mean documentation for EASY API CLI here is the Link https://openwa.dev/docs/configuration/command-line-options

smashah commented 1 year ago

something is missing here, how are you getting {"error":"unauthorised"} if:

Can you show me a screen recording (including terminal) of you experiencing this problem please + -v logs

smashah commented 1 year ago

Also @scropion86 @fire17 you can constantly refresh that --ezqr image as it is not cached and always returns the latest qr code (albeit with a delay of upload).

fire17 commented 1 year ago

Thanks @scropion86 for the cli docs link, i've learned of a few more things that are possible even though it didnt mention the qr there, since im using the api with python, I usually go by https://openwa.dev/docs/api/classes/api_Client.Client but again no mention there of onQR event

@smashah could you please advise ? for me the best case scenario is to have an event from the client (like any other) where it fires every time a qr is prompted This way I can update any open socket to my site with an updated qr for me to scan remotely Please let me know if this is possible or how this could be done otherwise from my env?.. Thanks a lot 🙏 😇

scropion86 commented 1 year ago

something is missing here, how are you getting {"error":"unauthorised"} if:

  • you don't have -k in your command (are you using cli.config.json?)
  • that authentication layer is only available once the api is up and the session is running?

Can you show me a screen recording (including terminal) of you experiencing this problem please + -v logs

sorry for confusing you , the error {"error":"unauthorised"} was a result from other session which -k was used. and i am not using cli.config.json

smashah commented 1 year ago

@fire17 have you tried the python socket client?

https://github.com/open-wa/wa-automate-socket-client-python

@scropion86 ok so there should be no limitations on the popup URL. What is the remaining problem then?

scropion86 commented 1 year ago

--ezqr URL is not sent to the webhook if --ev 'https://webhook.site/7dce32e9…..

smashah commented 1 year ago

todo:

smashah commented 1 year ago

@github-actions run

⚡ Release! ⚡ ```js (async () => { function exec(cmd) { try { execSync(cmd, {stdio: 'inherit'}) } catch (error) { console.log(`Status Code: ${error.status} with '${error.message}'`); } } //set the version type process.env.VERS = "patch" // Config const gitUserEmail = "github-actions[bot]@users.noreply.github.com"; const gitUserName = "github-actions[bot]"; exec(`echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc`); exec(`git config --global user.email "${gitUserEmail}"`); exec(`git config --global user.name "${gitUserName}"`); exec(`npm i -D`); exec(`npm run release-ci $VERS`); // types only package exec('npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN') exec(`npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN && npm run types:publish `); exec(`git commit -a -m 'updated types-only package'`); exec(`git push --force`); //comment on the issue var result = execSync(`npx auto-changelog -o ./tempchangelog.txt --commit-limit false --template ./compact-keepachangelog.hbs --stdout`).toString(); await postComment(result); //create changelog image exec(`npm run release-image`); exec(`git commit -a -m 'updated release-image'`); exec(`git push --force`); })(); ```
smashah commented 1 year ago

Changelog

🚀 Release 4.55.2 (2023-01-21)

fire17 commented 1 year ago

@fire17 have you tried the python socket client?

https://github.com/open-wa/wa-automate-socket-client-python

Yes @smashah this is exactly what I am using I figured my issue should go there perhaps... Getting QR to client before connection #7 (hope you watch the issues there as you do here lol 😋 )