waiaconnect

Documentação / Completo

Avisos por e-mail e Novidades

GET /v1/notices

Markdown

Programa com IA? Conecte-a à sua conta por MCP: ela revisa sua configuração, cria webhooks e modelos com sua confirmação e escreve o código. Veja como →

Os avisos dos seus números e dos seus cadastros —um número desconectado ou removido, que conecta e desconecta, bloqueado pela Meta ou sem cartão, envios rejeitados, um template aprovado ou bloqueado, o webhook falhando, o histórico perto de vencer, um número conectado, perto das 1.000 mensagens grátis, uma queda do uso, a ficha do cadastro do seu cliente— ficam sempre em Novidades (no painel e pela API). Você escolhe se também chegam por e-mail.

A chave da conta. GET /v1/account/settings e PATCH /v1/account/settings com {"emailNotices": false}. Por padrão, true.

A exceção de cada número. PATCH /v1/connections/{id} com emailNotices: inherit (o que a conta disser, o padrão), on ou off. Cada número traz emailNotices e emailNoticesEffective (se hoje os avisos dele saem por e-mail). Um aviso de um número sai por e-mail se o número diz on, ou diz inherit e a conta tem emailNotices: true; um que não é de um número segue a conta.

Lê-los. GET /v1/notices (o mais novo primeiro; connectionId, unread=true, limit de 1 a 100, before = o nextBefore da página anterior, lang). Cada aviso traz o mesmo texto do e-mail (subject, heading, paragraphs, o que fazer, botão) e emailStatus: suppressed_by_preference = não saiu pela sua chave. POST /v1/notices/{id}/read marca como lido, também no painel; POST /v1/notices/read-all marca todos de uma vez (devolve updated, quantos marcou).

No painel. Configurações › Notificações (a conta e número por número) e a caixa Novidades. Cada e-mail destes avisos traz no rodapé «Não quer receber estes e-mails? Configure seus avisos».

# 1) stop emailing the notices about your numbers (they stay in /v1/notices)
curl -X PATCH https://api.waiaconnect.com/v1/account/settings -H "Authorization: Bearer wc_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" -d '{"emailNotices": false}'
# → { "settings": { "emailNotices": false } }

# 2) …but keep emailing this one number (inherit | on | off)
curl -X PATCH https://api.waiaconnect.com/v1/connections/conn_73dc… -H "Authorization: Bearer wc_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" -d '{"emailNotices": "on"}'

# 3) read the unread notices, in your language
curl "https://api.waiaconnect.com/v1/notices?unread=true&lang=en" -H "Authorization: Bearer wc_live_YOUR_API_KEY"
# → { "notices": [ { "id": 1234, "type": "connection_disconnected", "connectionId": "conn_73dc…",
#       "emailStatus": "suppressed_by_preference", "subject": "…", "paragraphs": ["…"], "cta": { … } } ],
#     "unreadCount": 1, "nextBefore": null }

# 4) mark one as read (idempotent)
curl -X POST https://api.waiaconnect.com/v1/notices/1234/read -H "Authorization: Bearer wc_live_YOUR_API_KEY"

# 5) …or mark them all as read at once
curl -X POST https://api.waiaconnect.com/v1/notices/read-all -H "Authorization: Bearer wc_live_YOUR_API_KEY"
# → { "updated": 3 }
const H = { "Authorization": "Bearer wc_live_YOUR_API_KEY", "Content-Type": "application/json" };

// the account switch, and one number that keeps emailing
await fetch("https://api.waiaconnect.com/v1/account/settings", { method: "PATCH", headers: H, body: JSON.stringify({ emailNotices: false }) });
await fetch("https://api.waiaconnect.com/v1/connections/conn_73dc…", { method: "PATCH", headers: H, body: JSON.stringify({ emailNotices: "on" }) });

// the unread notices, newest first
const { notices, unreadCount } = await (await fetch("https://api.waiaconnect.com/v1/notices?unread=true&lang=en", { headers: H })).json();
for (const n of notices) {
  console.log(n.type, n.connectionId, n.subject);
  await fetch(`https://api.waiaconnect.com/v1/notices/${n.id}/read`, { method: "POST", headers: H });
}
<?php
$h = ["Authorization: Bearer wc_live_YOUR_API_KEY", "Content-Type: application/json"];
$ch = curl_init("https://api.waiaconnect.com/v1/account/settings");
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "PATCH",
  CURLOPT_HTTPHEADER => $h,
  CURLOPT_POSTFIELDS => json_encode(["emailNotices" => false]),
]);
curl_exec($ch);

$ch = curl_init("https://api.waiaconnect.com/v1/notices?unread=true&lang=en");
curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $h]);
$notices = json_decode(curl_exec($ch), true)["notices"];
foreach ($notices as $n) {
  echo $n["type"] . " " . $n["subject"] . "\n";
  $r = curl_init("https://api.waiaconnect.com/v1/notices/" . $n["id"] . "/read");
  curl_setopt_array($r, [CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => $h]);
  curl_exec($r);
}
import requests
H = {"Authorization": "Bearer wc_live_YOUR_API_KEY"}

# the account switch, and one number that keeps emailing
requests.patch("https://api.waiaconnect.com/v1/account/settings", headers=H, json={"emailNotices": False})
requests.patch("https://api.waiaconnect.com/v1/connections/conn_73dc…", headers=H, json={"emailNotices": "on"})

# the unread notices, newest first
page = requests.get("https://api.waiaconnect.com/v1/notices", headers=H, params={"unread": "true", "lang": "en"}).json()
for n in page["notices"]:
    print(n["type"], n["connectionId"], n["subject"])
    requests.post(f"https://api.waiaconnect.com/v1/notices/{n['id']}/read", headers=H)

Sempre chegam por e-mail, digam o que disserem as chaves: cobrança e pagamentos, segurança e acesso, avisos legais, respostas do suporte e as boas-vindas.

Um emailNotices da conta que não seja true/false dá 400 SETTINGS_INVALID; o de um número que não seja inherit, on ou off, 400 CONNECTION_EMAIL_NOTICES_INVALID.

Um parâmetro inválido de GET /v1/notices dá 400 NOTICES_QUERY_INVALID; um connectionId de outra conta, 404 CONNECTION_NOT_FOUND; um aviso de outra conta, 404 NOTICE_NOT_FOUND.

type é um texto aberto (connection_disconnected, template_first_approved…): novos tipos são adicionados.