devlikeapro / waha

WAHA - WhatsApp HTTP API (REST API) that you can configure in a click!
https://waha.devlike.pro/
Apache License 2.0
813 stars 248 forks source link

Stop session when QR is not valid (after some 3-4 QRs) #314

Closed borsatti2 closed 2 months ago

borsatti2 commented 2 months ago

When starting a session, send 3 or 4 qr codes, if you do not authenticate, close the session. It would also work if you set a time to be authenticated, if you haven't authenticated within 2 minutes, close the session

patron:PRO

allburov commented 2 months ago

I left a new session for about 10 minutes with WEBJS - even after that when I get the latest QR (either /screenshot or /qr) - it worked perferctly, no issue. Are we talking about

Consider listening to session.status webhook events - it sends "status": "SCAN_QR_CODE" on each new QR code, so you can fetch a new one.

https://waha.devlike.pro/docs/how-to/webhooks/#sessionstatus

{
    "event": "session.status",
    "session": "test",
    "me": null,
    "payload": {
        "name": "test",
        "status": "SCAN_QR_CODE"
    },
    "engine": "WEBJS",
    "environment": {
        "version": "2024.5.2",
        "engine": "WEBJS",
        "tier": "PLUS",
        "browser": "/usr/bin/google-chrome-stable"
    }
}

If you wish - we can add "qr" base64 decoded payload inside it (I'd suggest using the endpoint after you get the event tho)

patron:PRO

allburov commented 2 months ago

NOWEB also works normal after 5 minutes

patron:PRO