This workflow follows the Execute Workflow Trigger → 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 →
{
"updatedAt": "2026-03-30T02:02:24.000Z",
"createdAt": "2026-03-28T15:03:55.502Z",
"id": "2Ct3D2Oha7nw5pVZ",
"name": "SUB_Hoy_Focus",
"description": null,
"active": true,
"isArchived": false,
"nodes": [
{
"parameters": {},
"id": "t_hf",
"name": "Execute Workflow Trigger",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
0,
0
]
},
{
"parameters": {
"dataType": "string",
"value1": "={{ $json.message.text }}",
"rules": {
"rules": [
{
"operation": "startsWith",
"value2": "/hoy"
},
{
"operation": "startsWith",
"value2": "/focus"
}
]
}
},
"id": "sw_hf",
"name": "Switch_Comando",
"type": "n8n-nodes-base.switch",
"position": [
200,
0
]
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT id, titulo, prioridad, tipo_tarea FROM core.tasks WHERE estado IN ('todo', 'in_progress') ORDER BY case prioridad when 'alta' then 1 when 'media' then 2 else 3 end ASC, created_at ASC LIMIT 3;"
},
"id": "db_h1",
"name": "Postgres_Hoy_Top",
"type": "n8n-nodes-base.postgres",
"position": [
500,
-150
]
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT id, titulo, prioridad, tipo_tarea FROM core.tasks WHERE estado IN ('todo', 'in_progress') ORDER BY case prioridad when 'alta' then 1 when 'media' then 2 else 3 end ASC, updated_at DESC LIMIT 1;"
},
"id": "db_f1",
"name": "Postgres_Focus",
"type": "n8n-nodes-base.postgres",
"position": [
500,
100
]
},
{
"parameters": {
"jsCode": "let text = '\u26a1 **TU FOCUS DE HOY**\\n\\n';\nif($input.all().length === 0) {\n text += 'No hay tareas activas en el sistema.';\n} else {\n let item = $input.all()[0];\n text += `\ud83c\udfaf **[#${item.json.id}] ${item.json.titulo}**\\n\ud83d\udd25 Prioridad: ` + \"`\" + item.json.prioridad + \"`\\n\" + `\u2699\ufe0f Tipo: ` + \"`\" + item.json.tipo_tarea + \"`\";\n}\nreturn { json: { text: text, task_id: $input.all().length > 0 ? $input.all()[0].json.id : null } };"
},
"id": "c_fc",
"name": "Formato_Focus",
"type": "n8n-nodes-base.code",
"position": [
700,
100
]
},
{
"parameters": {
"jsCode": "let text = '\ud83c\udf05 **PLANIFICACI\u00d3N DE HOY**\\n\\n\ud83d\udd25 Prioridad Alta:\\n';\nfor(let item of $input.all()) {\n text += `\ud83d\udd39 [#${item.json.id}] ${item.json.titulo}\\n`;\n}\ntext += '\\n*(Usa /focus para atacar la primera)*';\nreturn { json: { text: text } };"
},
"id": "c_hy",
"name": "Formato_Hoy",
"type": "n8n-nodes-base.code",
"position": [
700,
-150
]
},
{
"parameters": {
"chatId": "={{ $('Execute Workflow Trigger').item.json.message.chat.id }}",
"text": "={{ $json.text }}"
},
"id": "tg_hy",
"name": "Telegram_Send_Hoy",
"type": "n8n-nodes-base.telegram",
"position": [
900,
-150
],
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"chatId": "={{ $('Execute Workflow Trigger').item.json.message.chat.id }}",
"text": "={{ $json.text }}",
"replyMarkup": "={{ $json.task_id ? 'inlineKeyboard' : 'none' }}",
"inlineKeyboard": "={{ $json.task_id ? { rows: [ { row: { buttons: [ { text: '\u2705 Misi\u00f3n Cumplida', callback_data: 'done_task:' + $json.task_id } ] } } ] } : {} }}"
},
"id": "tg_fc",
"name": "Telegram_Send_Focus",
"type": "n8n-nodes-base.telegram",
"position": [
900,
100
],
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
}
],
"connections": {
"Execute Workflow Trigger": {
"main": [
[
{
"node": "Switch_Comando",
"type": "main",
"index": 0
}
]
]
},
"Switch_Comando": {
"main": [
[
{
"node": "Postgres_Hoy_Top",
"type": "main",
"index": 0
}
],
[
{
"node": "Postgres_Focus",
"type": "main",
"index": 0
}
]
]
},
"Postgres_Hoy_Top": {
"main": [
[
{
"node": "Formato_Hoy",
"type": "main",
"index": 0
}
]
]
},
"Formato_Hoy": {
"main": [
[
{
"node": "Telegram_Send_Hoy",
"type": "main",
"index": 0
}
]
]
},
"Postgres_Focus": {
"main": [
[
{
"node": "Formato_Focus",
"type": "main",
"index": 0
}
]
]
},
"Formato_Focus": {
"main": [
[
{
"node": "Telegram_Send_Focus",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {},
"staticData": null,
"meta": null,
"versionId": "e757a0e0-53a5-4d44-8031-6340dbe0734e",
"activeVersionId": "e757a0e0-53a5-4d44-8031-6340dbe0734e",
"versionCounter": 4,
"triggerCount": 0,
"shared": [
{
"updatedAt": "2026-03-30T01:57:36.006Z",
"createdAt": "2026-03-30T01:57:36.006Z",
"role": "workflow:owner",
"workflowId": "2Ct3D2Oha7nw5pVZ",
"projectId": "QaMRMGJEzY5PYBIg",
"project": {
"updatedAt": "2026-03-29T23:42:43.691Z",
"createdAt": "2026-03-29T23:42:43.691Z",
"id": "QaMRMGJEzY5PYBIg",
"name": "mario sanchez <mario@startidea.es>",
"type": "personal",
"icon": null,
"description": null,
"creatorId": "1f14cd28-5281-4da7-ad9f-65cbac0d8b14"
}
}
],
"tags": [],
"activeVersion": {
"updatedAt": "2026-03-29T23:42:44.155Z",
"createdAt": "2026-03-29T23:42:44.155Z",
"versionId": "e757a0e0-53a5-4d44-8031-6340dbe0734e",
"workflowId": "2Ct3D2Oha7nw5pVZ",
"nodes": [
{
"parameters": {},
"id": "t_hf",
"name": "Execute Workflow Trigger",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
0,
0
]
},
{
"parameters": {
"dataType": "string",
"value1": "={{ $json.message.text }}",
"rules": {
"rules": [
{
"operation": "startsWith",
"value2": "/hoy"
},
{
"operation": "startsWith",
"value2": "/focus"
}
]
}
},
"id": "sw_hf",
"name": "Switch_Comando",
"type": "n8n-nodes-base.switch",
"position": [
200,
0
]
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT id, titulo, prioridad, tipo_tarea FROM core.tasks WHERE estado IN ('todo', 'in_progress') ORDER BY case prioridad when 'alta' then 1 when 'media' then 2 else 3 end ASC, created_at ASC LIMIT 3;"
},
"id": "db_h1",
"name": "Postgres_Hoy_Top",
"type": "n8n-nodes-base.postgres",
"position": [
500,
-150
]
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT id, titulo, prioridad, tipo_tarea FROM core.tasks WHERE estado IN ('todo', 'in_progress') ORDER BY case prioridad when 'alta' then 1 when 'media' then 2 else 3 end ASC, updated_at DESC LIMIT 1;"
},
"id": "db_f1",
"name": "Postgres_Focus",
"type": "n8n-nodes-base.postgres",
"position": [
500,
100
]
},
{
"parameters": {
"jsCode": "let text = '\u26a1 **TU FOCUS DE HOY**\\n\\n';\nif($input.all().length === 0) {\n text += 'No hay tareas activas en el sistema.';\n} else {\n let item = $input.all()[0];\n text += `\ud83c\udfaf **[#${item.json.id}] ${item.json.titulo}**\\n\ud83d\udd25 Prioridad: ` + \"`\" + item.json.prioridad + \"`\\n\" + `\u2699\ufe0f Tipo: ` + \"`\" + item.json.tipo_tarea + \"`\";\n}\nreturn { json: { text: text, task_id: $input.all().length > 0 ? $input.all()[0].json.id : null } };"
},
"id": "c_fc",
"name": "Formato_Focus",
"type": "n8n-nodes-base.code",
"position": [
700,
100
]
},
{
"parameters": {
"jsCode": "let text = '\ud83c\udf05 **PLANIFICACI\u00d3N DE HOY**\\n\\n\ud83d\udd25 Prioridad Alta:\\n';\nfor(let item of $input.all()) {\n text += `\ud83d\udd39 [#${item.json.id}] ${item.json.titulo}\\n`;\n}\ntext += '\\n*(Usa /focus para atacar la primera)*';\nreturn { json: { text: text } };"
},
"id": "c_hy",
"name": "Formato_Hoy",
"type": "n8n-nodes-base.code",
"position": [
700,
-150
]
},
{
"parameters": {
"chatId": "={{ $('Execute Workflow Trigger').item.json.message.chat.id }}",
"text": "={{ $json.text }}"
},
"id": "tg_hy",
"name": "Telegram_Send_Hoy",
"type": "n8n-nodes-base.telegram",
"position": [
900,
-150
],
"credentials": {
"telegramApi": {
"id": "MU4yoPrZzzfRHbHb",
"name": "Telegram_Bot"
}
}
},
{
"parameters": {
"chatId": "={{ $('Execute Workflow Trigger').item.json.message.chat.id }}",
"text": "={{ $json.text }}",
"replyMarkup": "={{ $json.task_id ? 'inlineKeyboard' : 'none' }}",
"inlineKeyboard": "={{ $json.task_id ? { rows: [ { row: { buttons: [ { text: '\u2705 Misi\u00f3n Cumplida', callback_data: 'done_task:' + $json.task_id } ] } } ] } : {} }}"
},
"id": "tg_fc",
"name": "Telegram_Send_Focus",
"type": "n8n-nodes-base.telegram",
"position": [
900,
100
],
"credentials": {
"telegramApi": {
"id": "MU4yoPrZzzfRHbHb",
"name": "Telegram_Bot"
}
}
}
],
"connections": {
"Execute Workflow Trigger": {
"main": [
[
{
"node": "Switch_Comando",
"type": "main",
"index": 0
}
]
]
},
"Switch_Comando": {
"main": [
[
{
"node": "Postgres_Hoy_Top",
"type": "main",
"index": 0
}
],
[
{
"node": "Postgres_Focus",
"type": "main",
"index": 0
}
]
]
},
"Postgres_Hoy_Top": {
"main": [
[
{
"node": "Formato_Hoy",
"type": "main",
"index": 0
}
]
]
},
"Formato_Hoy": {
"main": [
[
{
"node": "Telegram_Send_Hoy",
"type": "main",
"index": 0
}
]
]
},
"Postgres_Focus": {
"main": [
[
{
"node": "Formato_Focus",
"type": "main",
"index": 0
}
]
]
},
"Formato_Focus": {
"main": [
[
{
"node": "Telegram_Send_Focus",
"type": "main",
"index": 0
}
]
]
}
},
"authors": "system migration",
"name": null,
"description": null,
"autosaved": false,
"workflowPublishHistory": [
{
"createdAt": "2026-03-28T15:03:55.502Z",
"id": 4,
"workflowId": "2Ct3D2Oha7nw5pVZ",
"versionId": "e757a0e0-53a5-4d44-8031-6340dbe0734e",
"event": "activated",
"userId": null
}
]
}
}
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.
telegramApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
SUB_Hoy_Focus. Uses executeWorkflowTrigger, postgres, telegram. Event-driven trigger; 8 nodes.
Source: https://github.com/mariopablobarron/startidea-os-backend/blob/80787cdaa267e6992cadd00c277352175fab0fa6/workflows/SUB_Hoy_Focus.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.
Pede Ai. Uses httpRequest, telegram, postgres, telegramTrigger. Event-driven trigger; 53 nodes.
News Digest Bot - Multi-User (Postgres). Uses telegramTrigger, postgres, telegram, rssFeedRead. Event-driven trigger; 45 nodes.
This workflow provides a complete solution for handling Telegram Stars payments, invoicing and refunds using n8n. It automates the process of sending invoices, managing pre-checkout approvals, recordi
VIVID v5.0 — Chapter Sub-workflow. Uses executeWorkflowTrigger, executeCommand, itemLists, httpRequest. Event-driven trigger; 21 nodes.
[HUB] Жора Action. Uses executeWorkflowTrigger, supabase, telegram, httpRequest. Event-driven trigger; 19 nodes.