{
  "id": "Dj30tB9fIDgZhHm0",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Send Daily Real Estate Construction Updates to Buyers",
  "tags": [],
  "nodes": [
    {
      "id": "1ee0759b-7485-41cb-acdb-bda40a17f3e5",
      "name": "Daily Trigger (8:00 AM IST)",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -2040,
        60
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 8
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "640457a6-f3d3-492b-b9ca-7c3d8d0b34f8",
      "name": "Set Google Sheet Config",
      "type": "n8n-nodes-base.set",
      "position": [
        -1820,
        60
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "4669b111-8540-4de2-a5f7-672f2ad81e98",
              "name": "Sheet_ID",
              "type": "string",
              "value": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"
            },
            {
              "id": "58c89ccb-2e3d-4334-9366-d0b285fdfbd8",
              "name": "Sheet_Name",
              "type": "string",
              "value": "Construction_Reports"
            },
            {
              "id": "1a2b3c4d-5e6f-7g8h-9i0j-k1l2m3n4o5p6",
              "name": "Today_Date",
              "type": "string",
              "value": "={{ $now.format('DD/MM/YYYY') }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "a90e3dc3-fdcd-4d27-b1d1-02943146ad02",
      "name": "Read Google Sheet Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1600,
        60
      ],
      "parameters": {
        "options": {},
        "sheetName": "={{ $('Set Google Sheet Config').item.json.Sheet_Name }}",
        "documentId": "={{ $('Set Google Sheet Config').item.json.Sheet_ID }}"
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "2a48679b-71b1-4479-8080-f3e16dc3498a",
      "name": "Filter Today's Reports",
      "type": "n8n-nodes-base.filter",
      "position": [
        -1380,
        60
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "7h8i9j0k-1l2m-3n4o-5p6q-r7s8t9u0v1w2",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.Date }}",
              "rightValue": "={{ $('Set Google Sheet Config').item.json.Today_Date }}"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "9f461a8c-2971-44a9-bbbf-b64b9a02ea60",
      "name": "Check If Reports Found",
      "type": "n8n-nodes-base.if",
      "position": [
        -1160,
        60
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "2x3y4z5a-6b7c-8d9e-0f1g-h2i3j4k5l6m7",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $runIndex }}",
              "rightValue": "0"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "18c77930-ada3-43a7-9835-54a1c6fbd8c2",
      "name": "Set Notification Recipients",
      "type": "n8n-nodes-base.set",
      "position": [
        -940,
        60
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0b0969ab-45d1-427c-bac0-bd59a43661d7",
              "name": "Notification_Users",
              "type": "string",
              "value": "user@example.com,user@example.com,user@example.com"
            },
            {
              "id": "4d5e6f7g-8h9i-0j1k-2l3m-n4o5p6q7r8s9",
              "name": "WhatsApp_Numbers",
              "type": "string",
              "value": "+1234567890,+1234567890,+1234567890"
            },
            {
              "id": "9t0u1v2w-3x4y-5z6a-7b8c-d9e0f1g2h3i4",
              "name": "Admin_Email",
              "type": "string",
              "value": "user@example.com"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "01ee5331-df8e-4fe1-9156-d1c6258b33c8",
      "name": "Create Notification Content",
      "type": "n8n-nodes-base.set",
      "position": [
        -720,
        60
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ad95bad5-c4ac-4864-a83c-06d59d99b415",
              "name": "Report_Summary",
              "type": "string",
              "value": "=\ud83d\udccb **CONSTRUCTION REPORTS SUMMARY - {{ $('Set Google Sheet Config').item.json.Today_Date }}**\n\n{{ $('Filter Today\\'s Reports').all().map(item => `\ud83c\udfd7\ufe0f **${item.json.Project_Name}**\n\ud83d\udc77 Contractor: ${item.json.Contractor_Name}\n\ud83d\udccd Location: ${item.json.Location}\n\ud83d\udcca Progress: ${item.json.Progress_Percentage}%\n\u26a1 Status: ${item.json.Status}\n\ud83d\udcdd Today's Work: ${item.json.Work_Description}\n\ud83d\udea7 Issues: ${item.json.Issues || 'None reported'}\n\ud83d\udcb0 Budget Status: ${item.json.Budget_Status}\n\ud83d\udcc5 Next Milestone: ${item.json.Next_Milestone}\n\n---\n`).join('') }}\n\n\ud83d\udcca Total Projects Updated: {{ $('Filter Today\\'s Reports').all().length }}\n\u23f0 Report Generated: {{ $now.format('DD/MM/YYYY HH:mm:ss') }}"
            },
            {
              "id": "5j6k7l8m-9n0o-1p2q-3r4s-t5u6v7w8x9y0",
              "name": "Email_Subject",
              "type": "string",
              "value": "\ud83c\udfd7\ufe0f Daily Construction Reports - {{ $('Set Google Sheet Config').item.json.Today_Date }} ({{ $('Filter Today\\'s Reports').all().length }} Projects Updated)"
            },
            {
              "id": "0z1a2b3c-4d5e-6f7g-8h9i-j0k1l2m3n4o5",
              "name": "WhatsApp_Message",
              "type": "string",
              "value": "=\ud83c\udfd7\ufe0f *Daily Construction Update*\n\ud83d\udcc5 {{ $('Set Google Sheet Config').item.json.Today_Date }}\n\n\ud83d\udcca *{{ $('Filter Today\\'s Reports').all().length }} Projects Updated Today*\n\n{{ $('Filter Today\\'s Reports').all().map(item => `\ud83d\udd38 *${item.json.Project_Name}*\n   Progress: ${item.json.Progress_Percentage}%\n   Status: ${item.json.Status}\n   Contractor: ${item.json.Contractor_Name}\n\n`).join('') }}For detailed reports, check your email.\n\n_Auto-generated from Construction Reports Sheet_"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "8fe62b99-7e70-4ae0-9ecf-fa5cd5338f10",
      "name": "Send WhatsApp Notification",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        -500,
        160
      ],
      "parameters": {
        "textBody": "={{ $('Create Notification Content').item.json.WhatsApp_Message }}",
        "operation": "send",
        "phoneNumberId": "=+919876543210",
        "additionalFields": {},
        "recipientPhoneNumber": "+1234567890"
      },
      "credentials": {
        "whatsAppApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9576da40-cab9-4a20-b3bb-332696306e30",
      "name": "Send Email Notification",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        -500,
        -40
      ],
      "parameters": {
        "text": "={{ $('Create Notification Content').item.json.Report_Summary }}",
        "options": {},
        "subject": "={{ $('Create Notification Content').item.json.Email_Subject }}",
        "toEmail": "={{ $('Set Notification Recipients').item.json.Notification_Users }}",
        "fromEmail": "user@example.com",
        "emailFormat": "text"
      },
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "47dc08b6-d4b8-4380-af14-81732c6cf598",
      "name": "Log Successful Notifications",
      "type": "n8n-nodes-base.set",
      "position": [
        -280,
        60
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "6p7q8r9s-0t1u-2v3w-4x5y-z6a7b8c9d0e1",
              "name": "Success_Log",
              "type": "string",
              "value": "{{ $now.format('DD/MM/YYYY HH:mm:ss') }} - SUCCESS: Daily construction reports sent to {{ $('Set Notification Recipients').item.json.Notification_Users.split(',').length }} users via Email & WhatsApp. Reports found: {{ $('Filter Today\\'s Reports').all().length }} projects. Sheet: {{ $('Set Google Sheet Config').item.json.Sheet_Name }}"
            },
            {
              "id": "2f3g4h5i-6j7k-8l9m-0n1o-p2q3r4s5t6u7",
              "name": "Log_Status",
              "type": "string",
              "value": "COMPLETED"
            },
            {
              "id": "log-details-001",
              "name": "Projects_Reported",
              "type": "string",
              "value": "={{ $('Filter Today\\'s Reports').all().map(item => item.json.Project_Name).join(', ') }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "17c027f8-e22b-4169-9562-5e9e0c253344",
      "name": "Sticky Note - Trigger",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2080,
        -120
      ],
      "parameters": {
        "width": 180,
        "height": 340,
        "content": "Triggers every day at 8:00 AM IST to check Google Sheet for new construction reports from contractors."
      },
      "typeVersion": 1
    },
    {
      "id": "5675361f-8fc5-462b-9591-3b273e5937af",
      "name": "Sticky Note - Config",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1860,
        -120
      ],
      "parameters": {
        "color": 4,
        "width": 180,
        "height": 340,
        "content": "Configure Google Sheet ID, sheet name, and today's date for filtering the latest reports."
      },
      "typeVersion": 1
    },
    {
      "id": "27d8d7b0-7fa5-4c22-9921-168c46149118",
      "name": "Sticky Note - Read Sheet",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1640,
        -120
      ],
      "parameters": {
        "color": 3,
        "width": 180,
        "height": 340,
        "content": "Read all data from the Google Sheet containing contractor reports with project details, progress, and status."
      },
      "typeVersion": 1
    },
    {
      "id": "26908522-c63d-4dd8-b50c-459e2e04389c",
      "name": "Sticky Note - Filter",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1420,
        -120
      ],
      "parameters": {
        "color": 5,
        "width": 180,
        "height": 340,
        "content": "Filter the sheet records to get only today's reports based on the Date column."
      },
      "typeVersion": 1
    },
    {
      "id": "f8cb9405-eb82-4ebc-91c6-e1d332ba3717",
      "name": "Sticky Note - Check Reports",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1200,
        -120
      ],
      "parameters": {
        "width": 180,
        "height": 340,
        "content": "Check if any reports were found for today. If yes, send notifications. If no, send alert to admin."
      },
      "typeVersion": 1
    },
    {
      "id": "75105320-736f-4c7e-bbcb-8461f26aac49",
      "name": "Sticky Note - Contacts",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -980,
        -120
      ],
      "parameters": {
        "color": 4,
        "width": 180,
        "height": 340,
        "content": "Email and WhatsApp contact lists for users who should receive daily construction report notifications."
      },
      "typeVersion": 1
    },
    {
      "id": "5a93ee43-7991-434f-a0d1-da6950826479",
      "name": "Sticky Note - Send Notifications",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -540,
        -160
      ],
      "parameters": {
        "color": 3,
        "width": 180,
        "height": 500,
        "content": "Send detailed construction reports to all users via Email and WhatsApp with project summaries."
      },
      "typeVersion": 1
    },
    {
      "id": "d4bd125e-a980-479b-9ab2-e2ba7cb01753",
      "name": "Sticky Note - Logging",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        -120
      ],
      "parameters": {
        "color": 2,
        "width": 180,
        "height": 340,
        "content": "Log all notification activities with timestamps, recipient count, and project details for audit trail."
      },
      "typeVersion": 1
    },
    {
      "id": "d13a8eb1-946d-445a-a837-32a4be084e87",
      "name": "Sticky Note - Send Notifications1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -760,
        -120
      ],
      "parameters": {
        "color": 5,
        "width": 180,
        "height": 340,
        "content": "Create detailed construction reports."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "eadd981e-6c76-4e5d-81ae-864311a818d1",
  "connections": {
    "Check If Reports Found": {
      "main": [
        [
          {
            "node": "Set Notification Recipients",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Filter Today's Reports": {
      "main": [
        [
          {
            "node": "Check If Reports Found",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Google Sheet Data": {
      "main": [
        [
          {
            "node": "Filter Today's Reports",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Email Notification": {
      "main": [
        [
          {
            "node": "Log Successful Notifications",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Google Sheet Config": {
      "main": [
        [
          {
            "node": "Read Google Sheet Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send WhatsApp Notification": {
      "main": [
        [
          {
            "node": "Log Successful Notifications",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Notification Content": {
      "main": [
        [
          {
            "node": "Send WhatsApp Notification",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Email Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily Trigger (8:00 AM IST)": {
      "main": [
        [
          {
            "node": "Set Google Sheet Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Notification Recipients": {
      "main": [
        [
          {
            "node": "Create Notification Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}