metaads-pro/docs/n8n/03-engine-alerts.json
2026-06-16 15:55:02 -03:00

63 lines
2.1 KiB
JSON

{
"name": "ADsPRO — Receber Alertas do Engine",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "adspro-alertas",
"responseMode": "onReceived",
"options": {}
},
"id": "webhook-alerts",
"name": "Webhook (N8N_WEBHOOK_URL)",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [240, 300],
"webhookId": "adspro-alertas"
},
{
"parameters": {
"jsCode": "const out = [];\nfor (const item of $input.all()) {\n const p = item.json.body || item.json;\n let message = '';\n if (p.type === 'daily_summary') {\n message = '📊 Resumo do dia — Festa Magica\\n💸 Gasto: R$' + p.spend + '\\n🛒 Compras: ' + p.purchases + '\\n🎯 CPA: R$' + p.cpa + '\\n📈 ROAS: ' + p.roas + '\\n👆 CTR: ' + p.ctr + '%';\n } else if (p.type === 'automation_run') {\n const acts = (p.actions || []).map(function (a) { return (a.executed ? '✅ EXECUTOU' : '⚠️ RECOMENDA') + ': ' + a.action + ' — ' + a.campaign + ' (' + a.rule + ')'; }).join('\\n');\n message = '🤖 Engine rodou (modo ' + p.mode + ')\\n' + (acts || 'Nada disparou.');\n } else {\n message = JSON.stringify(p);\n }\n out.push({ json: { message: message, payload: p } });\n}\nreturn out;"
},
"id": "code-format",
"name": "Formatar mensagem",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [480, 300]
},
{
"parameters": {},
"id": "noop-channel",
"name": "Enviar (conecte seu canal aqui)",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [720, 300]
}
],
"connections": {
"Webhook (N8N_WEBHOOK_URL)": {
"main": [
[
{
"node": "Formatar mensagem",
"type": "main",
"index": 0
}
]
]
},
"Formatar mensagem": {
"main": [
[
{
"node": "Enviar (conecte seu canal aqui)",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {},
"active": false
}