GetSettings#
The method is intended for getting the current instance settings.
The method uses limits on the request rate per second.
Request#
To get the current instance settings, you need to execute a request at:
GET
{{apiUrl}}/waInstance{{idInstance}}/getSettings/{{apiTokenInstance}}
To get the apiUrl, idInstance and apiTokenInstance request parameters, refer to the Before you start section.
Response#
Response fields#
| Field | Type | Description |
|---|---|---|
wid | string | Account identifier |
typeInstance | string | Interface version. The field takes the value telegram for the Telegram messenger |
webhookUrl | string | Address for sending notifications (URL). When receiving notifications with the HTTP API technology, the field must be empty. |
webhookUrlToken | string | Authorization header for sending notifications. |
delaySendMessagesMilliseconds | integer | Message sending interval in milliseconds |
markIncomingMessagesReaded | string | Mark incoming messages as read, possible values: yes, no. Ignored if markIncomingMessagesReadedOnReply is set to 'yes'. |
markIncomingMessagesReadedOnReply | string | Mark incoming messages as read when a message is sent through the API, possible values: yes, no. If set to 'yes', the markIncomingMessagesReaded setting is ignored. |
outgoingWebhook | string | Receive notifications about the statuses of sent messages, possible values: yes, no. |
outgoingMessageWebhook | string | Receive notifications about messages sent from the phone, the web version and the desktop version, possible values: yes, no |
outgoingAPIMessageWebhook | string | Receive notifications about messages sent through the API, possible values: yes, no. |
incomingWebhook | string | Receive notifications about incoming messages and files, possible values: yes, no |
stateWebhook | string | Receive notifications about changes in the instance authorization state, possible values: yes, no |
keepOnlineStatus | string | Keep the instance status "Online" permanently, possible values: yes, no |
editedMessageWebhook | string | Receive notifications when messages are edited by the correspondent, possible values: yes, no |
deletedMessageWebhook | string | Receive notifications when messages are deleted by the correspondent, possible values: yes, no |
Response body example#
{
"wid": "79876543210@c.us",
"typeInstance": "telegram",
"webhookUrl": "",
"webhookUrlToken": "",
"delaySendMessagesMilliseconds": 500,
"markIncomingMessagesReaded": "no",
"markIncomingMessagesReadedOnReply": "no",
"outgoingWebhook": "yes",
"outgoingMessageWebhook": "yes",
"outgoingAPIMessageWebhook": "yes",
"incomingWebhook": "yes",
"stateWebhook": "yes",
"keepOnlineStatus": "no",
"editedMessageWebhook": "yes",
"deletedMessageWebhook": "yes"
}
Errors#
For the list of errors common to all methods, see the Common errors section
Code 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.green-api.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.