This workflow follows the HTTP Request → Postgres recipe pattern — see all workflows that pair these two integrations.
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": "Celebre - Monitor SLA Tarefas",
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 */6 * * *"
}
]
}
},
"id": "cron-every-6h",
"name": "Cron Every 6 Hours",
"type": "n8n-nodes-base.cron",
"typeVersion": 1,
"position": [
250,
300
]
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT t.id, t.title, t.status, t.\"dueAt\", t.\"slaHours\", t.\"assignedTo\", e.id as \"eventId\", e.title as \"eventTitle\", e.hosts FROM \"Task\" t JOIN \"Event\" e ON t.\"eventId\" = e.id WHERE t.status IN ('aberta', 'em_andamento') AND t.\"dueAt\" IS NOT NULL AND t.\"dueAt\" < NOW() + INTERVAL '8 hours'"
},
"id": "get-urgent-tasks",
"name": "Get Urgent Tasks",
"type": "n8n-nodes-base.postgres",
"typeVersion": 1,
"position": [
450,
300
]
},
{
"parameters": {
"functionCode": "const tasks = items.map(item => item.json);\nconst alerts = [];\n\nfor (const task of tasks) {\n const dueAt = new Date(task.dueAt);\n const now = new Date();\n const hoursRemaining = (dueAt - now) / (1000 * 60 * 60);\n \n let severity = 'warning';\n let emoji = '\u26a0\ufe0f';\n let message = '';\n\n if (hoursRemaining < 0) {\n severity = 'critical';\n emoji = '\ud83d\udea8';\n message = `${emoji} *TAREFA ATRASADA*\\n\\nEvento: ${task.eventTitle}\\nTarefa: *${task.title}*\\nStatus: ${task.status}\\nPrazo: ${dueAt.toLocaleString('pt-BR')}\\nAtraso: ${Math.abs(Math.round(hoursRemaining))} horas`;\n } else if (hoursRemaining < 8) {\n emoji = '\u23f0';\n message = `${emoji} *TAREFA URGENTE*\\n\\nEvento: ${task.eventTitle}\\nTarefa: *${task.title}*\\nStatus: ${task.status}\\nPrazo: ${dueAt.toLocaleString('pt-BR')}\\nTempo restante: ${Math.round(hoursRemaining)} horas`;\n }\n\n if (message && task.hosts && task.hosts.length > 0) {\n // Send to all event hosts\n task.hosts.forEach(phone => {\n alerts.push({\n to: phone,\n taskId: task.id,\n eventId: task.eventId,\n severity,\n message\n });\n });\n }\n}\n\nreturn alerts.map(a => ({ json: a }));",
"options": {}
},
"id": "format-alerts",
"name": "Format SLA Alerts",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
650,
300
]
},
{
"parameters": {
"conditions": {
"number": [
{
"value1": "={{ $items().length }}",
"operation": "larger",
"value2": 0
}
]
}
},
"id": "check-has-alerts",
"name": "Has Alerts?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
850,
300
]
},
{
"parameters": {
"authentication": "headerAuth",
"requestMethod": "POST",
"url": "https://graph.facebook.com/v17.0/{{ $env.WHATSAPP_PHONE_ID }}/messages",
"jsonParameters": true,
"bodyParametersJson": "={\n \"messaging_product\": \"whatsapp\",\n \"to\": \"{{ $json.to }}\",\n \"type\": \"text\",\n \"text\": {\n \"body\": \"{{ $json.message }}\"\n }\n}",
"options": {}
},
"id": "send-alert",
"name": "Send Alert",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 3,
"position": [
1050,
250
],
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "INSERT INTO \"EventLog\" (id, \"eventId\", type, \"payloadJson\", \"occurredAt\") VALUES (gen_random_uuid(), $1, 'sla_alert', json_build_object('taskId', $2, 'severity', $3), NOW())",
"additionalFields": {
"queryParameters": "={{ $json.eventId }},={{ $json.taskId }},={{ $json.severity }}"
}
},
"id": "log-alert",
"name": "Log SLA Alert",
"type": "n8n-nodes-base.postgres",
"typeVersion": 1,
"position": [
1250,
250
]
}
],
"connections": {
"Cron Every 6 Hours": {
"main": [
[
{
"node": "Get Urgent Tasks",
"type": "main",
"index": 0
}
]
]
},
"Get Urgent Tasks": {
"main": [
[
{
"node": "Format SLA Alerts",
"type": "main",
"index": 0
}
]
]
},
"Format SLA Alerts": {
"main": [
[
{
"node": "Has Alerts?",
"type": "main",
"index": 0
}
]
]
},
"Has Alerts?": {
"main": [
[
{
"node": "Send Alert",
"type": "main",
"index": 0
}
]
]
},
"Send Alert": {
"main": [
[
{
"node": "Log SLA Alert",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"staticData": null,
"tags": [],
"triggerCount": 0,
"updatedAt": "2025-09-29T00:00:00.000Z",
"versionId": "1"
}
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.
httpHeaderAuth
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Celebre - Monitor SLA Tarefas. Uses postgres, httpRequest. Scheduled trigger; 6 nodes.
Source: https://github.com/josehenriquerds/celebra-mvp/blob/c9489b181bda0c56bc5ceb4482c1b444c4157e96/n8n-workflows/sla-tarefas.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.
Disparador 1.8. Uses itemLists, postgres, emailSend, httpRequest. Scheduled trigger; 85 nodes.
공유회_알림톡_크론. Uses postgres, httpRequest, n8n-nodes-solapi. Scheduled trigger; 39 nodes.
QuepasaAutomatic. Uses postgres, postgresTrigger, httpRequest. Scheduled trigger; 39 nodes.
QuepasaAutomatic. Uses postgres, postgresTrigger, httpRequest. Scheduled trigger; 39 nodes.
QuepasaAutomatic. Uses postgres, postgresTrigger, httpRequest. Scheduled trigger; 39 nodes.