{
  "id": "xL7tk88Dw69DgKky",
  "name": "Prioritize Todoist tasks with AI and send daily summaries to Slack",
  "tags": [],
  "nodes": [
    {
      "id": "a252f8d5-ebb0-4d5e-b6e7-434a142c4723",
      "name": "Morning Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -736,
        336
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 8
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "bbc0cc2a-f46b-4be8-a3e7-dec61cb2b94b",
      "name": "Get Todo List",
      "type": "n8n-nodes-base.todoist",
      "position": [
        -448,
        336
      ],
      "parameters": {
        "filters": {},
        "operation": "getAll",
        "returnAll": true,
        "authentication": "oAuth2"
      },
      "credentials": {
        "todoistOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "db1b4d0b-27ed-4c32-b868-838be1136729",
      "name": "AI Task Analyzer",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -208,
        336
      ],
      "parameters": {
        "text": "={{ $json }}",
        "options": {
          "systemMessage": "You are an expert task prioritization assistant. Analyze the provided tasks and create a prioritized list based on:\n\n1. **Urgency**: Deadlines and time-sensitive items\n2. **Importance**: Impact on goals and objectives\n3. **Dependencies**: Tasks that unlock other work\n4. **Effort**: Quick wins vs. complex projects\n\nFor each task, provide:\n- Priority rank (1-10, where 1 is highest priority)\n- Reasoning for the priority\n- Suggested time block for completion\n- Any warnings about overdue or critical items\n\nBe concise but thorough in your analysis."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2
    },
    {
      "id": "c9461c82-696b-4823-a001-c133a72ce495",
      "name": "Task Priority Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        0,
        560
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"prioritizedTasks\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"rank\": { \"type\": \"number\" },\n          \"taskName\": { \"type\": \"string\" },\n          \"reasoning\": { \"type\": \"string\" },\n          \"suggestedTimeBlock\": { \"type\": \"string\" },\n          \"urgencyLevel\": { \"type\": \"string\" }\n        }\n      }\n    },\n    \"dailySummary\": {\n      \"type\": \"string\",\n      \"description\": \"Overall daily strategy and recommendations\"\n    },\n    \"warnings\": {\n      \"type\": \"array\",\n      \"items\": { \"type\": \"string\" },\n      \"description\": \"Any critical or overdue items needing immediate attention\"\n    }\n  },\n  \"required\": [\"prioritizedTasks\", \"dailySummary\"]\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "0d55710c-1f94-4b5a-bc99-8f0f8a50d2e8",
      "name": "Format AI Summary",
      "type": "n8n-nodes-base.set",
      "position": [
        128,
        336
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "f6a7b8c9-d0e1-2345-fabc-678901234567",
              "name": "formattedMessage",
              "type": "string",
              "value": "=## \ud83d\uddd3\ufe0f Today's Priority Tasks - {{ $now.format('MMMM D, YYYY') }}\n> {{ $json.output.dailySummary }}\n\n---\n\n### \u2705 Priority Task List\n\n{{\n  $json.output.prioritizedTasks.map((task, index) => `\n**${task.rank}. ${task.taskName}**\n> \ud83d\udccd **Reason:** ${task.reasoning}\n> \u23f0 **Suggested Time:** ${task.suggestedTimeBlock}\n> \ud83d\udd25 **Urgency:** ${task.urgencyLevel}\n  `).join('\\n\\n---\\n\\n')\n}}\n\n{{\n  ($json.output.warnings && $json.output.warnings.length > 0)\n  ? `\n---\n### \u26a0\ufe0f Warnings\n> ${$json.output.warnings.join('\\n> ')}\n`\n  : ''\n}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "bd0f7670-5d17-4f50-9bf0-05136d9e9192",
      "name": "Send to Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        416,
        336
      ],
      "parameters": {
        "text": "={{ $json.formattedMessage }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultName": ""
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "1f10a4a3-1711-4879-9be1-506caeedc1d9",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -256,
        544
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d89eb4d0-2a74-4546-b1ce-165fc18dd998",
      "name": "Sticky Note - Trigger",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -944,
        16
      ],
      "parameters": {
        "height": 224,
        "content": "## \ud83c\udf05 Morning Trigger\nThis workflow runs every morning at 8 AM to analyze and prioritize your daily tasks.\n\nAdjust the schedule time in the trigger node to match your preferred morning routine."
      },
      "typeVersion": 1
    },
    {
      "id": "47df9223-34e7-4def-b82e-b5b394e022e8",
      "name": "Sticky Note - Tasks",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        16
      ],
      "parameters": {
        "height": 256,
        "content": "## \ud83d\udccb Task Retrieval\nFetches all incomplete tasks from your Todoist account.\n\n**Setup Required:**\n- Connect your Todoist credentials\n- You can replace this with Google Tasks, Notion, or any other task management tool"
      },
      "typeVersion": 1
    },
    {
      "id": "41f8e384-7262-4b9f-a4ae-766b88817449",
      "name": "Sticky Note - Delivery",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "height": 320,
        "content": "## \ud83d\udcec Delivery Options\nChoose how you want to receive your daily priorities:\n\n**Slack Setup:**\n- Add Slack credentials\n- Configure the channel or DM\n\n\n**Other Options:**\nYou can add nodes for:\n- Microsoft Teams\n- Discord\n- SMS (Twilio)\n- Push notifications"
      },
      "typeVersion": 1
    },
    {
      "id": "15974333-61fc-46ea-ab1e-7c09e149cfc1",
      "name": "Sticky Note - AI",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        560
      ],
      "parameters": {
        "height": 320,
        "content": "## \ud83e\udd16 AI Analysis\nThe AI Agent analyzes your tasks using GPT-4 to create intelligent prioritization.\n\n**Configuration needed:**\n- Add your OpenAI API credentials\n- Adjust the system prompt if you want different prioritization criteria\n- The output parser ensures structured data for downstream processing"
      },
      "typeVersion": 1
    },
    {
      "id": "004da8d2-3e67-4aab-915f-894e58ae40c5",
      "name": "Sticky Note - Format",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        144,
        656
      ],
      "parameters": {
        "height": 336,
        "content": "## \ud83d\udcdd Message Formatting\nFormats the AI's prioritized task list into a readable message format.\n\nThe formatted output includes:\n- Date header\n- Daily summary\n- Prioritized task list with details\n- Any critical warnings"
      },
      "typeVersion": 1
    },
    {
      "id": "4dc51fee-d563-4caf-8598-3dd8f5f95439",
      "name": "Sticky Note - Template Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1328,
        416
      ],
      "parameters": {
        "color": 5,
        "width": 460,
        "height": 440,
        "content": "## Template Overview (Self-hosted only)\nThis template uses a community node (LangChain) and is intended for self-hosted n8n.\n\n## How it works\n1. 8 AM trigger\n2. Fetch Todoist tasks\n3. AI prioritization\n4. Format & send to Slack\n\n## Setup\n- Connect OAuth2 for Todoist/Slack\n- Set `slackChannelId` in **User Config**\n- Adjust schedule if needed"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "83071eb3-435e-453b-8521-60cd603e7b2a",
  "connections": {
    "Get Todo List": {
      "main": [
        [
          {
            "node": "AI Task Analyzer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Task Analyzer": {
      "main": [
        [
          {
            "node": "Format AI Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format AI Summary": {
      "main": [
        [
          {
            "node": "Send to Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Task Priority Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Task Analyzer",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Task Analyzer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Morning Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get Todo List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}