Mensajes con documento
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>",
"document": {
"id": 123,
"link": "<string>",
"caption": "<string>",
"filename": "<string>"
}
}
'import requests
url = "https://whatsapp.heybot.cloud/api/v2/message"
payload = {
"to": 123,
"type": "<string>",
"document": {
"id": 123,
"link": "<string>",
"caption": "<string>",
"filename": "<string>"
}
}
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>',
document: {id: 123, link: '<string>', caption: '<string>', filename: '<string>'}
})
};
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>',
'document' => [
'id' => 123,
'link' => '<string>',
'caption' => '<string>',
'filename' => '<string>'
]
]),
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 \"document\": {\n \"id\": 123,\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\"\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 \"document\": {\n \"id\": 123,\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\"\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 \"document\": {\n \"id\": 123,\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_bodyEnvío de mensajes
Mensajes con documento
POST
/
api
/
v2
/
message
Mensajes con documento
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>",
"document": {
"id": 123,
"link": "<string>",
"caption": "<string>",
"filename": "<string>"
}
}
'import requests
url = "https://whatsapp.heybot.cloud/api/v2/message"
payload = {
"to": 123,
"type": "<string>",
"document": {
"id": 123,
"link": "<string>",
"caption": "<string>",
"filename": "<string>"
}
}
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>',
document: {id: 123, link: '<string>', caption: '<string>', filename: '<string>'}
})
};
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>',
'document' => [
'id' => 123,
'link' => '<string>',
'caption' => '<string>',
'filename' => '<string>'
]
]),
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 \"document\": {\n \"id\": 123,\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\"\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 \"document\": {\n \"id\": 123,\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\"\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 \"document\": {\n \"id\": 123,\n \"link\": \"<string>\",\n \"caption\": \"<string>\",\n \"filename\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_bodyTipos de documentos admitidos
| Tipo de documento | Extensión | Tipo MIME | Tamaño máximo |
|---|---|---|---|
| Texto | .txt | text/plain | 100 MB |
| Microsoft Excel | .xls | application/vnd.ms-excel | 100 MB |
| Microsoft Excel | .xlsx | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | 100 MB |
| Microsoft Word | .doc | application/msword | 100 MB |
| Microsoft Word | .docx | application/vnd.openxmlformats-officedocument.wordprocessingml.document | 100 MB |
| Microsoft PowerPoint | .ppt | application/vnd.ms-powerpoint | 100 MB |
| Microsoft PowerPoint | .pptx | application/vnd.openxmlformats-officedocument.presentationml.presentation | 100 MB |
| application/pdf | 100 MB |
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
document.object
default:"document"
required
Objeto con el contenido del mensaje.
Show propiedades
Show propiedades
integer
- Obligatorio si se usa contenido multimedia subido. De lo contrario, se debe omitir.
string
- Obligatorio si se usa contenido multimedia alojado. De lo contrario, se puede omitir.
- URL del recurso multimedia alojado en tu servidor público.
string
- Opcional - Texto del pie del activo multimedia.
- No debe superar los 1.024 caracteres.
string
- Opcional - Nombre de archivo del documento, con extensión. El cliente de WhatsApp usará un ícono de tipo de archivo adecuado según la extensión.
Ejemplo
{
"to": 5219876543210,
"type": "document",
"document": {
"link": "https://www.luckyshrub.com/invoices/FmOzfD9cKf/lucky-shrub-invoice.pdf",
"caption": "Lucky Shrub Invoice",
"filename": "lucky-shrub-invoice.pdf"
}
}