The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "Relat\u00f3rio Di\u00e1rio Autom\u00e1tico",
"nodes": [
{
"id": "f6a7b8c9-0006-0006-0006-000000000001",
"name": "Todo dia \u00e0s 8h",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [
240,
300
],
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 8 * * 1-5"
}
]
}
}
},
{
"id": "f6a7b8c9-0006-0006-0006-000000000002",
"name": "Buscar M\u00e9tricas do Dia",
"type": "n8n-nodes-base.mySql",
"typeVersion": 2.4,
"position": [
460,
300
],
"parameters": {
"operation": "executeQuery",
"query": "SELECT\n COUNT(*) as total_pedidos,\n SUM(CASE WHEN status = 'concluido' THEN 1 ELSE 0 END) as pedidos_concluidos,\n SUM(CASE WHEN status = 'cancelado' THEN 1 ELSE 0 END) as pedidos_cancelados,\n SUM(CASE WHEN status = 'pendente' THEN 1 ELSE 0 END) as pedidos_pendentes,\n COALESCE(SUM(valor_total), 0) as receita_total,\n COUNT(DISTINCT cliente_id) as clientes_ativos\nFROM pedidos\nWHERE DATE(criado_em) = DATE(NOW() - INTERVAL 1 DAY);",
"options": {}
},
"credentials": {
"mySql": {
"name": "<your credential>"
}
}
},
{
"id": "f6a7b8c9-0006-0006-0006-000000000003",
"name": "Formatar Relat\u00f3rio HTML",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
680,
300
],
"parameters": {
"jsCode": "const dados = $input.first().json;\nconst ontem = new Date();\nontem.setDate(ontem.getDate() - 1);\nconst dataFormatada = ontem.toLocaleDateString('pt-BR');\n\nconst taxaConclusao = dados.total_pedidos > 0\n ? ((dados.pedidos_concluidos / dados.total_pedidos) * 100).toFixed(1)\n : 0;\n\nconst receitaFormatada = new Intl.NumberFormat('pt-BR', {\n style: 'currency',\n currency: 'BRL'\n}).format(dados.receita_total || 0);\n\nconst html = `\n<h2>Relat\u00f3rio Di\u00e1rio \u2014 ${dataFormatada}</h2>\n<table border=\"1\" cellpadding=\"8\" style=\"border-collapse:collapse;\">\n <tr><th>M\u00e9trica</th><th>Valor</th></tr>\n <tr><td>Total de Pedidos</td><td><strong>${dados.total_pedidos}</strong></td></tr>\n <tr><td>Conclu\u00eddos</td><td style=\"color:green\">${dados.pedidos_concluidos}</td></tr>\n <tr><td>Cancelados</td><td style=\"color:red\">${dados.pedidos_cancelados}</td></tr>\n <tr><td>Pendentes</td><td style=\"color:orange\">${dados.pedidos_pendentes}</td></tr>\n <tr><td>Taxa de Conclus\u00e3o</td><td>${taxaConclusao}%</td></tr>\n <tr><td>Receita Total</td><td><strong>${receitaFormatada}</strong></td></tr>\n <tr><td>Clientes Ativos</td><td>${dados.clientes_ativos}</td></tr>\n</table>\n`;\n\nreturn [{ json: { ...dados, html_relatorio: html, data_referencia: dataFormatada } }];"
}
},
{
"id": "f6a7b8c9-0006-0006-0006-000000000004",
"name": "Enviar Relat\u00f3rio por Email",
"type": "n8n-nodes-base.emailSend",
"typeVersion": 2.1,
"position": [
900,
300
],
"parameters": {
"fromEmail": "relatorios@seudominio.com",
"toEmail": "gestao@seudominio.com",
"subject": "Relat\u00f3rio Di\u00e1rio \u2014 {{ $json.data_referencia }}",
"emailFormat": "html",
"message": "={{ $json.html_relatorio }}",
"options": {}
},
"credentials": {
"smtp": {
"name": "<your credential>"
}
}
}
],
"connections": {
"Todo dia \u00e0s 8h": {
"main": [
[
{
"node": "Buscar M\u00e9tricas do Dia",
"type": "main",
"index": 0
}
]
]
},
"Buscar M\u00e9tricas do Dia": {
"main": [
[
{
"node": "Formatar Relat\u00f3rio HTML",
"type": "main",
"index": 0
}
]
]
},
"Formatar Relat\u00f3rio HTML": {
"main": [
[
{
"node": "Enviar Relat\u00f3rio por Email",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"id": "f6a7b8c9-0006-0006-0006-000000000000",
"meta": {
"templateCredsSetupCompleted": false
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
mySqlsmtp
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Relatório Diário Automático. Uses mySql, emailSend. Scheduled trigger; 4 nodes.
Source: https://github.com/Rubens-Marques/n8n-flows-library/blob/9226ec20cf7443ed2dad5c84e0f1d5f36651cfd1/flows/notificacoes/daily-report/flow.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
MainWorkflow. Uses httpRequest, mySql, emailSend. Scheduled trigger; 8 nodes.
Mail Associazioni. Uses mySql, emailSend. Scheduled trigger; 7 nodes.
Disparador 1.8. Uses itemLists, postgres, emailSend, httpRequest. Scheduled trigger; 85 nodes.
Actualizar asignaciones de operaciones en financing y loans. Uses googleSheets, itemLists, mySql. Scheduled trigger; 41 nodes.
This n8n workflow runs daily to analyze active customer behavior, engineers relevant features from usage and transaction data, applies a machine learning or AI-based model to predict churn probability