Canais, tipos e opt-out granular por cliente.
Email (AWS SES), in-app, webhook. Templates HTML/texto por organização. NotificationPreference controla quais eventos cada billing account recebe.
Sistema

3
canais (email, in_app, webhook)
11+
tipos (NotificationType)
∞
templates customizáveis
Per BA
opt-out granular
Canais disponíveis
Email
Envio transacional via AWS SES. Templates HTML + texto editáveis. Variáveis dinâmicas (nome, valor, vencimento, link).
- AWS SES
- Templates HTML + texto
- Variáveis dinâmicas
In-App
Notificação dentro do portal/dashboard. Marcação read/unread. Útil para clientes B2B que acessam diariamente.
- Portal/dashboard
- Read/unread
- Foco B2B
Webhook
HTTP POST para endpoint do cliente. Permite integração com Slack, Discord, sistemas internos.
- HTTP POST
- Integração Slack/Discord
- Sistemas internos
Recursos da notificação
Templates Editáveis
EmailTemplate por organização. Editor HTML + texto. Variáveis substituídas no envio.
- {{customer_name}}, {{amount}}, {{due_date}}, {{link}}
- Override por tipo
- Default global como fallback
Layout Customizável
EmailLayout por Company. Logo, cores, header, footer. Aplicado em todos templates.
- Logo, cores, header, footer
- Por Company
- Aplicação consistente
NotificationPreference por Billing Account
Cliente controla quais eventos recebe e em qual canal.
- Toggle por tipo
- Opt-out de marketing mantendo transacionais
- Editável no portal
Status Detalhado
NotificationStatus: pending → sent → delivered → read. Failed registra failureReason.
- pending → sent → delivered → read
- failureReason em falha
- Tracking completo
Agendamento
scheduledFor permite envio futuro. Worker processa no momento certo.
- scheduledFor
- Envio futuro
- Worker dedicado
Retry em Falha
retryCount incrementado em cada tentativa. Email com bounce trackeado, webhook com backoff.
- retryCount
- Bounce trackeado
- Backoff em webhook
Histórico Completo
Toda notificação persistida em Notification model. Filtros por tipo, canal, status, período.
- Notification model
- Filtros completos
- Histórico permanente
Multi-idioma (i18n)
Cliente com locale recebe templates traduzidos. PT-BR e EN-US nativos.
- PT-BR e EN-US nativos
- Templates por locale
- Tradução automática
Criar template customizado
bash
curl -X POST https://api.billing.kobana.com.br/v1/email-templates \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"name": "Fatura paga — agradecimento",
"slug": "invoice-paid-thanks",
"type": "payment_succeeded",
"subject": "Obrigado, {{customer_name}}! Pagamento confirmado.",
"html_body": "<p>Olá {{customer_name}}, recebemos {{amount}}. Próxima cobrança em {{next_cycle}}.</p>",
"is_active": true
}'