Mensajes de audio
curl --request POST \
--url https://whatsapp.heybot.cloud/api/v2/message \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": 123,
"type": "<string>",
"audio": {
"id": 123,
"link": "<string>",
"voice": true
}
}
'import requests
url = "https://whatsapp.heybot.cloud/api/v2/message"
payload = {
"to": 123,
"type": "<string>",
"audio": {
"id": 123,
"link": "<string>",
"voice": True
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({to: 123, type: '<string>', audio: {id: 123, link: '<string>', voice: true}})
};
fetch('https://whatsapp.heybot.cloud/api/v2/message', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://whatsapp.heybot.cloud/api/v2/message",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'to' => 123,
'type' => '<string>',
'audio' => [
'id' => 123,
'link' => '<string>',
'voice' => true
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://whatsapp.heybot.cloud/api/v2/message"
payload := strings.NewReader("{\n \"to\": 123,\n \"type\": \"<string>\",\n \"audio\": {\n \"id\": 123,\n \"link\": \"<string>\",\n \"voice\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://whatsapp.heybot.cloud/api/v2/message")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"to\": 123,\n \"type\": \"<string>\",\n \"audio\": {\n \"id\": 123,\n \"link\": \"<string>\",\n \"voice\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://whatsapp.heybot.cloud/api/v2/message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"to\": 123,\n \"type\": \"<string>\",\n \"audio\": {\n \"id\": 123,\n \"link\": \"<string>\",\n \"voice\": true\n }\n}"
response = http.request(request)
puts response.read_bodyEnvío de mensajes
Mensajes de audio
POST
/
api
/
v2
/
message
Mensajes de audio
curl --request POST \
--url https://whatsapp.heybot.cloud/api/v2/message \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"to": 123,
"type": "<string>",
"audio": {
"id": 123,
"link": "<string>",
"voice": true
}
}
'import requests
url = "https://whatsapp.heybot.cloud/api/v2/message"
payload = {
"to": 123,
"type": "<string>",
"audio": {
"id": 123,
"link": "<string>",
"voice": True
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({to: 123, type: '<string>', audio: {id: 123, link: '<string>', voice: true}})
};
fetch('https://whatsapp.heybot.cloud/api/v2/message', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://whatsapp.heybot.cloud/api/v2/message",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'to' => 123,
'type' => '<string>',
'audio' => [
'id' => 123,
'link' => '<string>',
'voice' => true
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://whatsapp.heybot.cloud/api/v2/message"
payload := strings.NewReader("{\n \"to\": 123,\n \"type\": \"<string>\",\n \"audio\": {\n \"id\": 123,\n \"link\": \"<string>\",\n \"voice\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://whatsapp.heybot.cloud/api/v2/message")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"to\": 123,\n \"type\": \"<string>\",\n \"audio\": {\n \"id\": 123,\n \"link\": \"<string>\",\n \"voice\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://whatsapp.heybot.cloud/api/v2/message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"to\": 123,\n \"type\": \"<string>\",\n \"audio\": {\n \"id\": 123,\n \"link\": \"<string>\",\n \"voice\": true\n }\n}"
response = http.request(request)
puts response.read_bodyFormatos de audio compatibles
| Tipo de audio | Extensión | Tipo MIME | Tamaño máximo |
|---|---|---|---|
| AAC | .aac | audio/aac | 16 MB |
| AMR | .amr | audio/amr | 16 MB |
| MP3 | .mp3 | audio/mpeg | 16 MB |
| Audio en formato MP4 | .m4a | audio/mp4 | 16 MB |
| Audio en formato OGG | .ogg | audio/ogg (únicamente códec OPUS; no se admite audio/ogg base; solo entrada mono) | 16 MB |
Los errores más comunes asociados con los archivos de audio son por tipos MIME que no coinciden (el tipo MIME no coincide con el tipo de archivo indicado por el nombre del archivo) y la codificación no válida de los archivos OGG (solo se admite el códec OPUS). Si se produce un error al enviar un archivo multimedia, verifica que el tipo MIME del archivo de audio coincida con la extensión y que sea un tipo admitido. En el caso de los archivos OGG, usa el códec OPUS para la codificación.
integer
default:5219876543210
required
Número de WhatsApp del destinatario en formato internacional, sin símbolos ni espacios.
string
required
Tipo de mensaje a enviar. Para este endpoint debe ser
audio.object
default:"audio"
required
Objeto con el contenido del mensaje.
Show propiedades
Show propiedades
integer
- Identificador del activo multimedia subido.
- Obligatorio si se usa contenido multimedia subido. De lo contrario, se debe omitir.
string
- URL del recurso multimedia alojado en tu servidor público.
- Obligatorio si se usa contenido multimedia alojado. De lo contrario, se puede omitir.
boolean
- Configurado como true para enviar un mensaje de voz.
- Los mensajes de voz deben ser archivos .ogg cifrados con el códec OPUS.
Ejemplo
{
"to": 5219876543210,
"type": "image",
"image": {
"link": "https://example.com/image.jpg",
"caption": "Mira esta increible foto!"
}
}