{
  "name": "Automated daily financial analysis from Loyverse POS with Google Sheets & email",
  "nodes": [
    {
      "id": "8ccf3480-8a71-41af-bef2-2a3e8e84778a",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -240,
        -400
      ]
    },
    {
      "id": "b1406a9b-d6e9-4a0d-8f6d-0f7d3ee7170a",
      "name": "Read Historical Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        976,
        -176
      ]
    },
    {
      "id": "909cfa2e-7e99-44e7-ab44-60d461f11754",
      "name": "Calculate All Metrics",
      "type": "n8n-nodes-base.code",
      "position": [
        1232,
        -176
      ]
    },
    {
      "id": "9a04bbb6-1e5b-4c23-a7f6-810cfda646a9",
      "name": "Get all products from Loyverse",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        16,
        -176
      ]
    },
    {
      "id": "01f719aa-f043-4db0-866c-d8125802f0e3",
      "name": "Format Product Data",
      "type": "n8n-nodes-base.code",
      "position": [
        240,
        -176
      ]
    },
    {
      "id": "31c1d0ca-bca2-44c8-ae22-2915fcef54d0",
      "name": "Calculate Shift Time",
      "type": "n8n-nodes-base.code",
      "position": [
        672,
        -656
      ]
    },
    {
      "id": "90a4e282-7492-4149-b663-123e7ece77c6",
      "name": "Get Yesterday's Shifts From Loyverse",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        912,
        -656
      ]
    },
    {
      "id": "5b7c50f6-6ff7-4e45-968e-33019fcd028c",
      "name": "Get Yesterday's Receipts From Loyverse",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1120,
        -656
      ]
    },
    {
      "id": "111f10b7-9c40-443e-9538-4e53e45cc66f",
      "name": "Send email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1616,
        -672
      ]
    },
    {
      "id": "14920d77-308a-47d6-b4f9-655aa481e463",
      "name": "Run Daily at 8:15AM (open to change)",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -256,
        -176
      ]
    },
    {
      "id": "9392d0e5-7026-4fbf-87b5-f5dcdea522ce",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -768
      ],
      "parameters": {
        "width": 672,
        "height": 448,
        "content": "# SETUP STEP 2/4\n## 1. Make a copy of this Spreadsheet: https://docs.google.com/spreadsheets/d/1DlEUo3mQUaxn2HEp34m7VAath8L3RDuPy5zFCljSZHE/edit?usp=sharing\n## 2. Open the MASTER CONFIG node below and"
      }
    },
    {
      "id": "c0ab3a86-0c8b-4eba-a61d-a0d3259b031d",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        -288
      ],
      "parameters": {
        "width": 432,
        "height": 352,
        "content": "## Get Product Data from Loyverse\nNo Changes required here!"
      }
    },
    {
      "id": "68cf2659-c189-4f66-9a41-5a67bba0c9ad",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        608,
        -768
      ],
      "parameters": {
        "width": 720,
        "height": 336,
        "content": "## Get Sales Data From Last Shift\nNo Changes required here! (Change the Shift Start and End in Config Node!)\n"
      }
    },
    {
      "id": "4b58e0e9-28e6-4f25-9965-dbd38ba55b5c",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1152,
        -288
      ],
      "parameters": {
        "width": 336,
        "height": 288,
        "content": "## Calculate Metrics"
      }
    },
    {
      "id": "254bcd80-2c52-423f-af74-fa3b775c213a",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1552,
        -768
      ],
      "parameters": {
        "width": 320,
        "height": 288,
        "content": "## Send Report"
      }
    },
    {
      "id": "100afc44-ecaa-4991-a7e7-24f3b562b64e",
      "name": "MASTER CONFIG",
      "type": "n8n-nodes-base.code",
      "position": [
        -48,
        -496
      ]
    },
    {
      "id": "7ff826f4-67b5-49e8-8d23-afb50f3e334a",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1552,
        -288
      ],
      "parameters": {
        "width": 704,
        "height": 640,
        "content": "# SETUP STEP 4/4\n\n## Open the \"Save latest sales data\" node below and select the \"LoyverseDataTool\" Spreadsheet from the list in document section.\n\n## In the sheet section, paste the following code:\n#"
      }
    },
    {
      "id": "3886f3ba-fc8d-46f8-88f0-34008afbb2fa",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -512,
        -768
      ],
      "parameters": {
        "width": 384,
        "height": 320,
        "content": "# SETUP STEP 1/4\n\n## Create credentials for…\n\n1. Loyverse: Create an API token in Loyverse under “Integrations” - “Access Tokens”. Then create Loyverse credentials in N8N: (“Generic / “Bearer Auth”, s"
      }
    },
    {
      "id": "34351ea1-a172-458a-9baf-7b7ace54ad93",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        432,
        -288
      ],
      "parameters": {
        "width": 688,
        "height": 688,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# Setup Step 3/4\n### After the MASTER CONFIG is filled out (!) open the \"Save Product List\" node and select \"From List\" in the \"Document\" section. You can then select the \"Loyverse"
      }
    },
    {
      "id": "966a6c35-a12c-4b1b-acd4-2da989107732",
      "name": "Save Product List",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        528,
        -176
      ]
    },
    {
      "id": "cef55f5a-579d-4d39-9141-f130f751e64d",
      "name": "Save Latest Sales Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1616,
        176
      ]
    }
  ],
  "connections": {
    "Send email": {
      "main": [
        []
      ]
    },
    "MASTER CONFIG": {
      "main": [
        [
          {
            "node": "Get all products from Loyverse",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Product List": {
      "main": [
        [
          {
            "node": "Calculate Shift Time",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Product Data": {
      "main": [
        [
          {
            "node": "Save Product List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Shift Time": {
      "main": [
        [
          {
            "node": "Get Yesterday's Shifts From Loyverse",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Historical Data": {
      "main": [
        [
          {
            "node": "Calculate All Metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate All Metrics": {
      "main": [
        [
          {
            "node": "Send email",
            "type": "main",
            "index": 0
          },
          {
            "node": "Save Latest Sales Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Latest Sales Data": {
      "main": [
        []
      ]
    },
    "Get all products from Loyverse": {
      "main": [
        [
          {
            "node": "Format Product Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Yesterday's Shifts From Loyverse": {
      "main": [
        [
          {
            "node": "Get Yesterday's Receipts From Loyverse",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Daily at 8:15AM (open to change)": {
      "main": [
        [
          {
            "node": "Get all products from Loyverse",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "MASTER CONFIG",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Yesterday's Receipts From Loyverse": {
      "main": [
        [
          {
            "node": "Read Historical Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}