Enviar plantilla a Meta
Envía la plantilla a Meta para aprobación (el Submit to Meta del panel). Úsalo para una plantilla que nunca se envió a Meta (source: "PILOT_STATUS") o para reenviar una rechazada. El destino es el número de WhatsApp de la clave, que debe ser un número de Meta Cloud API con una WhatsApp Business Account (422 TEMPLATE_REQUIRES_META_NUMBER en caso contrario). El cuerpo está vacío: el número viene de la clave, y cualquier campo (incluido whatsappNumberId) se rechaza con 400 UNKNOWN_FIELDS.
Devuelve la plantilla (ahora source: "META", normalmente metaStatus: "PENDING") más metaTemplateId. Meta la revisa de forma asíncrona: consulta el estado más tarde con GET /v1/templates/{id} o actualízalo con POST /v1/templates/sync. Permiso templates:manage (el mismo que el panel): OWNER o ADMIN para claves de cuenta y tokens OAuth.
Requiere una clave con alcance de número.
curl --request POST \
--url https://pilotstatus.com.br/v1/templates/{id}/submit \
--header 'x-api-key: <api-key>'import requests
url = "https://pilotstatus.com.br/v1/templates/{id}/submit"
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
fetch('https://pilotstatus.com.br/v1/templates/{id}/submit', 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/v1/templates/{id}/submit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"x-api-key: <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"
"net/http"
"io"
)
func main() {
url := "https://pilotstatus.com.br/v1/templates/{id}/submit"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-api-key", "<api-key>")
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/v1/templates/{id}/submit")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/templates/{id}/submit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "tpl_01HZX...",
"name": "order_update",
"category": "UTILITY",
"body": "{\"body\":{\"text\":\"Pedido {{order}} enviado\"}}",
"variables": [
"order"
],
"source": "META",
"metaStatus": "PENDING",
"metaLanguage": "pt_BR",
"sendable": false,
"metaTemplateId": "1234567890123456"
}¿Esta página le ayudó?
curl --request POST \
--url https://pilotstatus.com.br/v1/templates/{id}/submit \
--header 'x-api-key: <api-key>'import requests
url = "https://pilotstatus.com.br/v1/templates/{id}/submit"
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
fetch('https://pilotstatus.com.br/v1/templates/{id}/submit', 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/v1/templates/{id}/submit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"x-api-key: <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"
"net/http"
"io"
)
func main() {
url := "https://pilotstatus.com.br/v1/templates/{id}/submit"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-api-key", "<api-key>")
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/v1/templates/{id}/submit")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/templates/{id}/submit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"id": "tpl_01HZX...",
"name": "order_update",
"category": "UTILITY",
"body": "{\"body\":{\"text\":\"Pedido {{order}} enviado\"}}",
"variables": [
"order"
],
"source": "META",
"metaStatus": "PENDING",
"metaLanguage": "pt_BR",
"sendable": false,
"metaTemplateId": "1234567890123456"
}