AutomationFlowsData & Sheets › Logyca Daily Sales Summary

Logyca Daily Sales Summary

Logyca_Daily_Sales_Summary. Uses postgres. Scheduled trigger; 6 nodes.

Cron / scheduled trigger★★★★☆ complexity6 nodesPostgres
Data & Sheets Trigger: Cron / scheduled Nodes: 6 Complexity: ★★★★☆ Added:

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 →

Download .json
{
  "name": "Logyca_Daily_Sales_Summary",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 1 * * *"
            }
          ]
        }
      },
      "id": "7f9e1a2b-3c4d-5e6f-7a8b-9c0d1e2f3a4b",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "SELECT COUNT(*) AS pending_count FROM jobs WHERE status IN ('PENDING', 'PROCESSING') AND created_at >= CURRENT_DATE - INTERVAL '1 day';"
      },
      "id": "3a4b5c6d-7e8f-9a0b-1c2d-3e4f5a6b7c8d",
      "name": "Check_Pending_Jobs",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 1,
      "position": [
        500,
        300
      ],
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{ $json.pending_count }}",
              "operation": "equal",
              "value2": 0
            }
          ]
        }
      },
      "id": "4b5c6d7e-8f9a-0b1c-2d3e-4f5a6b7c8d9e",
      "name": "Gate_If_No_Pending",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        750,
        300
      ]
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "INSERT INTO sales_daily_summary (summary_date, total_sales_count, total_revenue)\nSELECT \n    sale_date, \n    COUNT(*) as total_sales_count, \n    SUM(total) as total_revenue\nFROM sales\nWHERE sale_date = CURRENT_DATE - INTERVAL '1 day'\nGROUP BY sale_date\nON CONFLICT (summary_date) \nDO UPDATE SET \n    total_sales_count = EXCLUDED.total_sales_count,\n    total_revenue = EXCLUDED.total_revenue,\n    processed_at = NOW()\nRETURNING summary_date, total_sales_count, total_revenue;"
      },
      "id": "1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
      "name": "Postgres_Aggregation",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 1,
      "position": [
        1000,
        200
      ],
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "content": "### \u26a0\ufe0f Jobs Pendientes Detectados\nSe detectaron jobs PENDING o PROCESSING del d\u00eda anterior.\nEl resumen NO fue generado para evitar datos incompletos.\n**pending_count:** {{ $json.pending_count }}"
      },
      "id": "5c6d7e8f-9a0b-1c2d-3e4f-5a6b7c8d9e0f",
      "name": "Log_Skip",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1000,
        400
      ]
    },
    {
      "parameters": {
        "content": "### \u2705 Resumen de Ventas Generado\n**Fecha:** {{ $json.summary_date }}\n**Registros:** {{ $json.total_sales_count }}\n**Total Revenue:** ${{ $json.total_revenue }}"
      },
      "id": "2b3c4d5e-6f7a-8b9c-0d1e-2f3a4b5c6d7e",
      "name": "Log_Success",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1250,
        200
      ]
    }
  ],
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Check_Pending_Jobs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check_Pending_Jobs": {
      "main": [
        [
          {
            "node": "Gate_If_No_Pending",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gate_If_No_Pending": {
      "main": [
        [
          {
            "node": "Postgres_Aggregation",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log_Skip",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Postgres_Aggregation": {
      "main": [
        [
          {
            "node": "Log_Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "hash": "abc123def456"
}

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.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Logyca_Daily_Sales_Summary. Uses postgres. Scheduled trigger; 6 nodes.

Source: https://github.com/Saug72/logyca_platform/blob/9f0c567a07118bc3bba1a880ff446e15b4c9d134/n8n/workflow.json — original creator credit. Request a take-down →

More Data & Sheets workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Data & Sheets

Disparador 1.8. Uses itemLists, postgres, emailSend, httpRequest. Scheduled trigger; 85 nodes.

Item Lists, Postgres, Email Send +1
Data & Sheets

공유회_알림톡_크론. Uses postgres, httpRequest, n8n-nodes-solapi. Scheduled trigger; 39 nodes.

Postgres, HTTP Request, N8N Nodes Solapi
Data & Sheets

QuepasaAutomatic. Uses postgres, postgresTrigger, httpRequest. Scheduled trigger; 39 nodes.

Postgres, Postgres Trigger, HTTP Request
Data & Sheets

QuepasaAutomatic. Uses postgres, postgresTrigger, httpRequest. Scheduled trigger; 39 nodes.

Postgres, Postgres Trigger, HTTP Request
Data & Sheets

QuepasaAutomatic. Uses postgres, postgresTrigger, httpRequest. Scheduled trigger; 39 nodes.

Postgres, Postgres Trigger, HTTP Request