Sistema de Notificações

Configure notificações por email, WhatsApp e webhooks para receber alertas sobre suas tarefas AI em tempo real.

17/01/2025
Nesta Página

Sistema de Notificações

Mantenha-se informado sobre todas as execuções das suas tarefas AI com nosso sistema completo de notificações. Receba alertas por email, WhatsApp, webhooks e muito mais.

Visão Geral

O Claude Scheduler oferece múltiplos canais de notificação para garantir que você nunca perca uma atualização importante:

  • Email - Notificações detalhadas com resultados completos
  • WhatsApp - Alertas instantâneos no seu celular
  • Webhooks - Integração com sistemas externos (Slack, Discord, Make, Zapier)
  • In-App - Notificações dentro do dashboard
  • SMS - Alertas críticos (plano Business)

Notificações por Email

Configuração Básica

Ative notificações por email em qualquer tarefa:

{
  "task_name": "Relatório Diário",
  "schedule": "0 9 * * *",
  "notifications": {
    "email": {
      "enabled": true,
      "recipients": [
        "joao@empresa.com",
        "maria@empresa.com"
      ],
      "on_success": true,
      "on_failure": true,
      "on_retry": false
    }
  }
}

Tipos de Emails

1. Notificação de Sucesso

Subject: ✅ Tarefa "Relatório Diário" completada com sucesso

<!DOCTYPE html>
<html>
<body>
  <h2>Tarefa Executada com Sucesso</h2>
 
  <p><strong>Tarefa:</strong> Relatório Diário</p>
  <p><strong>Executado em:</strong> 2025-01-17 09:00:00 UTC</p>
  <p><strong>Duração:</strong> 3.2 segundos</p>
  <p><strong>Modelo:</strong> Claude 3 Haiku</p>
  <p><strong>Custo:</strong> $0.0012</p>
 
  <hr>
 
  <h3>Resultado:</h3>
  <div style="background: #f5f5f5; padding: 15px; border-radius: 5px;">
    <!-- Output da AI aqui -->
  </div>
 
  <hr>
 
  <p><a href="https://app.claudescheduler.com/executions/{{execution_id}}">
    Ver detalhes completos →
  </a></p>
</body>
</html>

2. Notificação de Falha

Subject: ❌ Tarefa "Relatório Diário" falhou

<body>
  <h2 style="color: #d32f2f;">Falha na Execução da Tarefa</h2>
 
  <p><strong>Tarefa:</strong> Relatório Diário</p>
  <p><strong>Tentativa em:</strong> 2025-01-17 09:00:00 UTC</p>
  <p><strong>Erro:</strong> API timeout after 30 seconds</p>
 
  <h3>Próximas Ações:</h3>
  <ul>
    <li>Retry automático em 5 minutos (tentativa 1 de 3)</li>
    <li>Verificar status da API OpenRouter</li>
    <li>Considerar aumentar o timeout</li>
  </ul>
 
  <p><a href="https://app.claudescheduler.com/tasks/{{task_id}}/edit">
    Editar configurações da tarefa →
  </a></p>
</body>

3. Digest Diário

Subject: 📊 Resumo diário - 15 tarefas executadas

<body>
  <h2>Resumo das Últimas 24 Horas</h2>
 
  <div style="display: flex; gap: 20px;">
    <div style="background: #4caf50; color: white; padding: 20px; border-radius: 8px;">
      <h3>12</h3>
      <p>Sucessos</p>
    </div>
    <div style="background: #f44336; color: white; padding: 20px; border-radius: 8px;">
      <h3>2</h3>
      <p>Falhas</p>
    </div>
    <div style="background: #ff9800; color: white; padding: 20px; border-radius: 8px;">
      <h3>1</h3>
      <p>Retries</p>
    </div>
  </div>
 
  <h3>Tarefas Mais Custosas (Top 5):</h3>
  <table>
    <tr>
      <th>Tarefa</th>
      <th>Execuções</th>
      <th>Custo Total</th>
    </tr>
    <tr>
      <td>Análise Competitiva</td>
      <td>3x</td>
      <td>$0.45</td>
    </tr>
    <!-- ... -->
  </table>
 
  <p><strong>Custo total do dia:</strong> $2.34</p>
</body>

Configurações Avançadas de Email

{
  "email": {
    "enabled": true,
    "recipients": ["time@empresa.com"],
 
    // Eventos que disparam notificação
    "triggers": {
      "on_success": true,
      "on_failure": true,
      "on_retry": false,
      "on_timeout": true,
      "on_cost_threshold": 0.50  // Alerta se custo > $0.50
    },
 
    // Formato do email
    "format": "html",  // "html" ou "plain"
    "include_output": true,
    "include_metadata": true,
 
    // Digest (resumo agregado)
    "digest": {
      "enabled": true,
      "frequency": "daily",  // "hourly", "daily", "weekly"
      "send_at": "18:00",
      "timezone": "America/Sao_Paulo"
    },
 
    // Filtros
    "filters": {
      "min_duration": 5,  // Apenas se duração > 5s
      "only_errors": false,
      "tasks": ["task-1", "task-2"]  // Apenas tarefas específicas
    }
  }
}

Notificações por WhatsApp

Configuração

  1. Conecte sua conta WhatsApp em Settings > Integrations
  2. Ative notificações em cada tarefa
{
  "notifications": {
    "whatsapp": {
      "enabled": true,
      "number": "+5511999999999",
      "on_success": false,  // Evite spam
      "on_failure": true,
      "on_critical": true
    }
  }
}

Exemplos de Mensagens

Sucesso (apenas para tarefas marcadas como importantes)

✅ *Relatório Diário* completado

⏱ Duração: 3.2s
💰 Custo: $0.0012
🤖 Modelo: Claude 3 Haiku

Ver resultado: https://app.cs.ai/e/abc123

Falha

❌ *ALERTA: Tarefa Falhou*

📋 Tarefa: Monitor Sistema Crítico
🕐 Horário: 14:32
⚠️ Erro: API timeout (30s)

🔄 Retry automático em 5min

Detalhes: https://app.cs.ai/e/xyz789

Alerta de Custo

💰 *Alerta de Custo*

Você atingiu 80% do seu budget mensal

📊 Usado: $80.00 de $100.00
📅 Restam 12 dias no ciclo

Revisar uso: https://app.cs.ai/billing

Boas Práticas WhatsApp

  1. Use com moderação - Apenas para alertas importantes
  2. Desative notificações de sucesso em tarefas frequentes
  3. Configure horário de silêncio (quiet hours)
{
  "whatsapp": {
    "quiet_hours": {
      "enabled": true,
      "start": "22:00",
      "end": "08:00",
      "timezone": "America/Sao_Paulo",
      "exceptions": ["critical_tasks"]  // Tarefas que ignoram quiet hours
    }
  }
}

Webhooks

O que são Webhooks?

Webhooks são chamadas HTTP POST automáticas enviadas para URLs que você configurar. Use para integrar com:

  • Slack - Notificações em canais
  • Discord - Alertas em servidores
  • Microsoft Teams - Mensagens em equipes
  • Make/Zapier - Automações complexas
  • APIs customizadas - Seu próprio sistema

Configuração Básica

{
  "notifications": {
    "webhooks": [
      {
        "url": "https://hooks.slack.com/services/YOUR/WEBHOOK/URL",
        "enabled": true,
        "on_success": true,
        "on_failure": true,
        "headers": {
          "Content-Type": "application/json",
          "Authorization": "Bearer your-token"
        }
      }
    ]
  }
}

Payload do Webhook

Quando uma tarefa executa, enviamos este payload:

{
  "event": "task.completed",
  "timestamp": "2025-01-17T09:00:00Z",
  "task": {
    "id": "task_abc123",
    "name": "Relatório Diário",
    "schedule": "0 9 * * *"
  },
  "execution": {
    "id": "exec_xyz789",
    "status": "success",
    "started_at": "2025-01-17T09:00:00Z",
    "completed_at": "2025-01-17T09:00:03Z",
    "duration_ms": 3200,
    "model": "anthropic/claude-3-haiku",
    "tokens_used": 450,
    "cost_usd": 0.0012
  },
  "output": {
    "text": "Resultado da execução da AI...",
    "truncated": false
  },
  "metadata": {
    "user_id": "user_123",
    "organization_id": "org_456"
  }
}

Eventos Disponíveis

type WebhookEvent =
  | "task.completed"
  | "task.failed"
  | "task.retry"
  | "task.timeout"
  | "task.created"
  | "task.updated"
  | "task.deleted"
  | "budget.threshold"
  | "budget.exceeded"

Integrações Populares

Slack

1. Criar Webhook no Slack

  1. Acesse https://api.slack.com/apps
  2. Crie um novo app
  3. Ative "Incoming Webhooks"
  4. Adicione webhook ao canal desejado
  5. Copie a URL do webhook

2. Configurar no Claude Scheduler

{
  "webhooks": [
    {
      "name": "Slack #alerts",
      "url": "https://hooks.slack.com/services/T00/B00/XXX",
      "enabled": true,
      "format": "slack",  // Formatação específica do Slack
      "on_failure": true
    }
  ]
}

3. Formato da Mensagem

{
  "text": "❌ Tarefa falhou",
  "blocks": [
    {
      "type": "header",
      "text": {
        "type": "plain_text",
        "text": "⚠️ Falha na Execução de Tarefa"
      }
    },
    {
      "type": "section",
      "fields": [
        {
          "type": "mrkdwn",
          "text": "*Tarefa:*\nRelatório Diário"
        },
        {
          "type": "mrkdwn",
          "text": "*Status:*\n❌ Falha"
        },
        {
          "type": "mrkdwn",
          "text": "*Erro:*\nAPI timeout"
        },
        {
          "type": "mrkdwn",
          "text": "*Próximo retry:*\n5 minutos"
        }
      ]
    },
    {
      "type": "actions",
      "elements": [
        {
          "type": "button",
          "text": {
            "type": "plain_text",
            "text": "Ver Detalhes"
          },
          "url": "https://app.claudescheduler.com/executions/xyz"
        }
      ]
    }
  ]
}

Discord

Webhook URL

https://discord.com/api/webhooks/YOUR_WEBHOOK_ID/YOUR_WEBHOOK_TOKEN

Payload

{
  "content": "✅ Tarefa completada com sucesso!",
  "embeds": [
    {
      "title": "Relatório Diário",
      "description": "Execução finalizada",
      "color": 3066993,  // Verde
      "fields": [
        {
          "name": "Duração",
          "value": "3.2s",
          "inline": true
        },
        {
          "name": "Custo",
          "value": "$0.0012",
          "inline": true
        },
        {
          "name": "Modelo",
          "value": "Claude 3 Haiku",
          "inline": true
        }
      ],
      "timestamp": "2025-01-17T09:00:03Z",
      "footer": {
        "text": "Claude Scheduler"
      }
    }
  ]
}

Microsoft Teams

Connector Webhook

https://outlook.office.com/webhook/YOUR_CONNECTOR_URL

MessageCard Format

{
  "@type": "MessageCard",
  "@context": "https://schema.org/extensions",
  "summary": "Tarefa Completada",
  "themeColor": "0078D7",
  "title": "✅ Relatório Diário - Sucesso",
  "sections": [
    {
      "activityTitle": "Execução finalizada",
      "activitySubtitle": "2025-01-17 09:00:03",
      "facts": [
        {
          "name": "Duração:",
          "value": "3.2 segundos"
        },
        {
          "name": "Modelo:",
          "value": "Claude 3 Haiku"
        },
        {
          "name": "Custo:",
          "value": "$0.0012"
        }
      ]
    }
  ],
  "potentialAction": [
    {
      "@type": "OpenUri",
      "name": "Ver Detalhes",
      "targets": [
        {
          "os": "default",
          "uri": "https://app.claudescheduler.com/executions/xyz"
        }
      ]
    }
  ]
}

Make (Integromat)

  1. Crie um Webhook no Make

    • Novo scenario → Webhooks → Custom webhook
    • Copie a URL gerada
  2. Configure no Claude Scheduler

{
  "webhooks": [
    {
      "url": "https://hook.make.com/your-webhook-id",
      "enabled": true
    }
  ]
}
  1. Exemplos de Automações
    • Salvar resultados no Google Sheets
    • Criar tarefa no Asana quando falha
    • Enviar SMS via Twilio para alertas críticos
    • Atualizar CRM com insights da AI

Zapier

Similar ao Make:

  1. Criar Zap com trigger "Webhooks by Zapier"
  2. Usar a URL fornecida
  3. Conectar com 5000+ apps

Notificações In-App

Dashboard de Notificações

Acesse o sino (🔔) no canto superior direito:

  • Não lidas - Marcadas em negrito
  • Filtros - Por tipo, tarefa, data
  • Ações rápidas - Ver execução, retry, editar tarefa

Configuração

{
  "in_app": {
    "enabled": true,
    "sound": true,
    "desktop_notifications": true,  // Requer permissão do browser
    "badge_count": true
  }
}

Notificações Desktop (Browser)

// Solicitar permissão
if (Notification.permission === "default") {
  await Notification.requestPermission();
}
 
// Receber notificações mesmo com aba fechada
// Configurado automaticamente pelo dashboard

Alertas de Budget e Custos

Configurar Alertas de Budget

{
  "budget_alerts": {
    "enabled": true,
    "monthly_limit": 100.00,  // USD
    "thresholds": [
      {
        "percentage": 50,
        "notification": ["email"]
      },
      {
        "percentage": 80,
        "notification": ["email", "whatsapp"]
      },
      {
        "percentage": 100,
        "notification": ["email", "whatsapp", "webhook"],
        "action": "pause_tasks"  // Pausa tarefas automaticamente
      }
    ]
  }
}

Alertas por Tarefa

Configure limites individuais:

{
  "task_name": "Análise Complexa",
  "cost_alerts": {
    "max_cost_per_execution": 0.50,
    "max_daily_cost": 5.00,
    "action_on_exceed": "pause",  // "pause" ou "notify"
    "notify": ["email", "slack"]
  }
}

Casos de Uso Práticos

1. DevOps - Monitoramento de Sistemas

{
  "task": "Monitor API Health",
  "schedule": "*/5 * * * *",
  "notifications": {
    "webhooks": [
      {
        "url": "https://hooks.slack.com/services/DEVOPS",
        "on_failure": true,
        "priority": "critical"
      }
    ],
    "whatsapp": {
      "enabled": true,
      "on_failure": true,
      "recipients": ["+5511999999999"]  // Número do engenheiro de plantão
    }
  }
}

2. E-commerce - Alertas de Vendas

{
  "task": "Detectar Vendas Altas",
  "schedule": "0 * * * *",
  "notifications": {
    "email": {
      "enabled": true,
      "recipients": ["vendas@empresa.com"],
      "on_success": true,
      "condition": "output.sales_count > 100"  // Apenas se > 100 vendas/hora
    }
  }
}

3. Marketing - Aprovação de Conteúdo

{
  "task": "Gerar Post Redes Sociais",
  "schedule": "0 8 * * *",
  "notifications": {
    "email": {
      "enabled": true,
      "recipients": ["marketing@empresa.com"],
      "subject": "✍️ Novo conteúdo para aprovação",
      "include_approval_buttons": true  // Botões de aprovar/rejeitar
    },
    "webhooks": [
      {
        "url": "https://api.empresa.com/approve-content",
        "method": "POST"
      }
    ]
  }
}

Filtros e Condições

Notificar Apenas em Condições Específicas

{
  "notifications": {
    "email": {
      "enabled": true,
      "conditions": {
        "status": "success",
        "duration_seconds": {"gt": 10},  // Apenas se > 10s
        "cost_usd": {"gt": 0.10},        // Apenas se > $0.10
        "output_contains": "URGENTE"     // Apenas se output contém palavra-chave
      }
    }
  }
}

Escalação de Alertas

{
  "escalation_policy": {
    "enabled": true,
    "levels": [
      {
        "attempt": 1,
        "wait_minutes": 5,
        "notify": ["email"]
      },
      {
        "attempt": 2,
        "wait_minutes": 15,
        "notify": ["email", "whatsapp"]
      },
      {
        "attempt": 3,
        "wait_minutes": 30,
        "notify": ["email", "whatsapp", "webhook"],
        "webhook_url": "https://pagerduty.com/critical-alert"
      }
    ]
  }
}

Segurança e Privacidade

Dados Sensíveis

Por padrão, não incluímos dados sensíveis em notificações:

  • API keys são mascaradas
  • Outputs são truncados (primeiros 500 caracteres)
  • Dados de usuários são anonimizados

Controle de Privacidade

{
  "privacy": {
    "include_full_output": false,
    "mask_variables": true,
    "anonymize_metadata": true,
    "exclude_fields": ["user_email", "api_key"]
  }
}

Webhook Security

Verificação de Assinatura

Todos os webhooks incluem assinatura HMAC:

POST /your-webhook-endpoint
X-CS-Signature: sha256=abc123...
X-CS-Timestamp: 1705484400
Content-Type: application/json
 
{...}

Validar no seu servidor

import hmac
import hashlib
 
def verify_webhook(payload, signature, secret):
    expected = hmac.new(
        secret.encode(),
        payload.encode(),
        hashlib.sha256
    ).hexdigest()
 
    return hmac.compare_digest(f"sha256={expected}", signature)

IP Allowlist

Configure IPs permitidos em Settings > Webhooks:

35.123.45.67
35.123.45.68
35.123.45.69

Troubleshooting

Email não chegando?

  1. Verifique spam/lixeira
  2. Confirme o email em Settings > Email
  3. Whitelist noreply@claudescheduler.com
  4. Teste envio em Settings > Notifications > Test Email

WhatsApp não conecta?

  1. Escaneie QR Code novamente
  2. Verifique sessão em Settings > WhatsApp
  3. Número correto (incluir código do país: +55)

Webhook falhando?

  1. Verifique URL (deve ser HTTPS)
  2. Teste manualmente com curl:
curl -X POST https://your-webhook.com \
  -H "Content-Type: application/json" \
  -d '{"test": true}'
  1. Veja logs em Webhooks > Delivery Logs
  2. Retry manual em Webhooks > Failed Deliveries

Limites por Plano

CanalFreeProBusiness
Email50/mêsIlimitadoIlimitado
WhatsApp-100/mêsIlimitado
Webhooks100/mês10,000/mêsIlimitado
SMS--50/mês
DigestSemanalDiárioHourly

Recursos Relacionados


Próximo Passo: Configure suas primeiras notificações em Settings > Notifications!