Enviar template
Envia uma mensagem de template aprovado do WhatsApp para um destinatário.
curl --request POST \
--url https://pilotstatus.com.br/api/layer/evolution-v2/message/sendTemplate/{instance} \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"name": "order_confirmation",
"language": "pt_BR",
"number": "5511999999999",
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Ismael"
}
]
}
],
"webhookUrl": "https://example.com/webhooks/template"
}
'import requests
url = "https://pilotstatus.com.br/api/layer/evolution-v2/message/sendTemplate/{instance}"
payload = {
"name": "order_confirmation",
"language": "pt_BR",
"number": "5511999999999",
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Ismael"
}
]
}
],
"webhookUrl": "https://example.com/webhooks/template"
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'order_confirmation',
language: 'pt_BR',
number: '5511999999999',
components: [{type: 'body', parameters: [{type: 'text', text: 'Ismael'}]}],
webhookUrl: 'https://example.com/webhooks/template'
})
};
fetch('https://pilotstatus.com.br/api/layer/evolution-v2/message/sendTemplate/{instance}', 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://pilotstatus.com.br/api/layer/evolution-v2/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 => json_encode([
'name' => 'order_confirmation',
'language' => 'pt_BR',
'number' => '5511999999999',
'components' => [
[
'type' => 'body',
'parameters' => [
[
'type' => 'text',
'text' => 'Ismael'
]
]
]
],
'webhookUrl' => 'https://example.com/webhooks/template'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$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://pilotstatus.com.br/api/layer/evolution-v2/message/sendTemplate/{instance}"
payload := strings.NewReader("{\n \"name\": \"order_confirmation\",\n \"language\": \"pt_BR\",\n \"number\": \"5511999999999\",\n \"components\": [\n {\n \"type\": \"body\",\n \"parameters\": [\n {\n \"type\": \"text\",\n \"text\": \"Ismael\"\n }\n ]\n }\n ],\n \"webhookUrl\": \"https://example.com/webhooks/template\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
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://pilotstatus.com.br/api/layer/evolution-v2/message/sendTemplate/{instance}")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"order_confirmation\",\n \"language\": \"pt_BR\",\n \"number\": \"5511999999999\",\n \"components\": [\n {\n \"type\": \"body\",\n \"parameters\": [\n {\n \"type\": \"text\",\n \"text\": \"Ismael\"\n }\n ]\n }\n ],\n \"webhookUrl\": \"https://example.com/webhooks/template\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/api/layer/evolution-v2/message/sendTemplate/{instance}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"order_confirmation\",\n \"language\": \"pt_BR\",\n \"number\": \"5511999999999\",\n \"components\": [\n {\n \"type\": \"body\",\n \"parameters\": [\n {\n \"type\": \"text\",\n \"text\": \"Ismael\"\n }\n ]\n }\n ],\n \"webhookUrl\": \"https://example.com/webhooks/template\"\n}"
response = http.request(request)
puts response.read_body{
"key": {
"remoteJid": "5511999999999@s.whatsapp.net",
"fromMe": true,
"id": "wamid.HBgLNTUxMTk5OTk5OTk5FQIAERgSN0EyN0M4N0E4RjBBQkNEMTIzAA=="
},
"message": {
"conversation": "▶️order_confirmation◀️"
},
"messageType": "conversation",
"messageTimestamp": 1720483200,
"instanceId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
"webhookUrl": null,
"status": "PENDING",
"source": "unknown"
}{
"status": 400,
"error": "Bad Request",
"message": "Invalid payload"
}Autorizações
Your Pilot Status API key (ps_...). Evolution GO also accepts Authorization: Bearer <key>.
Parâmetros de caminho
O nome de exibição do número no painel do Pilot Status.
Corpo
Nome do template aprovado.
"order_confirmation"
Código de idioma/localidade do template (ex.: pt_BR).
"pt_BR"
Telefone do destinatário em E.164 sem +, ou um JID.
"5511999999999"
Componentes do template (parâmetros de cabeçalho/corpo/botão).
[
{
"type": "body",
"parameters": [{ "type": "text", "text": "Ismael" }]
}
]
URL de webhook opcional por mensagem para callbacks de status.
"https://example.com/webhooks/template"
Resposta
Sucesso — corpo de resposta nativo do provedor.
Sent template message. Served by the Cloud API (Meta) channel; returns the persisted messageRaw envelope with the template rendered as a conversation preview.
Message key identifying the sent template message.
Show child attributes
Show child attributes
Rendered message content. Templates are stored as a conversation preview marked with the template name.
Show child attributes
Show child attributes
Content type; templates render as 'conversation'.
Unix timestamp (seconds) when the message was accepted.
Instance UUID that sent the message.
Webhook URL configured for this instance (may be null).
Delivery status.
ERROR, PENDING, SERVER_ACK, DELIVERY_ACK, READ, PLAYED Origin device; 'unknown' for Cloud API sends.
Esta página foi útil?
curl --request POST \
--url https://pilotstatus.com.br/api/layer/evolution-v2/message/sendTemplate/{instance} \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"name": "order_confirmation",
"language": "pt_BR",
"number": "5511999999999",
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Ismael"
}
]
}
],
"webhookUrl": "https://example.com/webhooks/template"
}
'import requests
url = "https://pilotstatus.com.br/api/layer/evolution-v2/message/sendTemplate/{instance}"
payload = {
"name": "order_confirmation",
"language": "pt_BR",
"number": "5511999999999",
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Ismael"
}
]
}
],
"webhookUrl": "https://example.com/webhooks/template"
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'order_confirmation',
language: 'pt_BR',
number: '5511999999999',
components: [{type: 'body', parameters: [{type: 'text', text: 'Ismael'}]}],
webhookUrl: 'https://example.com/webhooks/template'
})
};
fetch('https://pilotstatus.com.br/api/layer/evolution-v2/message/sendTemplate/{instance}', 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://pilotstatus.com.br/api/layer/evolution-v2/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 => json_encode([
'name' => 'order_confirmation',
'language' => 'pt_BR',
'number' => '5511999999999',
'components' => [
[
'type' => 'body',
'parameters' => [
[
'type' => 'text',
'text' => 'Ismael'
]
]
]
],
'webhookUrl' => 'https://example.com/webhooks/template'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>"
],
]);
$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://pilotstatus.com.br/api/layer/evolution-v2/message/sendTemplate/{instance}"
payload := strings.NewReader("{\n \"name\": \"order_confirmation\",\n \"language\": \"pt_BR\",\n \"number\": \"5511999999999\",\n \"components\": [\n {\n \"type\": \"body\",\n \"parameters\": [\n {\n \"type\": \"text\",\n \"text\": \"Ismael\"\n }\n ]\n }\n ],\n \"webhookUrl\": \"https://example.com/webhooks/template\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<api-key>")
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://pilotstatus.com.br/api/layer/evolution-v2/message/sendTemplate/{instance}")
.header("apikey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"order_confirmation\",\n \"language\": \"pt_BR\",\n \"number\": \"5511999999999\",\n \"components\": [\n {\n \"type\": \"body\",\n \"parameters\": [\n {\n \"type\": \"text\",\n \"text\": \"Ismael\"\n }\n ]\n }\n ],\n \"webhookUrl\": \"https://example.com/webhooks/template\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/api/layer/evolution-v2/message/sendTemplate/{instance}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"order_confirmation\",\n \"language\": \"pt_BR\",\n \"number\": \"5511999999999\",\n \"components\": [\n {\n \"type\": \"body\",\n \"parameters\": [\n {\n \"type\": \"text\",\n \"text\": \"Ismael\"\n }\n ]\n }\n ],\n \"webhookUrl\": \"https://example.com/webhooks/template\"\n}"
response = http.request(request)
puts response.read_body{
"key": {
"remoteJid": "5511999999999@s.whatsapp.net",
"fromMe": true,
"id": "wamid.HBgLNTUxMTk5OTk5OTk5FQIAERgSN0EyN0M4N0E4RjBBQkNEMTIzAA=="
},
"message": {
"conversation": "▶️order_confirmation◀️"
},
"messageType": "conversation",
"messageTimestamp": 1720483200,
"instanceId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
"webhookUrl": null,
"status": "PENDING",
"source": "unknown"
}{
"status": 400,
"error": "Bad Request",
"message": "Invalid payload"
}