Skip to content

GetSettings#

Test Postman Apidog

The method is used to 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 Webhook authorization header. Description of how the field works.
delaySendMessagesMilliseconds integer Message sending delay is in milliseconds
markIncomingMessagesReaded string Mark incoming messages as read, Possible values: yes, no. Ignored if markIncomingMessagesReadedOnReply is 'yes'.
markIncomingMessagesReadedOnReply string Mark incoming messages read on reply from API, Possible values: yes, no. If 'yes', then markIncomingMessagesReaded setting is ignored.
sharedSession string Deprecated
outgoingWebhook string Receive notifications about outgoing messages statuses, Possible values: yes, no
outgoingMessageWebhook string Receive notifications about messages sent from phone, Possible values: yes, no
outgoingAPIMessageWebhook string Receive notifications about messages sent from API, Possible values: yes,no. When sending a message to a non-existing WhatsApp account, the notification will not come.
incomingWebhook string Receive notifications about incoming messages and files, Possible values: yes, no
deviceWebhook string Temporarily out of service. Receive notifications about the device (phone) and battery level, Possible values: yes, no
statusInstanceWebhook string Deprecated
stateWebhook string Receive notifications about change of the instance authorization state, Possible values: yes, no
enableMessagesHistory string Deprecated
keepOnlineStatus string Keep 'online' status
pollMessageWebhook string Receive notifications about polls, Possible values: yes, no
incomingBlockWebhook string Temporarily out of service. Receive notifications about incoming chat blocks, Possible values: yes, no
incomingCallWebhook string Receive notifications about incoming calls, Possible values: yes, no
editedMessageWebhook string Receive notifications about edited messages: yes, no
deletedMessageWebhook string Receive notifications about deleted messages: 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

To receive notifications about message deletion or editing you need to enable the settings:

  • editedMessageWebhook
  • deletedMessageWebhook

Response body example#

{
    "wid": "79876543210@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",
    "editedMessageWebhook": "no",
    "deletedMessageWebhook": "no"
}

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.