N
n8n Store
Workflow Market
AI Planner (LinkedIn)

AI Planner (LinkedIn)

by yahordubrouski0 views

Description

Categories

🤖 AI & Machine Learning

Nodes Used

n8n-nodes-base.setn8n-nodes-base.setn8n-nodes-base.setn8n-nodes-base.coden8n-nodes-base.coden8n-nodes-base.coden8n-nodes-base.coden8n-nodes-base.coden8n-nodes-base.notionn8n-nodes-base.notion
PriceKostenlos
Views0
Last Updated11/28/2025
workflow.json
{
  "id": "wtKqVmCe49QAo6vt",
  "meta": {
    "instanceId": "109de48c883f89c232fb5f38144dda448f8c80bfaad77a69d6e409efd749b7ee",
    "templateCredsSetupCompleted": true
  },
  "name": "AI Planner (LinkedIn)",
  "tags": [],
  "nodes": [
    {
      "id": "e370e284-f06e-482b-ae7f-3d10019f4a58",
      "name": "Receive Telegram Messages",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        48,
        144
      ],
      "webhookId": "f913897a-8843-44ec-888b-5bedb9f6b8fe",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "ZIPqCroMLmzD5gtQ",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "47c0a6c6-f78f-4188-8315-4f7d898bd5fc",
      "name": "Voice or Text?",
      "type": "n8n-nodes-base.switch",
      "position": [
        240,
        128
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Audio",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "af30c479-4542-405f-b315-37c50c4e2bef",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.message.voice.file_id }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Text",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a3ca8cd4-fbb2-40b5-829a-24724f2fbc85",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.message.text || \"\" }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Error",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "9bcfdee0-2f09-4037-a7b9-689ef392371d",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "error",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "bd65c98e-46ed-44bb-a6ad-2683e9ba2030",
      "name": "Fetch Voice Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        560,
        112
      ],
      "webhookId": "d28bd011-ad87-4c15-8f06-7d0ccfd22536",
      "parameters": {
        "fileId": "={{ $json.message.voice.file_id }}",
        "resource": "file",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "ZIPqCroMLmzD5gtQ",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f3a78105-8324-4839-b6bb-7c5aae425e34",
      "name": "Transcribe Voice to Text",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        768,
        112
      ],
      "parameters": {
        "options": {},
        "resource": "audio",
        "operation": "translate"
      },
      "credentials": {
        "openAiApi": {
          "id": "u2X2WGPh6JYIkEyv",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "f75e8f3c-e61d-43df-8969-978f7d1b5ab4",
      "name": "Prepare for LLM",
      "type": "n8n-nodes-base.set",
      "position": [
        560,
        288
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b324a329-3c49-4f7f-b683-74331b7fe7f8",
              "name": "=text",
              "type": "string",
              "value": "={{$json.message.text}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "fac183f6-26ee-4f3e-88b2-071f0a38671a",
      "name": "Send Confirmation",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2928,
        -144
      ],
      "webhookId": "6fbed741-9bb4-4cca-be72-41a9c3d6af11",
      "parameters": {
        "text": "=Task Link :{{ $json.url }}",
        "chatId": "={{ $('Receive Telegram Messages').item.json.message.chat.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "ZIPqCroMLmzD5gtQ",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "e8cd17bb-e7a7-44b6-ab3d-a9b267e2ecbe",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        16
      ],
      "parameters": {
        "width": 1196,
        "height": 484,
        "content": " **Get Telegram Message**  "
      },
      "typeVersion": 1
    },
    {
      "id": "634ce7e4-c996-4bdd-8cf4-37f7849d8ba5",
      "name": "Detect Intent",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1312,
        192
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "=You are a classification assistant that analyzes a user's natural-language message and determines their intent related to tasks.\n\nYou must choose only one of the following intents:\n\ncreate → the user wants to add a new task\n\nupdate → the user wants to change, fix, or improve an existing task\n\nanalyze → the user is asking for insights, feedback, evaluation, or reflection based on existing tasks (e.g., workload, productivity, effectiveness, goals)\n\nThe user message may be unclear, indirect, or informal. Think carefully and infer intent if needed.\n\nRespond with only one word: create, update, or analyze. No punctuation. No explanation.\n\nExamples:\n\n\"Create a task to prepare slides by Friday\" → create\n\n\"Update the grocery task to include milk\" → update\n\n\"What does my task list say about my priorities today?\" → analyze\n\n\"Am I too busy tomorrow?\" → analyze\n\n\"Fix the title of the morning meeting task\" → update\n\n\"Add a task to write birthday letter\" → create\n\n\"Do my tasks this week help me reach my goal?\" → analyze\n\n\"My schedule is a mess\" → analyze\n\n\"I want to change that annoying deadline\" → update\n\n\"Don't forget to call the dentist\" → create\n\n\"Move the research task to next week\" → update\n\n\"Add: Buy winter shoes\" → create\n\n\"Is next week too full?\" → analyze"
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "2f9456d5-cae5-432d-9324-40a36f085fdc",
      "name": "Wrap Intent",
      "type": "n8n-nodes-base.set",
      "position": [
        1584,
        192
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={\n  \"intent\": \"{{ $json.text }}\"\n}"
      },
      "typeVersion": 3.4
    },
    {
      "id": "31c3417f-ef35-4525-af3e-33eb61df2cfa",
      "name": "Prepare Unified Text",
      "type": "n8n-nodes-base.set",
      "position": [
        1040,
        192
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a91f8b36-f7b5-4cd3-81cf-f42d5a98152c",
              "name": "text",
              "type": "string",
              "value": "={{ $json.text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "72d1f0dc-39bc-434d-b229-9f6eaa3a1c18",
      "name": "Route by Intent",
      "type": "n8n-nodes-base.switch",
      "position": [
        1936,
        176
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "35719492-2ca4-4d67-8bfc-225f68cd3fd7",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{$json.intent}}",
                    "rightValue": "create"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "d1af2fb7-bb6f-412f-b886-42a0d16915a0",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{$json.intent}}",
                    "rightValue": "update"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a198158d-2b3b-4f9d-af67-4f38d6f5f281",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{$json.intent}}",
                    "rightValue": "analyze"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "4d6fbc0d-c537-46e9-aabb-91e9945f5923",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1248,
        16
      ],
      "parameters": {
        "width": 860,
        "height": 484,
        "content": " **Add Intent (create, update, analyze)**  "
      },
      "typeVersion": 1
    },
    {
      "id": "bef334e7-bab9-48b8-944a-315568364289",
      "name": "Extract Create Task Fields",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2608,
        64
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"title\": \"Call Anna about the report\",\n  \"priority\": \"High\",\n  \"description\": \"optional detail\",\n  \"due_date\": \"2025-08-26 08:00\",\n  \"tags\": [\"work\", \"important\"]\n}\n"
      },
      "typeVersion": 1.3
    },
    {
      "id": "41816606-bb23-4083-af02-29a23b79096d",
      "name": "Wrap Intent + Text",
      "type": "n8n-nodes-base.code",
      "position": [
        1744,
        192
      ],
      "parameters": {
        "jsCode": "return [\n  {\n    json: {\n      intent: $items(\"Detect Intent\")[0].json.text,\n      text: $items(\"Prepare Unified Text\")[0].json.text\n    }\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "0b11032b-a1d1-49c3-aefd-bf74ca9a20be",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2352,
        -224
      ],
      "parameters": {
        "width": 828,
        "height": 452,
        "content": " **Create Task**  "
      },
      "typeVersion": 1
    },
    {
      "id": "47c13987-833b-48ea-bcef-6161f014fa13",
      "name": "Update Task Prompt",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        3568,
        352
      ],
      "parameters": {
        "text": "=User message:\n{{ $json.text }}\n\nOriginal task:\n{{ JSON.stringify($json.task, null, 2) }}\n",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "You are an assistant helping to update a task.\n\nYou’ll receive:\n\nThe user's message describing what to change\n\nThe original task JSON from Todoist\n\nYour job is to return a new version of the task JSON that includes the requested changes (e.g. new content, updated priority, deadline, etc.).\n\n🔹 If the user mentions a list (e.g. items to buy or do), format those items as bullet points in the content field using newline-separated dashes (- item).\n\n🔹 Keep all unchanged fields as-is unless the user asked to modify them.\n\n🔹 Do not add explanations, comments, or extra keys.\n\n🔹 Return only the updated JSON object of the task.\n\nExample Input:\n\nUser: \"Change the task to include 'buy milk, water, and bread' and set it to high priority\"\n\nOriginal Task:\n{\n  \"id\": 123,\n  \"content\": \"Go to the shop\",\n  \"priority\": 2\n}\n\nOutput:\n{\n  \"id\": 123,\n  \"content\": \"Go to the shop\\n- milk\\n- water\\n- bread\",\n  \"priority\": 4\n}"
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "bc306d2b-591d-43d7-a63b-1b8e0b8c8f6e",
      "name": "Find Matching Task",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        3072,
        352
      ],
      "parameters": {
        "text": "=Search string:\n{{ $json.search_string }}\n\nAvailable tasks:\n{{ JSON.stringify($json.tasks, null, 2) }}\n",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "You are an assistant that finds the most relevant task from a given list.\n\nYou will be given:\n- A list of tasks in JSON format (each with content, id, and other fields)\n- A search string (from the user)\n\nYour job is to return only the ONE best-matching task as valid JSON — exactly the original task object.\n\nDo not return explanations or wrap it in text. Do not modify the task. Just return the raw JSON object that best matches the search string.\n"
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "0f9074e7-cbcd-4fcd-9781-1a182fe25e0b",
      "name": "Prepare Match Prompt",
      "type": "n8n-nodes-base.code",
      "position": [
        2896,
        352
      ],
      "parameters": {
        "jsCode": "const searchString = $items('Get Search String')[0].json.text;\nconst tasks = $items('Get Notion Tasks (update)').map(item => item.json);\n\nreturn [\n  {\n    json: {\n      search_string: searchString,\n      tasks: tasks\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "a5f243be-9d47-4167-9177-3a99b758837b",
      "name": "Get Search String",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        2400,
        352
      ],
      "parameters": {
        "text": "={{$json.text}}",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "You receive a user's message about updating a task. Your job is to extract only the fuzzy match string that can be used to identify the task to update.\n\nReturn a single string. Do not return JSON.\n\nExamples:\n\nInput: \"Update the grocery task to include bread\"\nOutput: grocery\n\nInput: \"Change the bug fixing task to high priority\"\nOutput: bug fixing\n"
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "d979fad4-b32c-4f80-8f36-0530b7ececd1",
      "name": "Prepare Update Prompt",
      "type": "n8n-nodes-base.code",
      "position": [
        3392,
        352
      ],
      "parameters": {
        "jsCode": "const userMessage = $items('Wrap Intent + Text')[0].json.text;\nconst matchedTask = JSON.parse($json.text);\n\nreturn [\n  {\n    json: {\n      text: userMessage,\n      task: matchedTask\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "3bfc2d17-6d97-4655-9dc4-53390205ef72",
      "name": "to task object",
      "type": "n8n-nodes-base.code",
      "position": [
        3920,
        352
      ],
      "parameters": {
        "jsCode": "return [\n  {\n    json: JSON.parse($json.text)\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "d0b04c84-5952-4a4c-a491-f36296239bc8",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2352,
        288
      ],
      "parameters": {
        "width": 2140,
        "height": 436,
        "content": " **Update Task**  "
      },
      "typeVersion": 1
    },
    {
      "id": "74560ede-e144-465f-a155-89f4289ae854",
      "name": "Prepare Analysis Prompt",
      "type": "n8n-nodes-base.code",
      "position": [
        2560,
        848
      ],
      "parameters": {
        "jsCode": "const userText = $items('Wrap Intent + Text')[0].json.text;\nconst tasks = $items('Get Notion Tasks (analyze)').map(item => item.json);\n\nreturn [\n  {\n    json: {\n      question: userText,\n      tasks: tasks\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "b2e89a91-f0a4-4641-bc08-4f5b6e59cdbf",
      "name": "AI Analyze Tasks",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        2736,
        848
      ],
      "parameters": {
        "text": "=User question:\n{{ $json.question }}\n\nTasks:\n{{ JSON.stringify($json.tasks, null, 2) }}\n",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "You are a thoughtful assistant helping the user analyze their current Notion task list and provide useful insights.\n\nYou will receive:\n\n* A natural-language question or comment from the user (e.g. “Am I too overloaded today?”, “Will this week’s plan help me reach my goals?”)\n* A list of current tasks (in JSON), each with fields like `title`, `priority`, `due_date`, `description`, and `tags`\n\nYour job is to:\n\n1. Understand the user's concern or goal (e.g. goal alignment).\n2. Analyze the task list based on:\n\n* Time sensitivity (due dates and today’s load)\n* Priorities\n\n3. Offer actionable advice to improve, rebalance, or adjust the plan.\n\n* If tasks drift from core goals, suggest focus redirection.\n\nOutput format:\n\n* Use plain text only — friendly, warm, and practical tone\n* Avoid technical terms or code\n* Write as if you’re speaking to a close friend\n\nExample Inputs:\n“Am I too overloaded today?”\n“Will this week’s plan help me reach my goals?”\n“What’s the most important thing to do today?”\n\nExample Output:\nYou have 7 tasks today, 4 of which are high priority and work-related. Consider rescheduling 1–2 items to tomorrow and adding a 30-minute recharge break.\nYou’re doing great progressing in your professional development — keep up the focus!\n"
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "66f11a2e-185a-4491-9366-88b9d6448a45",
      "name": "Send Analysis Result",
      "type": "n8n-nodes-base.telegram",
      "position": [
        3056,
        848
      ],
      "webhookId": "f827c3a1-f42d-49d5-8084-2cd45fd6b66b",
      "parameters": {
        "text": "={{ $json.text }}",
        "chatId": "5230229344",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "ZIPqCroMLmzD5gtQ",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "15e9786c-7bf9-4c23-87c3-1ead6e474215",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2352,
        784
      ],
      "parameters": {
        "width": 860,
        "height": 452,
        "content": " **Analyze Tasks**  "
      },
      "typeVersion": 1
    },
    {
      "id": "3e614a4a-d65c-4164-b43b-b336c4f57cde",
      "name": "Create a database page",
      "type": "n8n-nodes-base.notion",
      "position": [
        2736,
        -144
      ],
      "parameters": {
        "title": "={{ $json.output.title }}",
        "simple": false,
        "options": {},
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "25a041f0-262c-8015-855a-f2d5595a2d3a",
          "cachedResultUrl": "https://www.notion.so/25a041f0262c8015855af2d5595a2d3a",
          "cachedResultName": "Tasks"
        },
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Name|title",
              "title": "={{ $json.output.title }}"
            },
            {
              "key": "Description|rich_text",
              "textContent": "={{ $json.output.description }}"
            },
            {
              "key": "Due Date|date",
              "date": "={{ $json.output.due_date }}",
              "timezone": "Europe/Warsaw"
            },
            {
              "key": "Priority|select",
              "selectValue": "={{ $json.output.priority }}"
            },
            {
              "key": "Tags|multi_select",
              "multiSelectValue": "={{ $json.output.tags }}"
            }
          ]
        }
      },
      "credentials": {
        "notionApi": {
          "id": "tr3AgOYPp8P3PMfz",
          "name": "Notion account"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "4742c1df-7a47-46c3-bc73-b5d94c31ac0b",
      "name": "Get Notion Tasks (analyze)",
      "type": "n8n-nodes-base.notion",
      "position": [
        2384,
        848
      ],
      "parameters": {
        "options": {},
        "resource": "databasePage",
        "operation": "getAll",
        "returnAll": true,
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "25a041f0-262c-8015-855a-f2d5595a2d3a",
          "cachedResultUrl": "https://www.notion.so/25a041f0262c8015855af2d5595a2d3a",
          "cachedResultName": "Tasks"
        }
      },
      "credentials": {
        "notionApi": {
          "id": "tr3AgOYPp8P3PMfz",
          "name": "Notion account"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "0cc6b5ed-7394-4c72-a52f-8466cd64592c",
      "name": "Get Notion Tasks (update)",
      "type": "n8n-nodes-base.notion",
      "position": [
        2704,
        352
      ],
      "parameters": {
        "options": {},
        "resource": "databasePage",
        "operation": "getAll",
        "returnAll": true,
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "25a041f0-262c-8015-855a-f2d5595a2d3a",
          "cachedResultUrl": "https://www.notion.so/25a041f0262c8015855af2d5595a2d3a",
          "cachedResultName": "Tasks"
        }
      },
      "credentials": {
        "notionApi": {
          "id": "tr3AgOYPp8P3PMfz",
          "name": "Notion account"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "095a579c-7c2f-485d-9244-fb0f7fc8c3cc",
      "name": "Update a database page",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4096,
        352
      ],
      "parameters": {
        "url": "=https://api.notion.com/v1/pages/{{ $json[\"id\"] }}",
        "method": "PATCH",
        "options": {},
        "jsonBody": "={\n  \"properties\": {\n    \"Name\": {\n      \"title\": [\n        {\n          \"text\": {\n            \"content\": \"{{ $json[\"property_name\"] }}\"\n          }\n        }\n      ]\n    },\n    \"Description\": {\n      \"rich_text\": [\n        {\n          \"text\": {\n            \"content\": \"{{ $json[\"property_description\"] }}\"\n          }\n        }\n      ]\n    },\n    \"Priority\": {\n      \"select\": {\n        \"name\": \"{{ $json[\"property_priority\"] }}\"\n      }\n    },\n    \"Due Date\": {\n      \"date\": {\n        \"start\": \"{{ $json[\"property_due_date\"].start }}\"\n      }\n    },\n    \"Tags\": {\n      \"multi_select\": [\n        {{ $json.property_tags.map(tag => `{ \"name\": \"${tag}\" }`).join(',') }}\n      ]\n    }\n  }\n}\n",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "notionApi"
      },
      "credentials": {
        "notionApi": {
          "id": "tr3AgOYPp8P3PMfz",
          "name": "Notion account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "6ebefebc-fd3c-4c22-8119-a5ca7c69daa0",
      "name": "OpenAI Chat Model (Detect Intent)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1312,
        368
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "u2X2WGPh6JYIkEyv",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "516646ea-9c5c-49c3-a2c5-989193557f4c",
      "name": "Create Task (Prompt)",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        2432,
        -144
      ],
      "parameters": {
        "text": "={{$json.text}}",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "You are an assistant that extracts structured task data for creating a Notion task.\n\nYour goal is to return a single JSON object with only these fields:\n- title (string) → required\n- priority (\"Low\", \"Medium\", \"High\") → optional\n- description (string) → optional\n- due_date (YYYY-MM-DD or YYYY-MM-DD HH:mm) → optional\n- tags (array of lowercase strings) → optional\n\n⚠️ Only include fields relevant to the input.\n\n🔹 If the user mentions a list (e.g. tasks to do or items to buy), format the list inside the description field using newline-separated bullet points (- item).\n\n🔹 Return only valid JSON. Do not include markdown, prose, or explanations.\n\nExamples:\n\nInput:\n\"Create a high priority task to buy groceries tomorrow and tag it as urgent\"\n\nOutput:\n{\n  \"title\": \"Buy groceries\",\n  \"priority\": \"High\",\n  \"due_date\": \"2025-08-24 08:00\",\n  \"tags\": [\"urgent\"]\n}\n\nInput:\n\"Create a task for tomorrow to go to the store and buy milk, eggs, and bread\"\n\nOutput:\n{\n  \"title\": \"Go to the store\",\n  \"description\": \"- milk\\n- eggs\\n- bread\",\n  \"due_date\": \"2025-08-24\"\n}"
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "ec18d81d-ca79-4162-8fb9-3a57486068ab",
      "name": "Create Task Prompt (Model)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2432,
        64
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "u2X2WGPh6JYIkEyv",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "e2a00da4-206d-49b2-9b73-de4bb09cb2a0",
      "name": "Get Search String Prompt (Model)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2400,
        560
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "u2X2WGPh6JYIkEyv",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5a56fb1d-86d9-4160-ba39-efe00675373a",
      "name": "Find Matching Task Prompt (Model)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        3072,
        560
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "u2X2WGPh6JYIkEyv",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "de42695e-3a57-4e02-a47e-2d2692fc69ce",
      "name": "Update Task Prompt (Model)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        3568,
        560
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "u2X2WGPh6JYIkEyv",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "3cc67684-f2a5-4294-b8fa-5dc4bd05b033",
      "name": "Alalyze Task Prompt (Model)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2736,
        1056
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "u2X2WGPh6JYIkEyv",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d302a9fc-f927-4e37-be36-69ee37de5278",
      "name": "Send Confirmation (update)",
      "type": "n8n-nodes-base.telegram",
      "position": [
        4272,
        352
      ],
      "webhookId": "32a6e081-0608-4624-9401-15f39199841a",
      "parameters": {
        "text": "=Task Link :{{ $json.url }}",
        "chatId": "5230229344",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "ZIPqCroMLmzD5gtQ",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "67fd9d79-98c5-4ac7-9685-e5b7b317f5f8",
  "connections": {
    "Wrap Intent": {
      "main": [
        [
          {
            "node": "Wrap Intent + Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Detect Intent": {
      "main": [
        [
          {
            "node": "Wrap Intent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Voice or Text?": {
      "main": [
        [
          {
            "node": "Fetch Voice Message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Prepare for LLM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "to task object": {
      "main": [
        [
          {
            "node": "Update a database page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare for LLM": {
      "main": [
        [
          {
            "node": "Prepare Unified Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Intent": {
      "main": [
        [
          {
            "node": "Create Task (Prompt)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Search String",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Notion Tasks (analyze)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Analyze Tasks": {
      "main": [
        [
          {
            "node": "Send Analysis Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Search String": {
      "main": [
        [
          {
            "node": "Get Notion Tasks (update)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find Matching Task": {
      "main": [
        [
          {
            "node": "Prepare Update Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Task Prompt": {
      "main": [
        [
          {
            "node": "to task object",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wrap Intent + Text": {
      "main": [
        [
          {
            "node": "Route by Intent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Voice Message": {
      "main": [
        [
          {
            "node": "Transcribe Voice to Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Task (Prompt)": {
      "main": [
        [
          {
            "node": "Create a database page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Match Prompt": {
      "main": [
        [
          {
            "node": "Find Matching Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Unified Text": {
      "main": [
        [
          {
            "node": "Detect Intent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Update Prompt": {
      "main": [
        [
          {
            "node": "Update Task Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a database page": {
      "main": [
        [
          {
            "node": "Send Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update a database page": {
      "main": [
        [
          {
            "node": "Send Confirmation (update)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Analysis Prompt": {
      "main": [
        [
          {
            "node": "AI Analyze Tasks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe Voice to Text": {
      "main": [
        [
          {
            "node": "Prepare Unified Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Notion Tasks (update)": {
      "main": [
        [
          {
            "node": "Prepare Match Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receive Telegram Messages": {
      "main": [
        [
          {
            "node": "Voice or Text?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Task Prompt (Model)": {
      "ai_languageModel": [
        [
          {
            "node": "Create Task (Prompt)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Extract Create Task Fields": {
      "ai_outputParser": [
        [
          {
            "node": "Create Task (Prompt)",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Get Notion Tasks (analyze)": {
      "main": [
        [
          {
            "node": "Prepare Analysis Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Task Prompt (Model)": {
      "ai_languageModel": [
        [
          {
            "node": "Update Task Prompt",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Alalyze Task Prompt (Model)": {
      "ai_languageModel": [
        [
          {
            "node": "AI Analyze Tasks",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get Search String Prompt (Model)": {
      "ai_languageModel": [
        [
          {
            "node": "Get Search String",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Find Matching Task Prompt (Model)": {
      "ai_languageModel": [
        [
          {
            "node": "Find Matching Task",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model (Detect Intent)": {
      "ai_languageModel": [
        [
          {
            "node": "Detect Intent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}

相关工作流