Skip to content

GetWaSettings#

The method is aimed to get information about the WhatsApp account

Request#

To get information about the WhatsApp account you have to execute a request at:

GET {{apiUrl}}/waInstance{{idInstance}}/getWaSettings/{{apiTokenInstance}}

For idInstance, apiTokenInstance and apiUrl request parameters, please refer to Before you start section.

Response#

Response parameters#

Parameter Type Description
avatar string The value is always an empty string.
phone string Whatsapp account number
stateInstance string Account state. Have variants:
authorized - Account is authorized
starting - The account is in the process of starting up (service mode). An instance, server, or instance in maintenance mode is rebooting. It may take up to 5 minutes for the account state to be set to authorized
notAuthorized - Account is not authorized.
deviceId string Deprecated

If the account has the status notAuthorized or starting, the fields avatar, phone, deviceId will be empty.

Response body example#

{
    "avatar": "",
    "phone": "79876543210",
    "stateInstance": "authorized",
    "deviceId": ""
}

Errors GetWaSettings#

For a list of errors common to all methods, refer to Common errors section

Request examples#

import requests

#The idInstance and apiTokenInstance values are available in your account, double brackets must be removed

url = "{{apiUrl}}/waInstance{{idInstance}}/getWaSettings/{{apiTokenInstance}}"

payload = {}
headers = {}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text.encode('utf8'))
<?php
//The idInstance and apiTokenInstance values are available in your account, double brackets must be removed
$url = "{{apiUrl}}/waInstance{{idInstance}}/getWaSettings/{{apiTokenInstance}}";

$options = array(
    'http' => array(
        'header' => "Content-Type: application/json\r\n",
        'method' => 'GET'
    )
);

$context = stream_context_create($options);

$response = file_get_contents($url, false, $context);

echo $response;
?>
curl --location '{{apiUrl}}/waInstance{{idInstance}}/getWaSettings/{{apiTokenInstance}}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/getWaSettings/")
    .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("/getWaSettings/")
    .append({{apiTokenInstance}});

var response = Unirest.get(requestUrl.toString())
    .header("Content-Type", "application/json")
    .asString();

System.out.println(response);
Sub GetWaSettings()
    Dim url As String
    Dim http As Object
    Dim response As String

    ' The idInstance and apiTokenInstance values are available in your account, double brackets must be removed
    url = "{{apiUrl}}/waInstance{{idInstance}}/getWaSettings/{{apiTokenInstance}}"

    Set http = CreateObject("WinHttp.WinHttpRequest.5.1")

    http.Open "GET", url, False
    http.Send

    response = http.responseText

    Debug.Print response

    ' Outputting the answer to the desired cell
    ' Range("A1").Value = response

    Set http = Nothing
End Sub
program GetWaSettings;

{$APPTYPE CONSOLE}

uses
System.SysUtils,
System.Classes, System.Net.HttpClient, System.Net.URLClient, System.Net.HttpClientComponent;

var
HttpClient: TNetHTTPClient;
RequestHeaders: TNetHeaders;
Response: IHTTPResponse;
EndpointURL, ID_INSTANCE, API_TOKEN_INSTANCE: string;

begin
ID_INSTANCE := '110100001';
API_TOKEN_INSTANCE := 'd75b3a66374942c5b3c019c698abc2067e151558acbd451234';

EndpointURL := `apiUrl` + '/waInstance' + ID_INSTANCE + '/getWaSettings/' + API_TOKEN_INSTANCE;

HttpClient := TNetHTTPClient.Create(nil);
RequestHeaders := [
    TNetHeader.Create('Content-Type', 'application/json')
];

try
    Response := HTTPClient.Get(EndpointURL, nil, RequestHeaders);

    if Response.StatusCode = 200 then
    Writeln('[Response]: ' + Response.ContentAsString)
    else
    Writeln('[ERROR ' + IntToStr(Response.StatusCode) + ']:' + Response.StatusText + '' + Response.ContentAsString);

    readln;
except
    on E: Exception do
    Writeln(E.ClassName, ': ', E.Message);
end;

HttpClient.Free;

end.