Skip to content

GetSettings#

Test Postman Apidog

The method is aimed for getting the current instance settings.

Request#

To get the current instance settings you have to execute a request at:

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

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

Response#

Response parameters#

Parameter Type Description
wid string Account ID in WhatsApp
countryInstance string Deprecated
typeAccount string Deprecated
webhookUrl string URL to receive incoming notifications. When receiving notifications with HTTP API technology, the field must be empty. Description of how the field works.
webhookUrlToken string Token for connecting to your webhook server. Description of how the field works.
delaySendMessagesMilliseconds integer Message sending delay is in milliseconds
markIncomingMessagesReaded string Mark incoming messages as read or not, possible variants: yes, no. Ignored if markIncomingMessagesReadedOnReply is 'yes'.
markIncomingMessagesReadedOnReply string Mark incoming messages as read when sending a message to the chat via API, possible variants: yes, no. If 'yes', then markIncomingMessagesReaded setting is ignored.
sharedSession string Deprecated
outgoingWebhook string Get notifications about outgoing messages sending / delivering / reading status, possible variants: yes, no
outgoingMessageWebhook string Get notifications about messages sent from phone, possible variants: yes, no
outgoingAPIMessageWebhook string Get notifications about messages sent from API, possible variants: yes,no. When sending a message to a non-existing WhatsApp account, the notification will not come.
incomingWebhook string Get notifications about incoming messages and files, possible variants: yes, no
deviceWebhook string Temporarily out of service. Get notifications about the device (phone) and battery level, possible variants: yes, no
statusInstanceWebhook string Deprecated
stateWebhook string Get notifications about changes in the instance authorization status, possible variants: yes, no
enableMessagesHistory string Deprecated
keepOnlineStatus string Sets the 'Online' status for your account
pollMessageWebhook string Get notifications about the creation of a poll and voting in the poll, possible variants: yes, no
incomingBlockWebhook string Temporarily out of service. Get notifications about adding a chat to the list of blocked contacts, possible variants: yes, no
incomingCallWebhook string Get notifications about incoming call statuses, possible variants: yes, no

Applying settings

To receive notifications regarding the statuses of sending/delivery/read receipts of messages sent from a mobile phone, it is necessary to enable the following settings:

  • outgoingMessageWebhook
  • outgoingWebhook

To receive notifications about the statuses of an incoming call, it is necessary to enable the following settings:

  • incomingCallWebhook
  • incomingWebhook

To receive notifications about polls and poll updates, it is necessary to enable the following settings:

  • For messages sent via the API: outgoingAPIMessageWebhook and pollMessageWebhook
  • For messages sent from the phone: outgoingMessageWebhook and pollMessageWebhook
  • For notifications about incoming polls and poll responses: incomingWebhook and pollMessageWebhook

If your phone and linked devices are turned off, you need to enable the setting:

  • keepOnlineStatus to set the Online status for your account and send the message status delivered

Response body example#

{
    "wid": "11001234567@c.us",
    "countryInstance": "",
    "typeAccount": "",
    "webhookUrl": "https://mysite.com/webhook/green-api/",
    "webhookUrlToken": "",
    "delaySendMessagesMilliseconds": 5000,
    "markIncomingMessagesReaded": "no",
    "markIncomingMessagesReadedOnReply": "no",
    "sharedSession": "no",
    "outgoingWebhook": "yes",
    "outgoingMessageWebhook": "yes",
    "outgoingAPIMessageWebhook": "yes",
    "incomingWebhook": "yes",
    "deviceWebhook": "no", //The notification is temporarily out of work
    "statusInstanceWebhook": "no",
    "stateWebhook": "no",
    "enableMessagesHistory": "no",
    "keepOnlineStatus": "no",
    "pollMessageWebhook": "no",
    "incomingBlockWebhook": "yes", //The notification is temporarily out of work
    "incomingCallWebhook": "yes"
}

Errors GetSettings#

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

Request examples#

import requests

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

payload = {}
headers= {}

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

print(response.text.encode('utf8'))
<?php
//The apiUrl, idInstance and apiTokenInstance values are available in console, double brackets must be removed
$url = "{{apiUrl}}/waInstance{{idInstance}}/getSettings/{{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}}/getSettings/{{apiTokenInstance}}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/getSettings/")
    .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("/getSettings/")
    .append({{apiTokenInstance}});

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

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

    ' The apiUrl, idInstance and apiTokenInstance values are available in console, double brackets must be removed
    url = "{{apiUrl}}/waInstance{{idInstance}}/getSettings/{{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 GetSettings;

{$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 := 'https://api.greenapi.com/waInstance' + ID_INSTANCE + '/getSettings/' + 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.