DISCORD_SEND_MESSAGE - Enviar Mensagem de Texto no Discord
O que é este Node?
O DISCORD_SEND_MESSAGE é o node responsável por enviar mensagens de texto simples para canais do Discord usando webhooks ou bot token.
Por que este Node existe?
Integrar o Discord aos seus flows permite notificações em tempo real, alertas de sistema, comunicação com equipes e automações colaborativas. O DISCORD_SEND_MESSAGE existe para:
- Notificações Instantâneas: Enviar alertas e notificações para equipes no Discord
- Automação de Comunicação: Postar mensagens automáticas em canais específicos
- Integrações de Bots: Criar bots personalizados que respondem a eventos do flow
- Monitoramento: Enviar logs, status de sistemas e métricas para canais de monitoring
Como funciona internamente?
Quando o DISCORD_SEND_MESSAGE é executado, o sistema:
- Valida Autenticação: Verifica se webhook URL ou bot token + channel ID estão corretos
- Valida Conteúdo: Garante que a mensagem possui conteúdo válido
- Prepara Payload: Monta o JSON com content, username, avatar, TTS e flags
- Escolhe Método: Usa POST no webhook URL ou na API do Discord com bot token
- Se Webhook: Envia via
POST https://discord.com/api/webhooks/ID/TOKEN - Se Bot: Envia via
POST https://discord.com/api/v10/channels/{channelId}/messages - Retorna Resposta: Devolve dados da mensagem criada incluindo message ID
Código interno (discord-executor.service.ts:273-300):
private async sendMessage(data: DiscordNodeData): Promise<any> {
const payload: any = {
content: data.content,
tts: data.tts || false,
flags: data.suppressEmbeds ? 1 << 2 : 0
};
if (data.authType === 'webhook') {
if (data.username) payload.username = data.username;
if (data.avatarUrl) payload.avatar_url = data.avatarUrl;
if (data.threadId) payload.thread_id = data.threadId;
const response: AxiosResponse = await axios.post(data.webhookUrl!, payload);
return response.data;
} else {
const response: AxiosResponse = await axios.post(
`${this.DISCORD_API_BASE}/channels/${data.channelId}/messages`,
payload,
{
headers: {
'Authorization': `Bot ${data.botToken}`,
'Content-Type': 'application/json'
}
}
);
return response.data;
}
}
Quando você DEVE usar este Node?
Use DISCORD_SEND_MESSAGE sempre que precisar de envio de mensagens de texto simples para o Discord:
Casos de uso
- Alertas de Sistema: "Enviar notificação quando erro crítico ocorrer no backend"
- Status de Pedidos: "Notificar equipe de vendas quando novo pedido for criado"
- Logs de Automação: "Postar resumo diário de tarefas executadas no canal de logs"
- Boas-vindas: "Enviar mensagem de boas-vindas quando novo membro entrar no servidor"
- Monitoramento: "Alertar quando métrica ultrapassar threshold"
Quando NÃO usar DISCORD_SEND_MESSAGE
- Mensagens Formatadas: Use
DISCORD_SEND_EMBEDpara mensagens com formatação rica, cores e campos estruturados - Envio de Arquivos: Use
DISCORD_SEND_FILEpara enviar imagens, PDFs ou documentos - Editar Mensagens: Use
DISCORD_EDIT_MESSAGEpara modificar mensagens existentes - Deletar Mensagens: Use
DISCORD_DELETE_MESSAGEpara remover mensagens
Parâmetros Detalhados
authType (string, obrigatório)
O que é: Define o método de autenticação: webhook (mais simples, sem bot) ou bot (mais controle, requer bot token).
Valores possíveis: "webhook" ou "bot"
Flow completo para testar - Webhook:
{
"name": "Teste Discord Send Message - Webhook",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "discord_1",
"type": "discord",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Enviar Discord",
"parameters": {
"operation": "send_message",
"authType": "webhook",
"webhookUrl": "https://discord.com/api/webhooks/SEU_WEBHOOK_ID/SEU_WEBHOOK_TOKEN",
"content": "Olá do Lumina Flow Builder! ✨"
}
}
},
{
"id": "message_1",
"type": "message",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Confirmar",
"parameters": {
"message": "Mensagem enviada com sucesso! ✅"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 700, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "discord_1" },
{ "source": "discord_1", "target": "message_1" },
{ "source": "message_1", "target": "end_1" }
]
}
Teste: Substitua SEU_WEBHOOK_ID e SEU_WEBHOOK_TOKEN pelos valores reais do seu webhook Discord. Execute o flow e verifique se a mensagem aparece no canal.
Flow completo para testar - Bot:
{
"name": "Teste Discord Send Message - Bot",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "discord_1",
"type": "discord",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Enviar Discord Bot",
"parameters": {
"operation": "send_message",
"authType": "bot",
"botToken": "SEU_BOT_TOKEN",
"channelId": "SEU_CHANNEL_ID",
"content": "Mensagem enviada via Bot Token! 🤖"
}
}
},
{
"id": "message_1",
"type": "message",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Confirmar",
"parameters": {
"message": "Bot enviou a mensagem! ✅"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 700, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "discord_1" },
{ "source": "discord_1", "target": "message_1" },
{ "source": "message_1", "target": "end_1" }
]
}
Teste: Configure seu bot token e channel ID. O bot precisa ter permissão Send Messages no canal.
webhookUrl (string, obrigatório se authType = "webhook")
O que é: URL completa do webhook do Discord. Obtida em Configurações do Canal → Integrações → Webhooks.
Formato: https://discord.com/api/webhooks/{webhook_id}/{webhook_token}
Flow completo para testar:
{
"name": "Teste Discord - Webhook URL",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "variable_1",
"type": "variable",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Definir Webhook",
"parameters": {
"name": "webhookUrl",
"value": "https://discord.com/api/webhooks/123456789/abcdefghijklmnop"
}
}
},
{
"id": "discord_1",
"type": "discord",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Enviar via Webhook",
"parameters": {
"operation": "send_message",
"authType": "webhook",
"webhookUrl": "{{webhookUrl}}",
"content": "Webhook configurado com sucesso!"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 700, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "variable_1" },
{ "source": "variable_1", "target": "discord_1" },
{ "source": "discord_1", "target": "end_1" }
]
}
Teste: Substitua o webhook URL pela URL real do seu webhook Discord.
botToken (string, obrigatório se authType = "bot")
O que é: Token de autenticação do bot Discord. Obtido no Discord Developer Portal.
Formato: MTE... (token completo do bot)
Flow completo para testar:
{
"name": "Teste Discord - Bot Token",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "variable_1",
"type": "variable",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Definir Credenciais",
"parameters": {
"name": "botToken",
"value": "SEU_BOT_TOKEN_AQUI"
}
}
},
{
"id": "variable_2",
"type": "variable",
"position": { "x": 300, "y": 200 },
"data": {
"label": "Definir Canal",
"parameters": {
"name": "channelId",
"value": "123456789012345678"
}
}
},
{
"id": "discord_1",
"type": "discord",
"position": { "x": 500, "y": 150 },
"data": {
"label": "Enviar via Bot",
"parameters": {
"operation": "send_message",
"authType": "bot",
"botToken": "{{botToken}}",
"channelId": "{{channelId}}",
"content": "Bot autenticado e funcionando! 🎉"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 700, "y": 150 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "variable_1" },
{ "source": "variable_1", "target": "variable_2" },
{ "source": "variable_2", "target": "discord_1" },
{ "source": "discord_1", "target": "end_1" }
]
}
Teste: Substitua com seu bot token real. Nunca compartilhe o token publicamente.
channelId (string, obrigatório se authType = "bot")
O que é: ID numérico do canal Discord onde a mensagem será enviada. Obtido habilitando Modo Desenvolvedor e clicando com botão direito no canal.
Formato: "123456789012345678" (18 dígitos)
Flow completo para testar:
{
"name": "Teste Discord - Channel ID",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "discord_1",
"type": "discord",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Enviar para Canal",
"parameters": {
"operation": "send_message",
"authType": "bot",
"botToken": "SEU_BOT_TOKEN",
"channelId": "987654321098765432",
"content": "Mensagem enviada para o canal correto! 📢"
}
}
},
{
"id": "message_1",
"type": "message",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Sucesso",
"parameters": {
"message": "Canal ID configurado corretamente!"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 700, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "discord_1" },
{ "source": "discord_1", "target": "message_1" },
{ "source": "message_1", "target": "end_1" }
]
}
Teste: Obtenha o channel ID: Discord → Configurações → Avançado → Modo Desenvolvedor (ON) → Botão direito no canal → Copiar ID.
content (string, obrigatório)
O que é: Texto da mensagem a ser enviada. Suporta markdown do Discord e variáveis do flow.
Limite: 2000 caracteres
Flow completo para testar:
{
"name": "Teste Discord - Content",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "input_1",
"type": "input",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Digite seu nome",
"parameters": {
"message": "Qual é o seu nome?",
"variableName": "userName"
}
}
},
{
"id": "discord_1",
"type": "discord",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Enviar Saudação",
"parameters": {
"operation": "send_message",
"authType": "webhook",
"webhookUrl": "https://discord.com/api/webhooks/SEU_WEBHOOK",
"content": "**Olá {{userName}}!** 👋\n\nBem-vindo ao nosso servidor!\n\n*Mensagem gerada automaticamente pelo Lumina Flow Builder*"
}
}
},
{
"id": "message_1",
"type": "message",
"position": { "x": 700, "y": 100 },
"data": {
"label": "Confirmar",
"parameters": {
"message": "Saudação enviada para {{userName}}!"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 900, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "input_1" },
{ "source": "input_1", "target": "discord_1" },
{ "source": "discord_1", "target": "message_1" },
{ "source": "message_1", "target": "end_1" }
]
}
Teste: Digite seu nome quando solicitado. A mensagem no Discord deve conter seu nome e formatação markdown (negrito, itálico).
username (string, opcional - apenas webhook)
O que é: Nome customizado que aparecerá como remetente da mensagem. Só funciona com webhooks.
Padrão: Nome do webhook configurado no Discord
Flow completo para testar:
{
"name": "Teste Discord - Username",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "discord_1",
"type": "discord",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Enviar com Username",
"parameters": {
"operation": "send_message",
"authType": "webhook",
"webhookUrl": "https://discord.com/api/webhooks/SEU_WEBHOOK",
"content": "Esta mensagem tem um remetente customizado!",
"username": "Sistema de Alertas 🚨"
}
}
},
{
"id": "message_1",
"type": "message",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Confirmar",
"parameters": {
"message": "Mensagem enviada com username customizado!"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 700, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "discord_1" },
{ "source": "discord_1", "target": "message_1" },
{ "source": "message_1", "target": "end_1" }
]
}
Teste: A mensagem no Discord deve aparecer como enviada por "Sistema de Alertas 🚨" ao invés do nome padrão do webhook.
avatarUrl (string, opcional - apenas webhook)
O que é: URL da imagem que será usada como avatar do remetente. Só funciona com webhooks.
Formato: URL válida de imagem (PNG, JPG, GIF)
Flow completo para testar:
{
"name": "Teste Discord - Avatar URL",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "discord_1",
"type": "discord",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Enviar com Avatar",
"parameters": {
"operation": "send_message",
"authType": "webhook",
"webhookUrl": "https://discord.com/api/webhooks/SEU_WEBHOOK",
"content": "Mensagem com avatar customizado!",
"username": "Bot Lumina",
"avatarUrl": "https://i.imgur.com/AfFp7pu.png"
}
}
},
{
"id": "message_1",
"type": "message",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Confirmar",
"parameters": {
"message": "Avatar customizado aplicado! ✅"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 700, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "discord_1" },
{ "source": "discord_1", "target": "message_1" },
{ "source": "message_1", "target": "end_1" }
]
}
Teste: A mensagem no Discord deve mostrar o avatar customizado especificado na URL.
tts (boolean, opcional)
O que é: Ativa Text-To-Speech (leitura em voz alta da mensagem no Discord).
Padrão: false
Flow completo para testar:
{
"name": "Teste Discord - TTS",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "discord_1",
"type": "discord",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Enviar com TTS",
"parameters": {
"operation": "send_message",
"authType": "webhook",
"webhookUrl": "https://discord.com/api/webhooks/SEU_WEBHOOK",
"content": "Esta mensagem será lida em voz alta!",
"tts": true
}
}
},
{
"id": "message_1",
"type": "message",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Confirmar",
"parameters": {
"message": "Mensagem TTS enviada! 🔊"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 700, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "discord_1" },
{ "source": "discord_1", "target": "message_1" },
{ "source": "message_1", "target": "end_1" }
]
}
Teste: Usuários com Discord aberto e TTS habilitado ouvirão a mensagem sendo lida em voz alta.
suppressEmbeds (boolean, opcional)
O que é: Suprime a pré-visualização automática de links na mensagem.
Padrão: false
Flow completo para testar:
{
"name": "Teste Discord - Suppress Embeds",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "discord_1",
"type": "discord",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Enviar sem Preview",
"parameters": {
"operation": "send_message",
"authType": "webhook",
"webhookUrl": "https://discord.com/api/webhooks/SEU_WEBHOOK",
"content": "Confira este link: https://lumina.app.br\n\nA pré-visualização foi suprimida.",
"suppressEmbeds": true
}
}
},
{
"id": "message_1",
"type": "message",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Confirmar",
"parameters": {
"message": "Link enviado sem preview! 🔗"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 700, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "discord_1" },
{ "source": "discord_1", "target": "message_1" },
{ "source": "message_1", "target": "end_1" }
]
}
Teste: O link aparecerá como texto simples sem card de preview.
threadId (string, opcional - apenas webhook)
O que é: ID da thread onde a mensagem será enviada. Usado para responder em threads específicas.
Formato: "123456789012345678" (18 dígitos)
Flow completo para testar:
{
"name": "Teste Discord - Thread ID",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "discord_1",
"type": "discord",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Enviar para Thread",
"parameters": {
"operation": "send_message",
"authType": "webhook",
"webhookUrl": "https://discord.com/api/webhooks/SEU_WEBHOOK",
"content": "Mensagem enviada diretamente para a thread!",
"threadId": "123456789012345678"
}
}
},
{
"id": "message_1",
"type": "message",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Confirmar",
"parameters": {
"message": "Mensagem enviada para thread específica! 🧵"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 700, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "discord_1" },
{ "source": "discord_1", "target": "message_1" },
{ "source": "message_1", "target": "end_1" }
]
}
Teste: A mensagem aparecerá dentro da thread especificada, não no canal principal.
Parâmetros
| Campo | Tipo | Obrigatório | Descrição |
|---|---|---|---|
| operation | string | Sim | Deve ser "send_message" |
| authType | string | Sim | Tipo de autenticação: "webhook" ou "bot" |
| webhookUrl | string | Sim (webhook) | URL completa do webhook Discord |
| botToken | string | Sim (bot) | Token de autenticação do bot |
| channelId | string | Sim (bot) | ID do canal Discord |
| content | string | Sim | Texto da mensagem (máx. 2000 chars) |
| username | string | Não | Nome customizado do remetente (webhook only) |
| avatarUrl | string | Não | URL do avatar customizado (webhook only) |
| tts | boolean | Não | Ativar Text-To-Speech (padrão: false) |
| suppressEmbeds | boolean | Não | Suprimir preview de links (padrão: false) |
| threadId | string | Não | ID da thread para enviar (webhook only) |
Exemplo 1: Alerta de Pedido Novo
Objetivo: Notificar equipe de vendas quando um novo pedido for criado no sistema.
JSON para Importar
{
"name": "Alerta Discord - Novo Pedido",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "variable_1",
"type": "variable",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Dados do Pedido",
"parameters": {
"name": "pedidoId",
"value": "PED-2025-001"
}
}
},
{
"id": "variable_2",
"type": "variable",
"position": { "x": 300, "y": 200 },
"data": {
"label": "Cliente",
"parameters": {
"name": "cliente",
"value": "João Silva"
}
}
},
{
"id": "variable_3",
"type": "variable",
"position": { "x": 300, "y": 300 },
"data": {
"label": "Valor",
"parameters": {
"name": "valor",
"value": "R$ 1.250,00"
}
}
},
{
"id": "discord_1",
"type": "discord",
"position": { "x": 500, "y": 200 },
"data": {
"label": "Notificar Vendas",
"parameters": {
"operation": "send_message",
"authType": "webhook",
"webhookUrl": "https://discord.com/api/webhooks/SEU_WEBHOOK",
"content": "🛒 **NOVO PEDIDO RECEBIDO!**\n\n📦 Pedido: `{{pedidoId}}`\n👤 Cliente: **{{cliente}}**\n💰 Valor: **{{valor}}**\n\n⏰ Recebido em: <t:{{timestamp}}:F>",
"username": "Sistema de Vendas",
"avatarUrl": "https://i.imgur.com/cart-icon.png"
}
}
},
{
"id": "message_1",
"type": "message",
"position": { "x": 700, "y": 200 },
"data": {
"label": "Confirmar",
"parameters": {
"message": "✅ Equipe notificada sobre o pedido {{pedidoId}}!"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 900, "y": 200 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "variable_1" },
{ "source": "variable_1", "target": "variable_2" },
{ "source": "variable_2", "target": "variable_3" },
{ "source": "variable_3", "target": "discord_1" },
{ "source": "discord_1", "target": "message_1" },
{ "source": "message_1", "target": "end_1" }
]
}
Saída esperada no Discord:
🛒 NOVO PEDIDO RECEBIDO!
📦 Pedido: PED-2025-001
👤 Cliente: João Silva
💰 Valor: R$ 1.250,00
⏰ Recebido em: 15 de janeiro de 2025 às 14:30
Exemplo 2: Sistema de Monitoramento com Bot
Objetivo: Bot monitora métricas e envia alertas quando valores excedem threshold.
JSON para Importar
{
"name": "Discord Bot - Monitoramento",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "variable_1",
"type": "variable",
"position": { "x": 300, "y": 100 },
"data": {
"label": "CPU Usage",
"parameters": {
"name": "cpuUsage",
"value": "92"
}
}
},
{
"id": "variable_2",
"type": "variable",
"position": { "x": 300, "y": 200 },
"data": {
"label": "Servidor",
"parameters": {
"name": "servidor",
"value": "prod-server-01"
}
}
},
{
"id": "condition_1",
"type": "condition",
"position": { "x": 500, "y": 150 },
"data": {
"label": "CPU Alta?",
"parameters": {
"condition": "{{cpuUsage}} > 90"
}
}
},
{
"id": "discord_1",
"type": "discord",
"position": { "x": 700, "y": 100 },
"data": {
"label": "Alerta Crítico",
"parameters": {
"operation": "send_message",
"authType": "bot",
"botToken": "SEU_BOT_TOKEN",
"channelId": "ID_CANAL_ALERTAS",
"content": "🚨 **ALERTA CRÍTICO**\n\n⚠️ Servidor: `{{servidor}}`\n📊 CPU Usage: **{{cpuUsage}}%**\n🔥 Status: CRÍTICO\n\n**Ação requerida imediatamente!**"
}
}
},
{
"id": "message_1",
"type": "message",
"position": { "x": 900, "y": 100 },
"data": {
"label": "Alerta Enviado",
"parameters": {
"message": "Alerta crítico enviado para equipe de DevOps!"
}
}
},
{
"id": "message_2",
"type": "message",
"position": { "x": 700, "y": 200 },
"data": {
"label": "CPU Normal",
"parameters": {
"message": "CPU em níveis normais. Nenhum alerta necessário."
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 900, "y": 200 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "variable_1" },
{ "source": "variable_1", "target": "variable_2" },
{ "source": "variable_2", "target": "condition_1" },
{ "source": "condition_1", "target": "discord_1", "label": "true" },
{ "source": "discord_1", "target": "message_1" },
{ "source": "condition_1", "target": "message_2", "label": "false" },
{ "source": "message_1", "target": "end_1" },
{ "source": "message_2", "target": "end_1" }
]
}
Saída esperada no Discord (se CPU > 90%):
🚨 ALERTA CRÍTICO
⚠️ Servidor: prod-server-01
📊 CPU Usage: 92%
🔥 Status: CRÍTICO
**Ação requerida imediatamente!**
Exemplo 3: Notificação de Boas-Vindas Personalizada
Objetivo: Enviar mensagem de boas-vindas personalizada com informações do usuário.
JSON para Importar
{
"name": "Discord - Boas-Vindas Personalizada",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "input_1",
"type": "input",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Nome do Usuário",
"parameters": {
"message": "Qual é o seu nome?",
"variableName": "userName"
}
}
},
{
"id": "input_2",
"type": "input",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Interesse",
"parameters": {
"message": "Qual é o seu principal interesse?",
"variableName": "userInterest"
}
}
},
{
"id": "discord_1",
"type": "discord",
"position": { "x": 700, "y": 100 },
"data": {
"label": "Enviar Boas-Vindas",
"parameters": {
"operation": "send_message",
"authType": "webhook",
"webhookUrl": "https://discord.com/api/webhooks/SEU_WEBHOOK",
"content": "🎉 **BEM-VINDO {{userName}}!** 🎉\n\n👋 Olá! É um prazer ter você aqui!\n\n💡 Vejo que você se interessa por **{{userInterest}}**. Temos um canal dedicado a isso: <#123456789>\n\n📚 **Primeiros Passos:**\n• Leia as regras em <#regras>\n• Apresente-se em <#apresentacoes>\n• Tire dúvidas em <#suporte>\n\n✨ Aproveite sua estadia!",
"username": "Bot de Boas-Vindas",
"avatarUrl": "https://i.imgur.com/welcome-icon.png"
}
}
},
{
"id": "message_1",
"type": "message",
"position": { "x": 900, "y": 100 },
"data": {
"label": "Confirmar",
"parameters": {
"message": "Boas-vindas enviadas para {{userName}}! 🎊"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 1100, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "input_1" },
{ "source": "input_1", "target": "input_2" },
{ "source": "input_2", "target": "discord_1" },
{ "source": "discord_1", "target": "message_1" },
{ "source": "message_1", "target": "end_1" }
]
}
Saída esperada:
Sistema: Qual é o seu nome?
Usuário: Maria
Sistema: Qual é o seu principal interesse?
Usuário: Programação
[No Discord:]
🎉 BEM-VINDO Maria! 🎉
👋 Olá! É um prazer ter você aqui!
💡 Vejo que você se interessa por Programação. Temos um canal dedicado a isso: #programacao
📚 Primeiros Passos:
• Leia as regras em #regras
• Apresente-se em #apresentacoes
• Tire dúvidas em #suporte
✨ Aproveite sua estadia!
Resposta do Node
{
"id": "1234567890123456789",
"channel_id": "987654321098765432",
"author": {
"username": "Bot de Boas-Vindas",
"avatar": "abc123"
},
"content": "🎉 BEM-VINDO Maria! 🎉...",
"timestamp": "2025-01-15T14:30:00.000Z",
"edited_timestamp": null,
"tts": false,
"mention_everyone": false,
"mentions": [],
"attachments": [],
"embeds": [],
"type": 0
}
Boas Práticas
✅ SIM:
- Use webhooks para notificações simples (mais fácil de configurar)
- Use bot token quando precisar de controle total (editar, deletar mensagens)
- Valide o formato do webhook URL antes de usar
- Limite mensagens a 2000 caracteres (quebrar se necessário)
- Use markdown do Discord para formatação (negrito, itálico,
código) - Implemente rate limiting para evitar flood
- Armazene bot tokens em variáveis de ambiente
- Use TTS apenas para alertas críticos
- Adicione emojis para deixar mensagens mais visuais
- Use mention de canais com
<#channelId>
❌ NÃO:
- Não exponha bot tokens em código ou logs
- Não envie mensagens muito longas (use embed ou divida)
- Não abuse de TTS (incomoda usuários)
- Não envie spam (respeite rate limits do Discord)
- Não use webhook URL inválida sem validar
- Não tente editar/deletar mensagens com webhook (use bot)
- Não hardcode credenciais no flow
- Não ignore erros de autenticação
- Não use @everyone/@here desnecessariamente
Dicas
💡 Dica 1: Para obter webhook URL, vá em Configurações do Canal → Integrações → Webhooks → Criar Webhook. Copie a URL completa.
💡 Dica 2: Para mencionar usuários, use <@userId>. Para mencionar canais, use <#channelId>. Para roles, use <@&roleId>.
💡 Dica 3: Use timestamps do Discord com <t:unixTime:F> para exibir datas formatadas automaticamente no fuso do usuário.
💡 Dica 4: Combine com CONDITION node para enviar alertas apenas quando critérios forem atendidos.
💡 Dica 5: Use FORMATTER node para preparar mensagens longas antes de enviar ao Discord.
💡 Dica 6: Bot tokens começam com MTe, MTE, ODc, etc. Se não tiver esse formato, está incorreto.
💡 Dica 7: Rate limits do Discord: 5 mensagens por 5 segundos por canal (webhook), 50 mensagens por segundo (bot).
Próximo Node
→ DISCORD_SEND_EMBED - Enviar mensagens com formatação rica e campos estruturados → DISCORD_SEND_FILE - Enviar arquivos, imagens e documentos → DISCORD_EDIT_MESSAGE - Editar mensagens existentes → DISCORD_DELETE_MESSAGE - Deletar mensagens