CallsQr#
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
The method is used to get the QR code required to authorize the calls session.
The QR code is updated every 20 seconds, so it is recommended to call the QR code method at an interval of 1 second.
Request#
To get the QR code, you have to execute a request at:
GET
{{apiUrl}}/waInstance{{idInstance}}/callsQr/{{apiTokenInstance}}
The request is executed without parameters.
For apiUrl, idInstance and apiTokenInstance request parameters, refer to Before you start section.
Response#
Response parameters#
| Parameter | Type | Description |
|---|---|---|
type | string | Message type, possible values qrCode, alreadyLogged, error |
message | string | Message content. The format depends on the value of the type field |
QR code image received#
| Parameter | Type | Description |
|---|---|---|
type | string | qrCode — QR code image received |
message | string | A 256×256 QR code image in PNG format, encoded in base64. This is a ready-made image, not a string with the QR code content. To display it in a browser, add the string data:image/png;base64, {message} |
Session already authorized#
| Parameter | Type | Description |
|---|---|---|
type | string | alreadyLogged — the calls session is already authorized. To get a new QR code, first log out the session with the callsLogout method |
message | string | Takes the value instance account already authorized |
An error occurred#
| Parameter | Type | Description |
|---|---|---|
type | string | error — an error occurred |
message | string | Error description |
Instance starting — the instance is starting | ||
unexpected agent state: unknown — the calls agent is in an unknown state |
Errors#
For a list of errors common to all methods, refer to Common errors section.
Request examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/callsQr/{{apiTokenInstance}}"
payload = {}
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/callsQr/{{apiTokenInstance}}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
.append({{apiUrl}})
.append("/waInstance").append({{idInstance}})
.append("/callsQr/")
.append({{apiTokenInstance}});
var response = restTemplate.exchange(requestUrl.toString(), HttpMethod.GET, null, String.class);
System.out.println(response);
var requestUrl = new StringBuilder();
requestUrl
.append({{apiUrl}})
.append("/waInstance").append({{idInstance}})
.append("/callsQr/")
.append({{apiTokenInstance}});
var response = Unirest.get(requestUrl.toString())
.header("Content-Type", "application/json")
.asString();
System.out.println(response);