CallsScanqrcode#
Beta version
The functionality is in beta mode. Features are subject to change and may also work unstably. There may be additional charges for functionality in the future.
You can request access to the functionality via GREEN-API support
Along with getting a QR code with the QR method, you can get a QR code via a websocket connection. The timeout for scanning the QR code is 100 seconds. The QR code must be scanned within this time. To get a QR code, the instance must be in the unauthorized state. If the instance is authorized, first log out the instance with the callsLogout method.
After the QR code has been scanned successfully and the instance has been authorized, an incoming notification of the Instance status type is generated.
To get a QR code, you have to establish a websocket connection at:
Connection#
{{apiUrl}}/waInstance{{idInstance}}/callsScanqrcode/{{apiTokenInstance}}
For apiUrl, idInstance and apiTokenInstance websocket connection parameters, refer to Before you start section.
Note
This method gets a QR code identical to the one you can get with the QR method.
This method allows only 1 session, while the QR method can be called from multiple devices.
The errors for this method and the QR method are identical.
Response#
Response parameters#
| Parameter | Type | Description |
|---|---|---|
type | string | Message type, possible values qrCode, timeout, error, passkeyRequired, alreadyLogged |
message | string | Message content. Takes different values depending on the value of the type field |
QR code image received#
| Parameter | Type | Description |
|---|---|---|
type | string | qrCode - QR code image received |
message | string | QR code image in base64 encoding. To display it in a browser, add the string data:image/png;base64, {message} |
An error occurred#
| Parameter | Type | Description |
|---|---|---|
type | string | error - an error occurred |
message | string | Error description |
connect closed - there is no connection to the server | ||
not ready - the instance is not ready to send a QR code | ||
Instance starting - the instance is starting | ||
socket not open - open the socket to get a QR code | ||
is in the logout process - the instance cache is being cleared, wait until the cache clearing is complete |
Instance already authorized#
| Parameter | Type | Description |
|---|---|---|
type | string | alreadyLogged - the instance is already authorized. To get a QR code, first log out the instance with the callsLogout method |
message | string | Takes the value Instance already logged |
QR code scanning timeout expired#
| Parameter | Type | Description |
|---|---|---|
type | string | timeout - the time allowed for scanning the QR code has expired. The timeout for scanning the QR code is 100 seconds |
message | string | Takes the value timeout reading qr code |