{
  "id": "MoDcla5XtsTZBDyz",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Attendance Telegram App",
  "tags": [],
  "nodes": [
    {
      "id": "c4893eb0-6cfc-436a-9ebe-9871b0eceeae",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -128,
        128
      ],
      "parameters": {
        "updates": [
          "message",
          "callback_query"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "7ec13d8c-2d87-43a2-b38a-9e0a899bb3d0",
      "name": "IF /start|/menu",
      "type": "n8n-nodes-base.if",
      "position": [
        144,
        -384
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ String($json.message?.text || $json.channel_post?.text || '') }}",
              "value2": "^/(start|menu)$",
              "operation": "regex"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "85592562-59b7-4149-a61a-8a1d00ad78a6",
      "name": "Send Main Menu",
      "type": "n8n-nodes-base.telegram",
      "position": [
        352,
        -400
      ],
      "parameters": {
        "text": "Please select an option:",
        "chatId": "={{ $json.message?.chat?.id }}",
        "replyMarkup": "inlineKeyboard",
        "inlineKeyboard": {
          "rows": [
            {
              "row": {
                "buttons": [
                  {
                    "text": "\ud83d\udd58 Check In/Out",
                    "additionalFields": {
                      "callback_data": "menu_attendance"
                    }
                  }
                ]
              }
            },
            {
              "row": {
                "buttons": [
                  {
                    "text": "\ud83d\udcca Today\u2019s Attendance Status",
                    "additionalFields": {
                      "callback_data": "menu_attendance_status"
                    }
                  }
                ]
              }
            }
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e8fe7ee3-59fd-4e6d-aa6a-19c90a43142c",
      "name": "IF callback_query",
      "type": "n8n-nodes-base.if",
      "position": [
        80,
        848
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.callback_query?.data || '' }}",
              "value2": "checkin"
            },
            {
              "value1": "={{ $json.callback_query?.data || '' }}",
              "value2": "checkout"
            }
          ]
        },
        "combineOperation": "any"
      },
      "typeVersion": 1
    },
    {
      "id": "a85632f1-2460-45fd-9c0f-332b5097b156",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1088,
        208
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "a6d12c8c-a3b9-488b-bc92-0e925c8a8ed5",
      "name": "IF menu_attendance",
      "type": "n8n-nodes-base.if",
      "position": [
        128,
        -112
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.callback_query?.data || '' }}",
              "value2": "menu_attendance"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "adc378a0-64a8-4d86-ba95-b18c99db8144",
      "name": "Send Check In/Out Menu",
      "type": "n8n-nodes-base.telegram",
      "position": [
        352,
        -128
      ],
      "parameters": {
        "text": "Pilih absen:",
        "chatId": "={{ $json.callback_query.message.chat.id }}",
        "replyMarkup": "inlineKeyboard",
        "inlineKeyboard": {
          "rows": [
            {
              "row": {
                "buttons": [
                  {
                    "text": "\u2705 Check In",
                    "additionalFields": {
                      "callback_data": "checkin"
                    }
                  }
                ]
              }
            },
            {
              "row": {
                "buttons": [
                  {
                    "text": "\ud83d\udeaa Check Out",
                    "additionalFields": {
                      "callback_data": "checkout"
                    }
                  }
                ]
              }
            }
          ]
        },
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b775ffdd-9744-46f3-8d10-c99937521f06",
      "name": "Sheets Read (employee)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        320,
        288
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.callback_query.from.username }}",
              "lookupColumn": "username_telegram"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1137759692,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mzZiOjV587UqHGQddDIQVF_BF_awzc-akqqp2fyR6YI/edit#gid=1137759692",
          "cachedResultName": "Employee"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1mzZiOjV587UqHGQddDIQVF_BF_awzc-akqqp2fyR6YI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mzZiOjV587UqHGQddDIQVF_BF_awzc-akqqp2fyR6YI/edit?usp=drivesdk",
          "cachedResultName": "Attendance Telegram App"
        },
        "combineFilters": "AND"
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4,
      "alwaysOutputData": true
    },
    {
      "id": "d6172ee4-97c9-4ae7-8ae3-1883c333e6d9",
      "name": "Sheets Read (Attendance Status)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        784,
        208
      ],
      "parameters": {
        "options": {
          "returnAllMatches": "returnAllMatches"
        },
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.username_telegram }}",
              "lookupColumn": "username_telegram"
            },
            {
              "lookupValue": "={{ $today.format('dd-MM-yyyy') }}",
              "lookupColumn": "date"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mzZiOjV587UqHGQddDIQVF_BF_awzc-akqqp2fyR6YI/edit#gid=0",
          "cachedResultName": "Attendance"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1mzZiOjV587UqHGQddDIQVF_BF_awzc-akqqp2fyR6YI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mzZiOjV587UqHGQddDIQVF_BF_awzc-akqqp2fyR6YI/edit?usp=drivesdk",
          "cachedResultName": "Attendance Telegram App"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4,
      "alwaysOutputData": true
    },
    {
      "id": "af846aa9-25e6-4dc1-86d9-c00686aae0f5",
      "name": "IF employee",
      "type": "n8n-nodes-base.if",
      "position": [
        608,
        288
      ],
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ $json.isNotEmpty() }}",
              "value2": true
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "722b1cc7-847c-4fb2-b4ec-a4efa82f0fd6",
      "name": "Reply Attendance Status",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1520,
        208
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "chatId": "={{ $('IF menu_attendance_status').item.json.callback_query.message.chat.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a69a67a0-95bd-4005-b290-4c88c022774d",
      "name": "Format Attendance Status",
      "type": "n8n-nodes-base.functionItem",
      "position": [
        1312,
        208
      ],
      "parameters": {
        "functionCode": "const rows =  Array.isArray($json.data) ? $json.data : [];\nlet checkin = rows.some(r => (r.attendance_type||'')==='checkin');\nlet checkout = rows.some(r => (r.attendance_type||'')==='checkout');\nlet msg = 'Today\u2019s Attendance Status:\\n';\nmsg += `Check In: ${checkin ? '\u2705' : '\u274c'}\\n`;\nmsg += `Check Out: ${checkout ? '\u2705' : '\u274c'}`;\nreturn { text: msg};\n"
      },
      "typeVersion": 1,
      "alwaysOutputData": false
    },
    {
      "id": "0cfd3a1f-8f72-4b37-a5ae-df98a4b4a540",
      "name": "Reply Not Employee",
      "type": "n8n-nodes-base.telegram",
      "position": [
        784,
        400
      ],
      "parameters": {
        "text": "You are not listed as an employee. Contact the administrator.",
        "chatId": "={{ $('IF menu_attendance_status').item.json.callback_query.message.chat.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a390650a-8251-4080-a4a8-5cc5c0ea2b3f",
      "name": "Reply Not Employee1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        784,
        928
      ],
      "parameters": {
        "text": "You are not listed as an employee. Contact the administrator.",
        "chatId": "={{ $('IF callback_query').item.json.callback_query.message.chat.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6fe62d75-f959-43ef-a399-1c47311fbe3c",
      "name": "Sheets Read (duplicate attendance)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        784,
        752
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.username_telegram }}",
              "lookupColumn": "username_telegram"
            },
            {
              "lookupValue": "={{ $today.format('dd-MM-yyyy') }}",
              "lookupColumn": "username_telegram"
            },
            {
              "lookupValue": "={{ $('IF callback_query').item.json.callback_query.data }}",
              "lookupColumn": "attendance_type"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mzZiOjV587UqHGQddDIQVF_BF_awzc-akqqp2fyR6YI/edit#gid=0",
          "cachedResultName": "Attendance"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1mzZiOjV587UqHGQddDIQVF_BF_awzc-akqqp2fyR6YI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mzZiOjV587UqHGQddDIQVF_BF_awzc-akqqp2fyR6YI/edit?usp=drivesdk",
          "cachedResultName": "Attendance Telegram App"
        },
        "combineFilters": "AND"
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4,
      "alwaysOutputData": true
    },
    {
      "id": "df79d542-38c1-46a5-b059-13082dabd1d7",
      "name": "IF duplicate attendance",
      "type": "n8n-nodes-base.if",
      "position": [
        1120,
        752
      ],
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ !$json.isEmpty() }}",
              "value2": true
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e56e30a9-6a67-4b5a-898f-240b228fc5ac",
      "name": "Reply Duplicate Attendance",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1360,
        672
      ],
      "parameters": {
        "text": "=Your {{ $('IF callback_query').item.json.callback_query.data}} has already been recorded \u26a0\ufe0f",
        "chatId": "={{ $('IF callback_query').item.json.callback_query.message.chat.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2b497016-397c-48e3-a4a6-d2d1d5a05c9d",
      "name": "Reply Attendance OK",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1568,
        848
      ],
      "parameters": {
        "text": "={{ $('IF callback_query').item.json.callback_query.data === 'checkin' ? 'Check-in recorded. \u23f0' : 'Check-out recorded. \ud83c\udfc1' }}",
        "chatId": "={{ $('IF callback_query').item.json.callback_query.message.chat.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4f89f750-4c38-4da6-b228-c737eabf1bb7",
      "name": "Sheets Read (employee)1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        320,
        832
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $json.callback_query.from.username }}",
              "lookupColumn": "username_telegram"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1137759692,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mzZiOjV587UqHGQddDIQVF_BF_awzc-akqqp2fyR6YI/edit#gid=1137759692",
          "cachedResultName": "Employee"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1mzZiOjV587UqHGQddDIQVF_BF_awzc-akqqp2fyR6YI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mzZiOjV587UqHGQddDIQVF_BF_awzc-akqqp2fyR6YI/edit?usp=drivesdk",
          "cachedResultName": "Attendance Telegram App"
        },
        "combineFilters": "AND"
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4,
      "alwaysOutputData": true
    },
    {
      "id": "0d3cd98d-fb7e-4fe5-9d78-1136fd6aca9b",
      "name": "IF menu_attendance_status",
      "type": "n8n-nodes-base.if",
      "position": [
        96,
        304
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.callback_query?.data || '' }}",
              "value2": "menu_attendance_status"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "814855bc-59d0-4313-b3fe-a5e43c44ab8d",
      "name": "IF Employee",
      "type": "n8n-nodes-base.if",
      "position": [
        560,
        832
      ],
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ $json.isNotEmpty() }}",
              "value2": true
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6f762fa7-4aaf-4a98-83c8-e125bea57716",
      "name": "Sheets Append (Attendance)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1344,
        848
      ],
      "parameters": {
        "columns": {
          "value": {
            "date": "={{ $today.format('dd-MM-yyyy') }}",
            "time": "={{ $now.format('HH:mm:ss') }}",
            "timestamp_iso": "={{ $now }}",
            "attendance_type": "={{ $('IF callback_query').item.json.callback_query.data }}"
          },
          "schema": [
            {
              "id": "timestamp_iso",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "timestamp_iso",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "time",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "id_employee",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "id_employee",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "username_telegram",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "username_telegram",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "full_name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "full_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "attendance_type",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "attendance_type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mzZiOjV587UqHGQddDIQVF_BF_awzc-akqqp2fyR6YI/edit#gid=0",
          "cachedResultName": "Attendance"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1mzZiOjV587UqHGQddDIQVF_BF_awzc-akqqp2fyR6YI",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1mzZiOjV587UqHGQddDIQVF_BF_awzc-akqqp2fyR6YI/edit?usp=drivesdk",
          "cachedResultName": "Attendance Telegram App"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4
    },
    {
      "id": "fceace8c-057d-4e49-b48b-83924e8beed0",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        -320
      ],
      "parameters": {
        "width": 672,
        "height": 1856,
        "content": "# Attendance Telegram App with Google Sheets\n\nManage employee attendance directly through **Telegram** with seamless **Google Sheets** integration.  \nEmployees can check in, check out, and view their daily attendance status from a Telegram bot.  \nAll records are stored in Google Sheets for easy tracking and reporting.\n\n\ud83d\udc49 Includes a **Google Sheets template** to get started quickly.\n\n---\n\n## \u2728 Features\n- \ud83d\udd58 **Check-in & Check-out** via Telegram bot  \n- \ud83d\udcca **View daily attendance status** (Check-in/Check-out done or not)  \n- \ud83d\udd12 **Employee validation** \u2013 only registered employees can log attendance  \n- \u26a0\ufe0f **Duplicate prevention** \u2013 prevents multiple check-ins/outs on the same day  \n- \ud83d\udcc2 **Google Sheets integration** \u2013 easy to manage, export, and share data  \n\n---\n\n## \ud83d\udee0 Requirements\n- [n8n](https://n8n.io/) (Cloud or Self-hosted)  \n- A Telegram Bot (create via **BotFather**)  \n- Google Sheets account  \n\n---\n\n## \ud83d\ude80 Setup Instructions\n\n### 1. Import Workflow\n1. Download and import `Attendance Telegram App.json` into n8n.  \n2. Configure your **Telegram API credentials**.  \n3. Configure your **Google Sheets credentials**.  \n\n### 2. Use Provided Google Sheets Template\nWe provide a template with two sheets:  \n- **Employee** \u2192 List of registered employees (`id_employee`, `full_name`, `username_telegram`)  \n- **Attendance** \u2192 Attendance logs (`date`, `time`, `attendance_type`, etc.)  \n\n\ud83d\udc49 [Copy the Google Sheets Template](https://docs.google.com/spreadsheets/d/1miqc4zpTecMwk_qNHgM17na2rDsWNpICIblKy44hwnw/edit?usp=sharing)\n\nUpdate the **Employee sheet** with your employee data before running the workflow.\n\n### 3. Configure Telegram Bot\n1. Create a bot with **BotFather** on Telegram.  \n2. Copy the **API token**.  \n3. Add it into n8n\u2019s **Telegram credentials**.  \n\n### 4. Run the Workflow\n- Start the workflow.  \n- Open your Telegram bot and type `/start` or `/menu`.  \n- Available options:  \n  - \u2705 **Check-in** (\u23f0)  \n  - \ud83d\udeaa **Check-out** (\ud83c\udfc1)  \n  - \ud83d\udcca **View Today\u2019s Attendance Status**  \n\n---\n\n## \ud83d\udccb Example Flow\n1. User types `/menu` in Telegram.  \n2. Bot displays menu with **Check-in/Check-out** and **Today\u2019s Attendance Status**.  \n3. If user taps **Check-in**:  \n   - Workflow validates if they are a registered employee.  \n   - Checks if attendance already exists for today.  \n   - If valid \u2192 record in Google Sheets.  \n   - Bot replies: *\u201cCheck-in recorded. \u23f0\u201d*  \n\n---"
      },
      "typeVersion": 1
    },
    {
      "id": "4f6c09c6-25de-4095-9c2f-20d11395c34a",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        -480
      ],
      "parameters": {
        "color": 5,
        "width": 432,
        "height": 240,
        "content": "## Send Menu Button"
      },
      "typeVersion": 1
    },
    {
      "id": "8917f9a0-180c-4ca5-aa44-1e665388aa06",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        -192
      ],
      "parameters": {
        "color": 5,
        "width": 432,
        "height": 224,
        "content": "## Send Check In/Out Button"
      },
      "typeVersion": 1
    },
    {
      "id": "f294e910-e5fd-4771-8ea5-8101db950346",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        224
      ],
      "parameters": {
        "color": 3,
        "width": 416,
        "height": 272,
        "content": "## Check Today\u2019s Attendance Status"
      },
      "typeVersion": 1
    },
    {
      "id": "c88b7d72-cf69-4ade-ae5c-575ea1ce0525",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        736
      ],
      "parameters": {
        "color": 3,
        "width": 432,
        "height": 320,
        "content": "## Check In/Out"
      },
      "typeVersion": 1
    },
    {
      "id": "c074958e-4acd-4d08-a5b6-8a1d939a9e95",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        656
      ],
      "parameters": {
        "color": 2,
        "width": 496,
        "height": 480,
        "content": "## Verify Employee"
      },
      "typeVersion": 1
    },
    {
      "id": "eab6e6aa-3392-40d5-aafe-05ac4b751844",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        128
      ],
      "parameters": {
        "color": 2,
        "width": 496,
        "height": 480,
        "content": "## Verify Employee"
      },
      "typeVersion": 1
    },
    {
      "id": "adac4563-c652-4e0b-9ab8-148d3c302b67",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1072,
        528
      ],
      "parameters": {
        "width": 656,
        "height": 528,
        "content": "## Check for Duplicate Attendance\n\u2705 If TRUE \u2192 Reply via Telegram: \u201cYour check-in/check-out has already been recorded \u26a0\ufe0f\u201d\n\n\u274c If FALSE \u2192 Append a new row into the Attendance sheet, then reply via Telegram:\n\n\u201cCheck-in recorded. \u23f0\u201d\n\n\u201cCheck-out recorded. \ud83c\udfc1\u201d\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e0330191-b7ac-44d0-9ad3-ee5655873324",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1072,
        64
      ],
      "parameters": {
        "width": 672,
        "height": 432,
        "content": "## Format & Send Today's Attendance Status"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "e9cbf4b2-6992-483f-a5ae-f574f763feae",
  "connections": {
    "Aggregate": {
      "main": [
        [
          {
            "node": "Format Attendance Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF Employee": {
      "main": [
        [
          {
            "node": "Sheets Read (duplicate attendance)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Reply Not Employee1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF employee": {
      "main": [
        [
          {
            "node": "Sheets Read (Attendance Status)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Reply Not Employee",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF /start|/menu": {
      "main": [
        [
          {
            "node": "Send Main Menu",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "IF /start|/menu",
            "type": "main",
            "index": 0
          },
          {
            "node": "IF menu_attendance",
            "type": "main",
            "index": 0
          },
          {
            "node": "IF menu_attendance_status",
            "type": "main",
            "index": 0
          },
          {
            "node": "IF callback_query",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF callback_query": {
      "main": [
        [
          {
            "node": "Sheets Read (employee)1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF menu_attendance": {
      "main": [
        [
          {
            "node": "Send Check In/Out Menu",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sheets Read (employee)": {
      "main": [
        [
          {
            "node": "IF employee",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF duplicate attendance": {
      "main": [
        [
          {
            "node": "Reply Duplicate Attendance",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Sheets Append (Attendance)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sheets Read (employee)1": {
      "main": [
        [
          {
            "node": "IF Employee",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Attendance Status": {
      "main": [
        [
          {
            "node": "Reply Attendance Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF menu_attendance_status": {
      "main": [
        [
          {
            "node": "Sheets Read (employee)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sheets Append (Attendance)": {
      "main": [
        [
          {
            "node": "Reply Attendance OK",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sheets Read (Attendance Status)": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sheets Read (duplicate attendance)": {
      "main": [
        [
          {
            "node": "IF duplicate attendance",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}