{
  "id": "JQJJ4grDpEMqRBfa",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Automated Assignment Reminder & Deadline Tracker for Students and Teachers",
  "tags": [],
  "nodes": [
    {
      "id": "81408bba-7960-4776-ad5b-8cab6a1be7f4",
      "name": "Notion - Get Assignments",
      "type": "n8n-nodes-base.notion",
      "notes": "Queries the Notion database for assignments with due dates within the next 3 days. Replace 'your_notion_database_id' with your actual Notion database ID. Ensure 'Due Date' is a valid date property.",
      "position": [
        120,
        140
      ],
      "parameters": {
        "resource": "database",
        "databaseId": {
          "__rl": true,
          "mode": "id",
          "value": "=asdcvbhuy7654344444bhju765"
        }
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "509165a7-1401-4420-a81a-cf296c1fa312",
      "name": "IF Assignments Exist",
      "type": "n8n-nodes-base.if",
      "notes": "This IF node checks if there are any assignments returned from the Notion query. Proceeds to send reminders if assignments exist, otherwise stops the workflow.",
      "position": [
        340,
        140
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "{{$node['Notion - Get Assignments'].json['results'].length}}",
              "value2": "0",
              "operation": "larger"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ddb1e8bd-ca1f-46c2-9322-42f0bf229b2c",
      "name": "Send Email Reminder",
      "type": "n8n-nodes-base.emailSend",
      "notes": "Sends an email reminder for each assignment. Uses fallback values if properties are missing. Update 'your_email@example.com' with your email and configure SMTP credentials. Ensure 'Email', 'Assignment Name', and 'Due Date' match your Notion database schema.",
      "position": [
        780,
        140
      ],
      "parameters": {
        "text": "Dear Student/Teacher,\n\nThis is a reminder for the assignment '{{$json['properties']['Assignment Name']['title'][0]['plain_text'] || 'Unnamed Assignment'}}' due on {{$json['properties']['Due Date']['date']['start'] || 'No Date Set'}}. Please ensure it is completed on time.\n\nBest regards,\nYour School Automation System",
        "options": {},
        "subject": "Assignment Reminder: {{$json['properties']['Assignment Name']['title'][0]['plain_text'] || 'Unnamed Assignment'}}",
        "toEmail": "{{$json['properties']['Email']['rich_text'][0]['plain_text'] || 'default_email@example.com'}}",
        "fromEmail": "user@example.com"
      },
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c189406c-ddf0-4e6f-a97b-39b8c669ecd7",
      "name": "No Assignments",
      "type": "n8n-nodes-base.noOp",
      "notes": "This node is a placeholder for when no assignments are due within the next 3 days. The workflow stops here if no assignments are found.",
      "position": [
        560,
        340
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d2f78ed0-606f-4d51-8644-c7f8bbe49f25",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -680,
        -240
      ],
      "parameters": {
        "color": 3,
        "width": 760,
        "height": 280,
        "content": "## System Architecture\n- **Assignment Tracking Pipeline**:\n  - **Set Schedule For Trigger**: Initiates the workflow daily at 9 AM on weekdays.\n  - **Notion - Get Assignments**: Retrieves upcoming assignments from Notion.\n  - **IF Assignments Exist**: Filters for existing assignments.\n- **Reminder Generation Flow**:\n  - **Item Lists**: Processes each assignment individually.\n  - **Send Email Reminder**: Sends email notifications to students/teachers.\n- **Non-Critical Handling**:\n  - **No Assignments**: Skips execution if no assignments are due."
      },
      "typeVersion": 1
    },
    {
      "id": "aff6db0a-985f-450b-9ff8-016bda6dcb6f",
      "name": "SplitOutItems itemList",
      "type": "n8n-nodes-base.itemLists",
      "notes": "Expands the list of assignments into individual items to process each one separately for sending reminders.",
      "position": [
        560,
        140
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "Name"
      },
      "typeVersion": 1
    },
    {
      "id": "488f6c7c-33f5-4b4e-95b3-63d054a83d21",
      "name": "Set Schedule For Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "notes": "This node triggers the workflow every weekday at 9 AM to check for upcoming assignment deadlines.",
      "position": [
        -100,
        140
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "467e7d8b-b7ee-4662-a449-c7a8516f11e9",
  "connections": {
    "IF Assignments Exist": {
      "main": [
        [
          {
            "node": "SplitOutItems itemList",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Assignments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SplitOutItems itemList": {
      "main": [
        [
          {
            "node": "Send Email Reminder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notion - Get Assignments": {
      "main": [
        [
          {
            "node": "IF Assignments Exist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Schedule For Trigger": {
      "main": [
        [
          {
            "node": "Notion - Get Assignments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}