Referencias de anuncios (CTWA)
Lista los mensajes entrantes del número vinculado que llegaron desde un anuncio o publicación Click-to-WhatsApp, del más reciente al más antiguo. En la práctica solo los números de la API oficial (Meta) traen un origen de anuncio: el bloque referral es un campo del webhook de la Cloud API.
Meta envía el origen solo en el primer mensaje de la conversación y nunca lo repite, así que cada elemento aquí equivale a una conversación que comenzó desde ese anuncio.
referral.sourceId es el id del anuncio (o publicación) de Meta y sigue siendo la clave de agrupación incluso cuando los nombres de abajo están presentes: una campaña se puede renombrar en Meta en cualquier momento.
Privacidad (PII): en un registro redactado (STORE_X_DAYS pasada la retención, o todos los registros de un número RELAY_ONLY, que además recibe notice: "PII_RELAY_ONLY") la identidad del anuncio se conserva (sourceId, sourceType y los nombres resueltos), mientras que todo lo que viene del payload del anuncio (sourceUrl, headline, body, mediaType, imageUrl, videoUrl, thumbnailUrl, ctwaClid) y el text, participant* y media del mensaje vuelven null, con redacted: true. Un id de anuncio identifica una pieza creativa, nunca a una persona, así que la atribución sigue funcionando en un número RELAY_ONLY en lugar de no devolver nada.
Actúa sobre un número. Usa una clave de número (ps_number_), o una clave de workspace / clave de cuenta (ps_account_ + x-workspace-id) / token OAuth con el encabezado x-whatsapp-number-id; sin él, una credencial de todo el workspace recibe 403 TENANT_SCOPE_NOT_ALLOWED. Los tokens OAuth y las claves de cuenta necesitan chat:read (OWNER, ADMIN, AGENT; el rol ANALYST recibe 403 PERMISSION_DENIED).
El objeto referral también trae los nombres RESUELTOS del anuncio (adName, adsetId, adsetName, campaignId, campaignName) más namesResolvedAt.
⚠️ Esos seis vuelven null salvo que el anunciante haya compartido esa cuenta publicitaria con el portafolio comercial de Pilot Status como socio. Un nombre null es un estado SOPORTADO, no un error: la conversación se sigue contando y sourceId se sigue devolviendo.
Ningún endpoint resuelve un nombre bajo demanda: la resolución ocurre de forma asíncrona, fuera del camino de la solicitud, así que consultar nunca dispara una llamada a la Marketing API y un null puede convertirse en un nombre minutos después sin que hagas nada. namesResolvedAt es lo que lo hace observable: null significa “todavía no resuelto”, mientras que una marca de tiempo con nombres null significa “preguntamos y Meta no devolvió nada” (anuncio eliminado o acceso no compartido).
curl --request GET \
--url https://pilotstatus.com.br/v1/referrals \
--header 'x-api-key: <api-key>'import requests
url = "https://pilotstatus.com.br/v1/referrals"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://pilotstatus.com.br/v1/referrals', 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/referrals",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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/referrals"
req, _ := http.NewRequest("GET", 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.get("https://pilotstatus.com.br/v1/referrals")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/referrals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"referrals": [
{
"id": "cm_01HZX...",
"conversationId": "conv_01HZX...",
"direction": "INBOUND",
"providerKind": "META",
"externalMessageId": "wamid.HBgNNTU0Mj...",
"status": "DELIVERED",
"messageType": "text",
"origin": null,
"text": "Oi, vi o anúncio",
"participantName": "Maria",
"participantPhone": "5511999999999",
"participantUserId": null,
"repliedToExternalId": null,
"media": null,
"sentAt": null,
"deliveredAt": null,
"readAt": null,
"providerTimestamp": "2026-08-16T12:00:00.000Z",
"createdAt": "2026-08-16T12:00:01.000Z",
"referral": {
"sourceId": "120249828053880703",
"sourceType": "ad",
"sourceUrl": "https://www.instagram.com/p/DcJhrlpA3Pl/",
"headline": "SALE MM DESIGN",
"body": "Seu ambiente pode ficar ainda mais incrível",
"mediaType": "video",
"imageUrl": null,
"videoUrl": "https://video.example/v.mp4",
"thumbnailUrl": "https://thumb.example/t.jpg",
"ctwaClid": "ARAaZ1x...",
"adName": "Ads 01 - Vídeo dos 70%",
"adsetId": "120249828053990703",
"adsetName": "[IG] [LL1% IG + VÍDEOS] - 35 a 50",
"campaignId": "120249677595590703",
"campaignName": "[CD-01] [WHATSAPP] - MM Design - Sale 70%",
"namesResolvedAt": "2026-08-17T21:04:00.000Z"
}
},
{
"id": "cm_def456",
"conversationId": "conv_01HZX...",
"direction": "INBOUND",
"providerKind": "META",
"externalMessageId": "wamid.HBgNNTU0Mj...2",
"status": "DELIVERED",
"messageType": "text",
"origin": null,
"text": "quero saber o preço",
"participantName": "Maria",
"participantPhone": "5511999999999",
"participantUserId": null,
"repliedToExternalId": null,
"media": null,
"sentAt": null,
"deliveredAt": null,
"readAt": null,
"providerTimestamp": "2026-08-16T12:00:00.000Z",
"createdAt": "2026-08-16T12:00:01.000Z",
"referral": {
"sourceId": "120249828075420703",
"sourceType": "ad",
"sourceUrl": "https://www.instagram.com/p/DcJhrlpA3Pl/",
"headline": "MM DESIGN — Outlet",
"body": "Seu ambiente pode ficar ainda mais incrível",
"mediaType": "video",
"imageUrl": null,
"videoUrl": "https://video.example/v.mp4",
"thumbnailUrl": "https://thumb.example/t.jpg",
"ctwaClid": "ARAaZ1x...",
"adName": null,
"adsetId": null,
"adsetName": null,
"campaignId": null,
"campaignName": null,
"namesResolvedAt": null
}
}
],
"total": 2,
"page": 1,
"pageSize": 30,
"totalPages": 1
}Parámetros de consulta
Respuesta
Listar referencias de anuncios
¿Esta página le ayudó?
curl --request GET \
--url https://pilotstatus.com.br/v1/referrals \
--header 'x-api-key: <api-key>'import requests
url = "https://pilotstatus.com.br/v1/referrals"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://pilotstatus.com.br/v1/referrals', 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/referrals",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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/referrals"
req, _ := http.NewRequest("GET", 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.get("https://pilotstatus.com.br/v1/referrals")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/referrals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"referrals": [
{
"id": "cm_01HZX...",
"conversationId": "conv_01HZX...",
"direction": "INBOUND",
"providerKind": "META",
"externalMessageId": "wamid.HBgNNTU0Mj...",
"status": "DELIVERED",
"messageType": "text",
"origin": null,
"text": "Oi, vi o anúncio",
"participantName": "Maria",
"participantPhone": "5511999999999",
"participantUserId": null,
"repliedToExternalId": null,
"media": null,
"sentAt": null,
"deliveredAt": null,
"readAt": null,
"providerTimestamp": "2026-08-16T12:00:00.000Z",
"createdAt": "2026-08-16T12:00:01.000Z",
"referral": {
"sourceId": "120249828053880703",
"sourceType": "ad",
"sourceUrl": "https://www.instagram.com/p/DcJhrlpA3Pl/",
"headline": "SALE MM DESIGN",
"body": "Seu ambiente pode ficar ainda mais incrível",
"mediaType": "video",
"imageUrl": null,
"videoUrl": "https://video.example/v.mp4",
"thumbnailUrl": "https://thumb.example/t.jpg",
"ctwaClid": "ARAaZ1x...",
"adName": "Ads 01 - Vídeo dos 70%",
"adsetId": "120249828053990703",
"adsetName": "[IG] [LL1% IG + VÍDEOS] - 35 a 50",
"campaignId": "120249677595590703",
"campaignName": "[CD-01] [WHATSAPP] - MM Design - Sale 70%",
"namesResolvedAt": "2026-08-17T21:04:00.000Z"
}
},
{
"id": "cm_def456",
"conversationId": "conv_01HZX...",
"direction": "INBOUND",
"providerKind": "META",
"externalMessageId": "wamid.HBgNNTU0Mj...2",
"status": "DELIVERED",
"messageType": "text",
"origin": null,
"text": "quero saber o preço",
"participantName": "Maria",
"participantPhone": "5511999999999",
"participantUserId": null,
"repliedToExternalId": null,
"media": null,
"sentAt": null,
"deliveredAt": null,
"readAt": null,
"providerTimestamp": "2026-08-16T12:00:00.000Z",
"createdAt": "2026-08-16T12:00:01.000Z",
"referral": {
"sourceId": "120249828075420703",
"sourceType": "ad",
"sourceUrl": "https://www.instagram.com/p/DcJhrlpA3Pl/",
"headline": "MM DESIGN — Outlet",
"body": "Seu ambiente pode ficar ainda mais incrível",
"mediaType": "video",
"imageUrl": null,
"videoUrl": "https://video.example/v.mp4",
"thumbnailUrl": "https://thumb.example/t.jpg",
"ctwaClid": "ARAaZ1x...",
"adName": null,
"adsetId": null,
"adsetName": null,
"campaignId": null,
"campaignName": null,
"namesResolvedAt": null
}
}
],
"total": 2,
"page": 1,
"pageSize": 30,
"totalPages": 1
}