Fico feliz que você esteja aqui.
Na documentação do Whatstotal, você aprenderá a conectar e configurar todas as ferramentas disponíveis em nossa API.
Leia atentamente todas as informações contidas na documentação.
Enviar uma mensagem template com a WhatsTotal
"https://api.wtstotal.com/message/sendTemplate/{instance}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n \"number\": \"\",\n \"templateMessage\": {\n \"name\": \"\",\n \"language\": \"pt_BR\",\n \"components\": [\n {\n \"type\": \"header\",\n \"sub_type\": \"quick_reply\",\n \"index\": \"\",\n \"parameters\": [\n {\n \"type\": \"payload\",\n \"text\": \"\"\n }\n ]\n }\n ]\n }\n}",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Enviar mensagem de texto simples
"https://api.wtstotal.com/message/sendText/{instance}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n \"number\": \"\",\n \"options\": {\n \"delay\": 123,\n \"presence\": \"composing\",\n \"linkPreview\": true,\n \"quoted\": {\n \"key\": {\n \"remoteJid\": \"\",\n \"fromMe\": true,\n \"id\": \"\",\n \"participant\": \"\"\n },\n \"message\": {\n \"conversation\": \"\"\n }\n },\n \"mentions\": {\n \"everyOne\": true,\n \"mentioned\": [\n \"\"\n ]\n }\n },\n \"textMessage\": {\n \"text\": \"\"\n }\n}",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
{
"key": {
"remoteJid": "553198296801@s.whatsapp.net",
"fromMe": true,
"id": "BAE594145F4C59B4"
},
"message": {
"extendedTextMessage": {
"text": "Olá!"
}
},
"messageTimestamp": "1717689097",
"status": "PENDING"
}
Postar status no WhatsApp (stories)
"https://api.wtstotal.com/message/sendStatus/{instance}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n \"statusMessage\": {\n \"type\": \"text\",\n \"content\": \"\",\n \"caption\": \"\",\n \"backgroundColor\": \"\",\n \"font\": 123,\n \"allContacts\": true,\n \"statusJidList\": [\n \"\"\n ]\n }\n}",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
{
"key": {
"remoteJid": "status@broadcast",
"fromMe": true,
"id": "BAE5FAB9E65A3DA8"
},
"message": {
"extendedTextMessage": {
"text": "example",
"backgroundArgb": 4294910617,
"font": "FB_SCRIPT"
}
},
"messageTimestamp": "1717691767",
"status": "PENDING",
"participant": "553198296801:17@s.whatsapp.net"
}
Enviar mensagem de mídia
"https://api.wtstotal.com/message/sendMedia/{instance}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n \"number\": \"\",\n \"options\": {\n \"delay\": 123,\n \"presence\": \"composing\"\n },\n \"mediaMessage\": {\n \"mediaType\": \"image\",\n \"fileName\": \"evolution-api.pdf\",\n \"caption\": \"\",\n \"media\": \"\"\n }\n}",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
{
"key": {
"remoteJid": "553198296801@s.whatsapp.net",
"fromMe": true,
"id": "BAE5F5A632EAE722"
},
"message": {
"imageMessage": {
"url": "https://mmg.whatsapp.net/o1/v/t62.7118-2...",
"mimetype": "image/png",
"caption": "Caption text",
"fileSha256": "VbCGkGBv5SZStLD5PHdkBWpQav/lNsXcY...",
"fileLength": "1305757",
"height": 1080,
"width": 1920,
"mediaKey": "aFQK9Ocw5tE7Nf0iBA42Xcb4Dee6G1k/pLL...",
"fileEncSha256": "bGVtYeR3458RwC0p1tsGDNuj+vOu/...",
"directPath": "/o1/v/t62.7118-24/f1/m232/up-oil...",
"mediaKeyTimestamp": "1717775573",
"jpegThumbnail": "/9j/2wBDABALDA4MChAODQ4SERATG...",
"contextInfo": {}
}
},
"messageTimestamp": "1717775575",
"status": "PENDING"
}
Enviar áudio no WhatsApp
"https://api.wtstotal.com/message/sendWhatsAppAudio/{instance}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n \"number\": \"\",\n \"options\": {\n \"delay\": 123,\n \"presence\": \"recording\",\n \"encoding\": true\n },\n \"audioMessage\": {\n \"audio\": \"\"\n }\n}",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
{
"key": {
"remoteJid": "553198296801@s.whatsapp.net",
"fromMe": true,
"id": "BAE5EFED2AB0BB9F"
},
"message": {
"audioMessage": {
"url": "https://mmg.whatsapp.net/v/t62.7114-24/21428511_985284763127087_5662928...",
"mimetype": "audio/mp4",
"fileSha256": "DJPBnRns6QADzZNH2j0R88mUtFQ4aiOm9aZf6dio2G0=",
"fileLength": "670662",
"seconds": 42,
"ptt": true,
"mediaKey": "+A3X1Tuyzeh87cCVZpfuKpL3Y4RYdYr3sCDurjSlBTY=",
"fileEncSha256": "s4tKvHOXIZAw5668/Xcy4zoFba4vW8klmNYC78yOPZs=",
"directPath": "/v/t62.7114-24/21428511_985284763127087_5662928477636351284_n.enc...",
"mediaKeyTimestamp": "1717776942"
}
},
"messageTimestamp": "1717776942",
"status": "PENDING"
}
Enviar figurinha
"https://api.wtstotal.com/message/sendSticker/{instance}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n \"number\": \"\",\n \"options\": {\n \"delay\": 123,\n \"presence\": \"composing\"\n },\n \"stickerMessage\": {\n \"image\": \"\"\n }\n}",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
Enviar localização
"https://api.wtstotal.com/message/sendLocation/{instance}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n \"number\": \"\",\n \"options\": {\n \"delay\": 123,\n \"presence\": \"composing\"\n },\n \"locationMessage\": {\n \"name\": \"\",\n \"address\": \"\",\n \"latitude\": 123,\n \"longitude\": 123\n }\n}",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
{
"key": {
"remoteJid": "553198296801@s.whatsapp.net",
"fromMe": true,
"id": "BAE51B6FF4470AF9"
},
"message": {
"locationMessage": {
"degreesLatitude": -19.93359,
"degreesLongitude": -43.93851,
"name": "Palácio da Liberdade",
"address": "Praça da Liberdade, Belo Horizonte, MG 30140-050",
"contextInfo": {}
}
},
"messageTimestamp": "1717779606",
"status": "PENDING"
}
Enviar contato
"https://api.wtstotal.com/message/sendContact/{instance}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n \"number\": \"\",\n \"options\": {\n \"delay\": 123,\n \"presence\": \"composing\"\n },\n \"contactMessage\": [\n {\n \"fullName\": \"\",\n \"wuid\": \"\",\n \"phoneNumber\": \"\",\n \"organization\": \"\",\n \"email\": \"\",\n \"url\": \"\"\n }\n ]\n}",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
{
"key": {
"remoteJid": "553198296801@s.whatsapp.net",
"fromMe": true,
"id": "BAE58DA6CBC941BC"
},
"message": {
"contactMessage": {
"displayName": "Guilherme Gomes",
"vcard": "BEGIN:VCARD\nVERSION:3.0\nN:Guilherme Gomes\nFN:Guilherme Gomes\nORG:AtendAI;\nEMAIL:...",
"contextInfo": {}
}
},
"messageTimestamp": "1717780437",
"status": "PENDING"
}
Enviar reação
"https://api.wtstotal.com/message/sendReaction/{instance}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n \"reactionMessage\": {\n \"key\": {\n \"remoteJid\": \"\",\n \"fromMe\": true,\n \"id\": \"\"\n },\n \"reaction\": \"🚀\"\n }\n}",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
{
"key": {
"remoteJid": "553198296801@s.whatsapp.net",
"fromMe": true,
"id": "BAE569F0E38F858D"
},
"message": {
"reactionMessage": {
"key": {
"remoteJid": "553198296801@s.whatsapp.net",
"fromMe": true,
"id": "BAE58DA6CBC941BC"
},
"text": "🚀",
"senderTimestampMs": "1717781105034"
}
},
"messageTimestamp": "1717781105",
"status": "PENDING"
}
Enviar enquete
"https://api.wtstotal.com/message/sendPoll/{instance}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n \"number\": \"\",\n \"options\": {\n \"delay\": 123,\n \"presence\": \"composing\"\n },\n \"pollMessage\": {\n \"name\": \"\",\n \"selectableCount\": 2,\n \"values\": [\n \"\"\n ]\n }\n}",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
{
"key": {
"remoteJid": "553198296801@s.whatsapp.net",
"fromMe": true,
"id": "BAE53EC8D8E1FD8A"
},
"message": {
"messageContextInfo": {
"messageSecret": "lX/+cLHHNfnTTKZi+88mrhoyi6KNuUzWjgfaB0bTfOY="
},
"pollCreationMessage": {
"name": "Poll Name",
"options": [
{
"optionName": "Option 1"
},
{
"optionName": "Option 2"
},
{
"optionName": "Option 3"
}
],
"selectableOptionsCount": 1
}
},
"messageTimestamp": "1717781848",
"status": "PENDING"
}
Enviar lista
"https://api.wtstotal.com/message/sendList/{instance}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n \"number\": \"\",\n \"options\": {\n \"delay\": 123,\n \"presence\": \"composing\"\n },\n \"listMessage\": {\n \"title\": \"\",\n \"description\": \"\",\n \"buttonText\": \"\",\n \"footerText\": \"\",\n \"sections\": [\n {\n \"title\": \"\",\n \"rows\": [\n {\n \"title\": \"\",\n \"description\": \"\",\n \"rowId\": \"\"\n }\n ]\n }\n ]\n }\n}",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
{
"key": {
"remoteJid": "553198296801@s.whatsapp.net",
"fromMe": true,
"id": "BAE5096096C5E261"
},
"message": {
"listMessage": {
"title": "List Title",
"description": "List description",
"buttonText": "Click Me",
"listType": "PRODUCT_LIST",
"sections": [
{
"title": "Section title",
"rows": [
{
"title": "Row 1",
"description": "Row 1 description",
"rowId": "1"
},
{
"title": "Row 2",
"description": "Row 2 description",
"rowId": "2"
}
]
},
{
"title": "Section 2",
"rows": [
{
"title": "Row 1",
"description": "Row 1 description",
"rowId": "1"
},
{
"title": "Row 2",
"description": "Row 2 description",
"rowId": "2"
}
]
}
],
"contextInfo": {}
}
},
"messageTimestamp": "1717782429",
"status": "PENDING"
}