SendMediaStatus#
Beta version
The functionality is in beta mode. Features are subject to change and may also work unstably. There may be additional charges for functionality in the future.
The method is aimed for sending a pictures or video status. The status will be added to the send queue. Statuses will be kept for 24 hours in the queue until account will be authorized.
The rate at which status are sent from the queue is managed by Message sending delay parameter.
Important
In order for the recipient to see the sender’s statuses, both parties must save the numbers of the interlocutors to the contact list
Request#
To send a media in status, you have to execute a request at:
POST {{APIUrl}}/waInstance{{idInstance}}/sendMediaStatus/{{apiTokenInstance}}
For APIUrl
, idInstance
and apiTokenInstance
request parameters, refer to Before you start section.
Request parameters#
Parameter | Type | Mandatory | Description |
---|---|---|---|
urlFile | string | Yes | Link to outgoing file |
fileName | string | Yes | File name. Must contain the file extension. Requires UTF-8 encoding without BOM. For example: test.jpg |
caption | string | No | Media stiry caption. The maximum field length is 1024 characters |
participants | array<string> | No | An array of strings with contact IDs for whom the status will be available. If the field value is empty, "participants": [] , the status will be available to all contacts |
If non-existent numbers are added to the
participants
field, the status will not be sent to these numbers
Request body example#
Sending a status:
{
"urlFile": "https://my.site.com/img/horse.png",
"fileName": "horse.png",
"caption": "Little horse",
"participants": ["70000001234@c.us", "440000001234@c.us"] // status will be available only to the specified contacts
}
Response#
Response parameters#
Parameter | Type | Description |
---|---|---|
idMessage | string | Sent message Id |
Response body example#
{
"idMessage": "3EB0C767D097B7C7C030"
}
SendMediaStatus errors#
For a list of errors common to all methods, refer to Common errors section
Request examples#
import requests
url = "{{APIUrl}}/waInstance{{idInstance}}/sendMediaStatus/{{apiTokenInstance}}"
payload = json.dumps({
"urlFile": "https://sw-media.storage. greenapi.net/1101000000/537157f6-4e24-4c4e-b5c6-9406c702f196.png",
"fileName": "horse.png",
"caption": "Little horse",
"participants": [
"70000001234@c.us",
"440000001234@c.us"
]
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
curl --location '{{APIUrl}}/waInstance{{idInstance}}/sendMediaStatus/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"urlFile": "https://sw-media.storage. greenapi.net/1101000000/537157f6-4e24-4c4e-b5c6-9406c702f196.png",
"fileName": "horse.png",
"caption": "лошадка",
"participants": [
"70000001234@c.us",
"440000001234@c.us"
]
}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
.append({{APIUrl}})
.append("/waInstance").append({{idInstance}})
.append("/sendMediaStatus/")
.append({{apiTokenInstance}});
var headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
var jsonBody = "{\r\n \t\"urlFile\": \"https://sw-media.storage. greenapi.net/1101000000/537157f6-4e24-4c4e-b5c6-9406c702f196.png\",\r\n\t\"fileName\": \"horse.png\",\r\n\t\"caption\": \"little horse\",\r\n\t\"participants\": [\"70000001234@c.us\", \"440000001234@c.us\"]\r\n}";
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("/sendMediaStatus/")
.append({{apiTokenInstance}});
var response = Unirest.post(requestUrl.toString())
.header("Content-Type", "application/json")
.body("{\r\n \t\"urlFile\": \"https://sw-media.storage. greenapi.net/1101000000/537157f6-4e24-4c4e-b5c6-9406c702f196.png\",\r\n\t\"fileName\": \"horse.png\",\r\n\t\"caption\": \"little horse\",\r\n\t\"participants\": [\"70000001234@c.us\", \"440000001234@c.us\"]\r\n}")
.asString();
System.out.println(response);