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": "SP \u00b7 06 \u00b7 Revisi\u00f3n Ortodoncia 6 meses",
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 9 * * *"
}
]
}
},
"id": "sp06-0001",
"name": "Cron \u00b7 Diario 9:00h",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [
240,
300
]
},
{
"parameters": {
"jsCode": "const now = new Date();\nconst d6m = new Date(now); d6m.setDate(now.getDate() - 180);\nconst fmt = d => parseInt(`${d.getFullYear()}${String(d.getMonth()+1).padStart(2,'0')}${String(d.getDate()).padStart(2,'0')}`);\nreturn [{ json: { fecha: fmt(d6m), rango: 3 } }];"
},
"id": "sp06-0002",
"name": "Calcular hace 180 d\u00edas",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
460,
300
]
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT p.\"IdPac\", p.\"Nombre\", p.\"Apellidos\",\n COALESCE(NULLIF(p.\"TelMovil\",''), p.\"Tel1\") AS telefono\nFROM \"Pacientes\" p\nWHERE p.\"IdPac\" IN (\n SELECT DISTINCT c.\"IdPac\" FROM \"DCitas\" c\n WHERE c.\"Texto\" ILIKE '%ortodoncia%' AND c.\"IdSitC\" = 5\n AND c.\"Fecha\" BETWEEN {{ $json.fecha }} - {{ $json.rango }} AND {{ $json.fecha }} + {{ $json.rango }}\n)\nAND p.\"IdPac\" NOT IN (\n SELECT DISTINCT c2.\"IdPac\" FROM \"DCitas\" c2\n WHERE c2.\"Fecha\" > {{ $json.fecha }} AND c2.\"IdSitC\" NOT IN (3)\n)\nAND COALESCE(NULLIF(p.\"TelMovil\",''), p.\"Tel1\") IS NOT NULL\nAND (p.\"AceptaWhatsApp\" = true OR p.\"AceptaWhatsApp\" IS NULL)\nLIMIT 50",
"additionalFields": {}
},
"id": "sp06-0003",
"name": "BD \u00b7 Pacientes ortodoncia 6m",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.4,
"position": [
680,
300
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "const i = $input.item.json;\nconst msg = `\ud83e\uddb7 Hola ${i.Nombre}, han pasado 6 meses desde que terminaste tu ortodoncia.\\n\\n\u00a1Revisemos que tu sonrisa sigue perfecta! \u00bfTe paso opciones de cita?`;\nreturn [{ json: { ...i, mensaje: msg } }];"
},
"id": "sp06-0004",
"name": "Preparar mensaje 6m",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
900,
300
]
},
{
"parameters": {
"method": "POST",
"url": "={{ $vars.EVOLUTION_URL }}/message/sendText/{{ $vars.EVOLUTION_INSTANCE }}",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "apikey",
"value": "={{ $vars.EVOLUTION_API_KEY }}"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"number\": \"34{{ $json.telefono.replace(/[^0-9]/g,'').replace(/^34/,'') }}@s.whatsapp.net\",\n \"text\": \"{{ $json.mensaje }}\"\n}"
},
"id": "sp06-0005",
"name": "WhatsApp \u00b7 Revisi\u00f3n 6m",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4,
"position": [
1120,
300
]
}
],
"connections": {
"Cron \u00b7 Diario 9:00h": {
"main": [
[
{
"node": "Calcular hace 180 d\u00edas",
"type": "main",
"index": 0
}
]
]
},
"Calcular hace 180 d\u00edas": {
"main": [
[
{
"node": "BD \u00b7 Pacientes ortodoncia 6m",
"type": "main",
"index": 0
}
]
]
},
"BD \u00b7 Pacientes ortodoncia 6m": {
"main": [
[
{
"node": "Preparar mensaje 6m",
"type": "main",
"index": 0
}
]
]
},
"Preparar mensaje 6m": {
"main": [
[
{
"node": "WhatsApp \u00b7 Revisi\u00f3n 6m",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"id": "sp-ortho-6m-006"
}
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.
postgres
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
SP · 06 · Revisión Ortodoncia 6 meses. Uses postgres, httpRequest. Scheduled trigger; 5 nodes.
Source: https://github.com/Manzanedodelgado/SmilePro-Studio/blob/7a67a0777c43ab52ee492a48d0c1616b905b49a2/n8n-workflows/06-rem-ortho-6m.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.
This workflow automates the complete end-to-end processing of daily revenue transactions for finance and accounting teams. It systematically retrieves, validates, and standardizes transaction data fro
This automated n8n workflow continuously monitors airline schedule changes by fetching real-time flight data, comparing it with stored schedules, and instantly notifying both internal teams and affect
Monthly Energy Generation Report (Postgres → PDF → Email). Uses httpRequest, gmail, postgres. Scheduled trigger; 7 nodes.
SP · 05 · Revisión Ortodoncia 2 meses. Uses postgres, httpRequest. Scheduled trigger; 5 nodes.
YOUR_ID 4. Uses gmail, googleDrive, googleSheets, httpRequest. Scheduled trigger; 53 nodes.