(not used) GetAvatarAsync#
The method returns asynchronously the avatar of a correspondent or a group chat. Unlike GetAvatar method, the request result is returned as a webhook AvatarInfo
Request#
To get avatar, you have to execute a request at:
POST
{{apiUrl}}/waInstance{{idInstance}}/getAvatarAsync/{{apiTokenInstance}}
For apiUrl
, idInstance
or apiTokenInstance
request parameters, refer to Before you start section.
Request parameters#
Parameter | Type | Mandatory | Description |
---|---|---|---|
chatId | string | Yes | User or group chat Id |
Request body example#
To get your avatar - specify your number in chatId ("{your number}@c.us").
Get user avatar:
{
"chatId": "11001234567@c.us"
}
Get group chat avatar:
{
"chatId": "11001234567-1581234048@g.us"
}
Response#
Successful request returns an empty response with status 400
GetAvatarAsync errors#
For a list of errors common to all methods, refer to Common errors section
HTTP code | Error Id | Description |
---|---|---|
400 | bad request data | Invalid phone number format. Telephone number must be 11 or 12 digits. Or chat Id |
Request examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/getAvatarAsync/{{apiToFor a list of errors common to all methods, refer to kenInstance}}"
payload = "{\r\n \"chatId\": \"11001234567@c.us\"\r\n}"
headers = {
'Content-Type': 'application/json'
}
requests.request("POST", url, headers=headers, data = payload)
curl --location '{{apiUrl}}/waInstance{{idInstance}}/getAvatarAsync/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"chatId": "11001234567@c.us"
}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
.append({{apiUrl}})
.append("/waInstance").append({{idInstance}})
.append("/getAvatarAsync/")
.append({{apiTokenInstance}});
var headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
var jsonBody = "{\"chatId\": \"11001234567@c.us\"}";
var requestEntity = new HttpEntity<>(jsonBody, headers);
var response = restTemplate.exchange(requestUrl.toString(), HttpMethod.POST, requestEntity, String.class);
System.out.println(response);
var requestUrl = new StringBuilder();
requestUrl
.append({{apiUrl}})
.append("/waInstance").append({{idInstance}})
.append("/getAvatarAsync/")
.append({{apiTokenInstance}});
var response = Unirest.post(requestUrl.toString())
.header("Content-Type", "application/json")
.body("{\"chatId\": \"11001234567@c.us\"}")
.asString();
System.out.println(response);