Enviar mensaje de texto
curl --request POST \
--url https://api.whatsapp.json.pe/send/text \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"number": "51999999997",
"text": "prueba"
}
'import requests
url = "https://api.whatsapp.json.pe/send/text"
payload = {
"number": "51999999997",
"text": "prueba"
}
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({number: '51999999997', text: 'prueba'})
};
fetch('https://api.whatsapp.json.pe/send/text', 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://api.whatsapp.json.pe/send/text",
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([
'number' => '51999999997',
'text' => 'prueba'
]),
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://api.whatsapp.json.pe/send/text"
payload := strings.NewReader("{\n \"number\": \"51999999997\",\n \"text\": \"prueba\"\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://api.whatsapp.json.pe/send/text")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"number\": \"51999999997\",\n \"text\": \"prueba\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.whatsapp.json.pe/send/text")
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 \"number\": \"51999999997\",\n \"text\": \"prueba\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "exito",
"data": {}
}{
"success": false,
"message": "Bad Request"
}{
"success": false,
"message": "Bad Request"
}Message
Enviar texto
POST /send/text API WhatsApp json.pe: envía mensaje de texto a número E.164 o JID de grupo; JSON con number y text; Bearer token.
POST
https://api.whatsapp.json.pe
/
send
/
text
Enviar mensaje de texto
curl --request POST \
--url https://api.whatsapp.json.pe/send/text \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"number": "51999999997",
"text": "prueba"
}
'import requests
url = "https://api.whatsapp.json.pe/send/text"
payload = {
"number": "51999999997",
"text": "prueba"
}
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({number: '51999999997', text: 'prueba'})
};
fetch('https://api.whatsapp.json.pe/send/text', 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://api.whatsapp.json.pe/send/text",
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([
'number' => '51999999997',
'text' => 'prueba'
]),
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://api.whatsapp.json.pe/send/text"
payload := strings.NewReader("{\n \"number\": \"51999999997\",\n \"text\": \"prueba\"\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://api.whatsapp.json.pe/send/text")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"number\": \"51999999997\",\n \"text\": \"prueba\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.whatsapp.json.pe/send/text")
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 \"number\": \"51999999997\",\n \"text\": \"prueba\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "exito",
"data": {}
}{
"success": false,
"message": "Bad Request"
}{
"success": false,
"message": "Bad Request"
}Authorizations
Token Bearer del panel json.pe (no compartas tokens en repositorios públicos).
Body
application/json
Destino del mensaje. Persona (chat individual): número con código de país, sin el símbolo + (ej. Perú: 51999999997). Grupo: el JID del grupo, p. ej. 120363423133649225@g.us (como en el campo JID al listar grupos).
Example:
"51999999997"
Contenido del mensaje de texto.
Example:
"prueba"
⌘I
