curl --request POST \
--url http://localhost:3000/api/openapi/v1/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"device_id": "880e8400-e29b-41d4-a716-446655440003",
"message": "Olá! Como posso ajudá-lo hoje?",
"destination_number": "5511999999999",
"send_as_audio": false,
"ai_generates_message": false,
"image_url": "https://example.com/image.jpg",
"image_mime_type": "image/jpeg"
}
'import requests
url = "http://localhost:3000/api/openapi/v1/send"
payload = {
"device_id": "880e8400-e29b-41d4-a716-446655440003",
"message": "Olá! Como posso ajudá-lo hoje?",
"destination_number": "5511999999999",
"send_as_audio": False,
"ai_generates_message": False,
"image_url": "https://example.com/image.jpg",
"image_mime_type": "image/jpeg"
}
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({
device_id: '880e8400-e29b-41d4-a716-446655440003',
message: 'Olá! Como posso ajudá-lo hoje?',
destination_number: '5511999999999',
send_as_audio: false,
ai_generates_message: false,
image_url: 'https://example.com/image.jpg',
image_mime_type: 'image/jpeg'
})
};
fetch('http://localhost:3000/api/openapi/v1/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/api/openapi/v1/send",
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([
'device_id' => '880e8400-e29b-41d4-a716-446655440003',
'message' => 'Olá! Como posso ajudá-lo hoje?',
'destination_number' => '5511999999999',
'send_as_audio' => false,
'ai_generates_message' => false,
'image_url' => 'https://example.com/image.jpg',
'image_mime_type' => 'image/jpeg'
]),
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 := "http://localhost:3000/api/openapi/v1/send"
payload := strings.NewReader("{\n \"device_id\": \"880e8400-e29b-41d4-a716-446655440003\",\n \"message\": \"Olá! Como posso ajudá-lo hoje?\",\n \"destination_number\": \"5511999999999\",\n \"send_as_audio\": false,\n \"ai_generates_message\": false,\n \"image_url\": \"https://example.com/image.jpg\",\n \"image_mime_type\": \"image/jpeg\"\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("http://localhost:3000/api/openapi/v1/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"device_id\": \"880e8400-e29b-41d4-a716-446655440003\",\n \"message\": \"Olá! Como posso ajudá-lo hoje?\",\n \"destination_number\": \"5511999999999\",\n \"send_as_audio\": false,\n \"ai_generates_message\": false,\n \"image_url\": \"https://example.com/image.jpg\",\n \"image_mime_type\": \"image/jpeg\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/api/openapi/v1/send")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"device_id\": \"880e8400-e29b-41d4-a716-446655440003\",\n \"message\": \"Olá! Como posso ajudá-lo hoje?\",\n \"destination_number\": \"5511999999999\",\n \"send_as_audio\": false,\n \"ai_generates_message\": false,\n \"image_url\": \"https://example.com/image.jpg\",\n \"image_mime_type\": \"image/jpeg\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"device_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Dispositivo de Suporte 01",
"destinationNumber": "5511999999999",
"sendAsAudio": false,
"aiGeneratesMessage": false,
"imageUrl": "<string>",
"imageMimeType": "<string>",
"usage": {
"activeMessagesUsed": 51,
"activeMessagesQuota": 500,
"activeMessagesRemaining": 474
}
}
}{
"success": false,
"error": "Corpo da requisição inválido",
"code": "BAD_REQUEST"
}{
"success": false,
"error": {
"message": "Active messaging not available in your plan",
"code": "FEATURE_NOT_AVAILABLE"
}
}{
"success": false,
"error": "Recurso não encontrado",
"code": "NOT_FOUND"
}{
"success": false,
"error": {
"message": "Monthly active message quota exceeded",
"code": "RATE_LIMIT_EXCEEDED",
"details": {
"quota": 500,
"used": 525,
"limit": 525
}
}
}{
"success": false,
"error": "Erro interno do servidor",
"code": "INTERNAL_ERROR"
}Enviar Mensagem Ativa
Envia uma mensagem para um número de WhatsApp através de um dispositivo conectado. O dispositivo deve estar iniciado e conectado para enviar mensagens.
Requer: Funcionalidade de envio ativo habilitada no plano (allowActiveMessaging).
Cota: Cada envio consome 1 unidade da cota mensal de mensagens ativas. Um limite flexível de 5% acima da cota é permitido antes do bloqueio.
Headers de resposta incluem informações de rate limit: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used.
curl --request POST \
--url http://localhost:3000/api/openapi/v1/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"device_id": "880e8400-e29b-41d4-a716-446655440003",
"message": "Olá! Como posso ajudá-lo hoje?",
"destination_number": "5511999999999",
"send_as_audio": false,
"ai_generates_message": false,
"image_url": "https://example.com/image.jpg",
"image_mime_type": "image/jpeg"
}
'import requests
url = "http://localhost:3000/api/openapi/v1/send"
payload = {
"device_id": "880e8400-e29b-41d4-a716-446655440003",
"message": "Olá! Como posso ajudá-lo hoje?",
"destination_number": "5511999999999",
"send_as_audio": False,
"ai_generates_message": False,
"image_url": "https://example.com/image.jpg",
"image_mime_type": "image/jpeg"
}
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({
device_id: '880e8400-e29b-41d4-a716-446655440003',
message: 'Olá! Como posso ajudá-lo hoje?',
destination_number: '5511999999999',
send_as_audio: false,
ai_generates_message: false,
image_url: 'https://example.com/image.jpg',
image_mime_type: 'image/jpeg'
})
};
fetch('http://localhost:3000/api/openapi/v1/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/api/openapi/v1/send",
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([
'device_id' => '880e8400-e29b-41d4-a716-446655440003',
'message' => 'Olá! Como posso ajudá-lo hoje?',
'destination_number' => '5511999999999',
'send_as_audio' => false,
'ai_generates_message' => false,
'image_url' => 'https://example.com/image.jpg',
'image_mime_type' => 'image/jpeg'
]),
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 := "http://localhost:3000/api/openapi/v1/send"
payload := strings.NewReader("{\n \"device_id\": \"880e8400-e29b-41d4-a716-446655440003\",\n \"message\": \"Olá! Como posso ajudá-lo hoje?\",\n \"destination_number\": \"5511999999999\",\n \"send_as_audio\": false,\n \"ai_generates_message\": false,\n \"image_url\": \"https://example.com/image.jpg\",\n \"image_mime_type\": \"image/jpeg\"\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("http://localhost:3000/api/openapi/v1/send")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"device_id\": \"880e8400-e29b-41d4-a716-446655440003\",\n \"message\": \"Olá! Como posso ajudá-lo hoje?\",\n \"destination_number\": \"5511999999999\",\n \"send_as_audio\": false,\n \"ai_generates_message\": false,\n \"image_url\": \"https://example.com/image.jpg\",\n \"image_mime_type\": \"image/jpeg\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/api/openapi/v1/send")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"device_id\": \"880e8400-e29b-41d4-a716-446655440003\",\n \"message\": \"Olá! Como posso ajudá-lo hoje?\",\n \"destination_number\": \"5511999999999\",\n \"send_as_audio\": false,\n \"ai_generates_message\": false,\n \"image_url\": \"https://example.com/image.jpg\",\n \"image_mime_type\": \"image/jpeg\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"device_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "Dispositivo de Suporte 01",
"destinationNumber": "5511999999999",
"sendAsAudio": false,
"aiGeneratesMessage": false,
"imageUrl": "<string>",
"imageMimeType": "<string>",
"usage": {
"activeMessagesUsed": 51,
"activeMessagesQuota": 500,
"activeMessagesRemaining": 474
}
}
}{
"success": false,
"error": "Corpo da requisição inválido",
"code": "BAD_REQUEST"
}{
"success": false,
"error": {
"message": "Active messaging not available in your plan",
"code": "FEATURE_NOT_AVAILABLE"
}
}{
"success": false,
"error": "Recurso não encontrado",
"code": "NOT_FOUND"
}{
"success": false,
"error": {
"message": "Monthly active message quota exceeded",
"code": "RATE_LIMIT_EXCEEDED",
"details": {
"quota": 500,
"used": 525,
"limit": 525
}
}
}{
"success": false,
"error": "Erro interno do servidor",
"code": "INTERNAL_ERROR"
}Authorizations
Token JWT obtido do endpoint /api/openapi/auth/token
Body
ID do dispositivo que enviará a mensagem
"880e8400-e29b-41d4-a716-446655440003"
Mensagem de texto a ser enviada
"Olá! Como posso ajudá-lo hoje?"
Número de telefone de destino (formato internacional)
"5511999999999"
Se true, converte a mensagem de texto em áudio antes de enviar
false
Se true, permite que a IA gere uma resposta personalizada
false
URL de uma imagem para enviar junto com a mensagem
"https://example.com/image.jpg"
Tipo MIME da imagem (ex. image/jpeg, image/png)
"image/jpeg"
Was this page helpful?