{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "48f3e337-2473-42a4-99f5-6ace23c84e90",
      "name": "Split Notes and Tasks",
      "type": "n8n-nodes-base.code",
      "position": [
        -680,
        380
      ],
      "parameters": {
        "jsCode": "const text = $input.first().json.message.text;\n\n// Split text to notes and tasks\nconst [notesPart, tasksPart] = text.split(/Tasks:/i);\n\n// Exctact notes\nconst notes = notesPart.trim();\n\n// Exctact tasks\nconst tasks = tasksPart\n  ? tasksPart\n      .split('\\n')\n      .map(line => line.trim())\n      .filter(line => line.startsWith('- '))\n      .map(line => line.replace(/^- /, '').trim())\n  : [];\n\nreturn [{\n  json: {\n    notes: notes,\n    tasks: tasks\n  }\n}];"
      },
      "typeVersion": 1
    },
    {
      "id": "27f421a2-e3fb-4d4c-871e-02677f6a7711",
      "name": "Split Tasks",
      "type": "n8n-nodes-base.itemLists",
      "position": [
        -480,
        380
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "tasks"
      },
      "typeVersion": 1
    },
    {
      "id": "9f084303-d631-4cc0-adc0-28cff92b32bc",
      "name": "Parse Task Details",
      "type": "n8n-nodes-base.code",
      "position": [
        -280,
        380
      ],
      "parameters": {
        "jsCode": "return items.map(item => {\n  const task = item.json.tasks;\n  // Extract only task names\n  const title = task.replace(/^-?\\s*/, '').replace(/\\s*\\(Assignee:.*?\\)/, '').trim();\n  return {\n    json: {\n      title: title\n    }\n  };\n});"
      },
      "typeVersion": 1
    },
    {
      "id": "70f93203-2f4e-4c76-8f8a-ff54e2da1231",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1540,
        140
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7392f10f-65f9-4bc3-9b51-58fd70c64e7c",
      "name": "Create a task",
      "type": "n8n-nodes-ticktick.tickTick",
      "position": [
        60,
        380
      ],
      "parameters": {
        "title": "={{ $json.title }}",
        "projectId": "[TickTick project ID]",
        "additionalFields": {}
      },
      "credentials": {
        "tickTickOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "77ba03c3-22a4-4bff-8e73-454aa13bef48",
      "name": "Wait1",
      "type": "n8n-nodes-base.wait",
      "disabled": true,
      "position": [
        -100,
        380
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "a7b52ef7-2d1c-4e31-8be7-7e3d07629b61",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1140,
        0
      ],
      "parameters": {
        "content": "If message contain \"**Task**\" it will route to create page in Notion and add tasks"
      },
      "typeVersion": 1
    },
    {
      "id": "8febbebe-453d-43bd-974a-95b865846a36",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        20
      ],
      "parameters": {
        "content": "### Edit Title\nCurrent version create name in Notion \"MN [current date]\""
      },
      "typeVersion": 1
    },
    {
      "id": "b016769c-0c7c-49d0-802e-f9282e7d6d07",
      "name": "Add-Notion-Page",
      "type": "n8n-nodes-base.notion",
      "position": [
        -80,
        160
      ],
      "parameters": {
        "title": "=MN {{ $now }}",
        "blockUi": {
          "blockValues": [
            {
              "textContent": "={{ $json.message.text }}"
            }
          ]
        },
        "options": {},
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "[notion page id]",
          "cachedResultUrl": "[your Notion page]",
          "cachedResultName": "Meetings"
        }
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c26b088b-5fcc-4fb9-b555-550ff8426f49",
      "name": "SuccessReaction",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        220,
        160
      ],
      "parameters": {
        "url": "https://api.telegram.org/[your telegram bot token]/setMessageReaction",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"chat_id\": \"{{ $('Telegram Trigger').item.json.message.chat.id }}\",\n  \"message_id\": \"{{ $('Telegram Trigger').item.json.message.message_id }}\",\n  \"reaction\": [{\"type\": \"emoji\", \"emoji\": \"\ud83d\udc4c\"}]\n}",
        "sendBody": true,
        "jsonHeaders": "={\n  \"Content-Type\": \"application/json\"\n}",
        "sendHeaders": true,
        "specifyBody": "json",
        "specifyHeaders": "json"
      },
      "typeVersion": 4.2
    },
    {
      "id": "231be11f-a4ca-44f8-85ec-6e3c175c843d",
      "name": "Add-or-Edit",
      "type": "n8n-nodes-base.switch",
      "position": [
        -980,
        140
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "8db56430-5c4c-4087-aacc-30e50d92fff7",
                    "operator": {
                      "type": "string",
                      "operation": "notContains"
                    },
                    "leftValue": "={{ $json.message.text }}",
                    "rightValue": "Tasks"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "fa96d0e6-fd7d-4d1b-85a9-6033ac4655b9",
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.message.text }}",
                    "rightValue": "Tasks"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "bef400bc-b59f-4602-b55b-ad3d39c4425e",
      "name": "Edit-Notes",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -760,
        -120
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Analyze the quick meeting notes from {{ $json.message.text }} \nGenerate meeting notes and a task list in the following format:\\nMeeting Notes:\\n- [Note 1]\\n- [Note 2]\\n\\nTasks:\\n- [Task 1] \\n- [Task 2] "
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "5ebe87fc-e7c7-4f8c-a25e-49ffe6760f07",
      "name": "Send-Edited-Notes",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -320,
        -220
      ],
      "parameters": {
        "text": "={{ $json.message.content }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    }
  ],
  "connections": {
    "Wait1": {
      "main": [
        [
          {
            "node": "Create a task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit-Notes": {
      "main": [
        [
          {
            "node": "Send-Edited-Notes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add-or-Edit": {
      "main": [
        [
          {
            "node": "Edit-Notes",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Split Notes and Tasks",
            "type": "main",
            "index": 0
          },
          {
            "node": "Add-Notion-Page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Tasks": {
      "main": [
        [
          {
            "node": "Parse Task Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a task": {
      "main": [
        []
      ]
    },
    "Add-Notion-Page": {
      "main": [
        [
          {
            "node": "SuccessReaction",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Add-or-Edit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Task Details": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Notes and Tasks": {
      "main": [
        [
          {
            "node": "Split Tasks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}