Skip to content

SendVoiceStatus#

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 voice status. The status will be added to the send queue. The status will be kept for 24 hours in the queue until account will be authorized.
The rate at which statuses 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 voice status, you have to execute a request at:

POST {{APIUrl}}/waInstance{{idInstance}}/sendVoiceStatus/{{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. Supported formats: .mp3, .wav
backgroundColor string No Message background. Default: #FFFFFF. Example site for getting the background color value
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.mp3",
    "fileName": "horse.mp3",
    "backgroundColor": "#228B22",
    "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"
}

SendVoiceStatus errors#

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

Request examples#

import requests

url = "{{APIUrl}}/waInstance{{idInstance}}/sendVoiceStatus/{{apiTokenInstance}}"

payload = json.dumps({
"urlFile": "https://sw-media.storage. greenapi.net/1101000000/537157f6-4e24-4c4e-b5c6-9406c702f196.mp3",
"fileName": "music.mp3",
"backgroundColor": "#228B22",
"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}}/sendVoiceStatus/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "urlFile": "https://sw-media.storage. greenapi.net/1101000000/537157f6-4e24-4c4e-b5c6-9406c702f196.mp3",
    "fileName": "music.mp3",
    "backgroundColor": "#228B22",
    "participants": [
        "70000001234@c.us", 
        "440000001234@c.us"
    ]
}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
    .append({{APIUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/sendVoiceStatus/")
    .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.mp3\",\r\n\t    \"fileName\": \"music.mp3\",\r\n\t    \"backgroundColor\": \"#228B22\",\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("/sendVoiceStatus/")
    .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.mp3\",\r\n\t    \"fileName\": \"music.mp3\",\r\n\t    \"backgroundColor\": \"#228B22\",\r\n\t    \"participants\": [\"70000001234@c.us\", \"440000001234@c.us\"]\r\n}")
    .asString();

System.out.println(response);