{
  "id": "fzx7RMobAxKnsbUd",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Telegram to Notion Task Automation",
  "tags": [
    {
      "id": "JUK6Xu1Fz0PWwGzI",
      "name": "active",
      "createdAt": "2025-10-04T12:29:09.131Z",
      "updatedAt": "2025-10-04T12:29:09.131Z"
    }
  ],
  "nodes": [
    {
      "id": "2abd8dfa-9a30-40e9-a6f6-00dfebfb0a8c",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -192,
        128
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.5-flash-lite"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b628bda1-d9d4-4a08-8daf-92df2068b20b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -176
      ],
      "parameters": {
        "color": 5,
        "width": 304,
        "height": 336,
        "content": "## \u26a1 Starts on new Telegram message.\nTriggers the workflow when a new Telegram message arrives. "
      },
      "typeVersion": 1
    },
    {
      "id": "5fc725da-6bed-4db6-a366-48cd5c0a0c4e",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        -240
      ],
      "parameters": {
        "color": 5,
        "width": 352,
        "height": 512,
        "content": "## \ud83e\udde0 Uses AI (Gemini) to return TaskName & TaskDue.\nThis node uses an AI model (e.g., Gemini) to extract the task name and due date from the Telegram message.  \nYou can easily switch to any other AI model you prefer.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "cb518f25-0918-4c19-b56e-c5d3f4d0f459",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        144,
        -256
      ],
      "parameters": {
        "color": 5,
        "width": 304,
        "height": 448,
        "content": "## \ud83d\udce9 Sends extracted task; waits for Approve or Decline.\nSends a message with the extracted task name and due date.  \nWaits for your response you can **approve** or **decline** the task."
      },
      "typeVersion": 1
    },
    {
      "id": "0395e170-03d3-44a2-86a2-2486587a60c4",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        -224
      ],
      "parameters": {
        "color": 5,
        "width": 320,
        "height": 384,
        "content": "## \u2696\ufe0f If approved \u2192 create task. If declined \u2192 notify.\nChecks if the user approved or declined the task.  \nIf **approved**, the workflow continues; if **declined**, it redirects to another step.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "63aa0097-e2ad-40d5-abf0-103f132305d3",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        896,
        48
      ],
      "parameters": {
        "color": 5,
        "height": 368,
        "content": "## \ud83d\udce9 Decline Notification  \nSends a Telegram message to the user notifying them that they **declined the task** and no task was created in Notion.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "6ccb7215-746b-4449-b8ba-a535566bb04f",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        896,
        -304
      ],
      "parameters": {
        "color": 5,
        "width": 512,
        "height": 320,
        "content": "## \ud83d\udcdd Create Notion Task  \nIf the task is approved, this node creates a new task in Notion using the extracted **task name** and **due date**.  \nAfter creation, it triggers the next node to send a Telegram notification.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c1411a5a-f2a1-42cd-8c4a-708f2040a982",
      "name": "Telegram New Message Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -544,
        -32
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {
          "chatIds": "YOUR_TELEGRAM_CHAT_ID"
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1214ca68-7ced-4a27-b4b5-30caad364092",
      "name": "AI Extract: TaskName & TaskDue",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        -192,
        -32
      ],
      "parameters": {
        "text": "={{ $json.message.text }}",
        "options": {},
        "attributes": {
          "attributes": [
            {
              "name": "TaskName",
              "required": true,
              "description": "This is the name of the task. The task name should be in the title case."
            },
            {
              "name": "TaskDue",
              "type": "date",
              "description": "This is the due date of the task."
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "093e6dab-b137-4d80-8bff-09ff03f1018b",
      "name": "Send message and wait for response (Approve/Decline)",
      "type": "n8n-nodes-base.telegram",
      "position": [
        240,
        -32
      ],
      "parameters": {
        "chatId": "={{ $('Telegram New Message Trigger').item.json.message.from.id }}",
        "message": "=Task Name: {{ $json.output.TaskName }}\nDue Date: {{ $json.output.TaskDue }}",
        "options": {
          "appendAttribution": false
        },
        "operation": "sendAndWait",
        "approvalOptions": {
          "values": {
            "approvalType": "double",
            "approveLabel": "Approve",
            "disapproveLabel": "Decline"
          }
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a5b24cc6-1ba0-400f-a218-c5ddcbff2574",
      "name": "Approval Check (If Approved?)",
      "type": "n8n-nodes-base.if",
      "position": [
        592,
        -32
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "9d302e0c-44e2-4b9e-a3ed-8d21e67945ed",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.data.approved }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "80e06ae0-4eb1-43fa-8215-828500e1a7df",
      "name": "Notion: Create Task (Page)",
      "type": "n8n-nodes-base.notion",
      "position": [
        976,
        -160
      ],
      "parameters": {
        "title": "={{ $('AI Extract: TaskName & TaskDue').item.json.output.TaskName }}",
        "options": {},
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "282c6fb7-beaa-80b5-9051-ce57efc79002",
          "cachedResultUrl": "https://www.notion.so/YOUR_NOTION_DATABASE_ID",
          "cachedResultName": "Tasks Testing"
        },
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Date|date",
              "date": "={{ $('AI Extract: TaskName & TaskDue').item.json.output.TaskDue }}",
              "includeTime": false
            }
          ]
        }
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "8c629f2a-04bf-4ffe-960f-6ca107f6f13d",
      "name": "Notify: Task Created (Telegram)",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1184,
        -160
      ],
      "parameters": {
        "text": "=\u2705 Task created in Notion.",
        "chatId": "={{ $('Telegram New Message Trigger').item.json.message.from.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a5ff4f45-4ef8-4474-992b-a73b5983b462",
      "name": "Notify: Declined - No Task (Telegram)",
      "type": "n8n-nodes-base.telegram",
      "position": [
        960,
        224
      ],
      "parameters": {
        "text": "=\u274c Task not created in Notion.",
        "chatId": "={{ $('Telegram New Message Trigger').item.json.message.from.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5f21dcbb-1d6d-4b16-8395-84a884a5e4fb",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1232,
        -336
      ],
      "parameters": {
        "color": 7,
        "width": 544,
        "height": 688,
        "content": "## \ud83d\udd27 Setup & Requirements\n- Gemini API key (add as Google Palm / Gemini credential in n8n).  \n- Notion integration + database with properties:  \n  - **TaskName** (Title) \u2014 stores the task name.  \n  - **TaskDue** (Date) \u2014 stores the due date (use ISO `YYYY-MM-DD`).  \n- Telegram bot token (add as Telegram credential in n8n).  \n- A running n8n instance (cloud or self-hosted).\n\n## Quick setup\n1. Add credentials in n8n: Google Palm / Gemini, Notion, and Telegram.  \n2. Open the **Notion: Create Task (Page)** node and set **Database ID** to `YOUR_NOTION_DATABASE_ID`.  \n3. Open the **Telegram New Message Trigger** node \u2192 Additional Fields \u2192 set `chatIds` to `YOUR_TELEGRAM_CHAT_ID` to restrict the trigger to your chat only.  \n4. Save and test with a sample message.\n\n## Security notes\n- Do **not** hardcode API keys or tokens in HTTP or node fields \u2014 always use n8n credential stores.  \n- Replace all placeholders (`YOUR_NOTION_DATABASE_ID`, `YOUR_TELEGRAM_CHAT_ID`, credential names) before sharing the workflow.\n\n## Quick test example\nSend to your bot: `Remind me to submit the report on 26th october 2025` \u2192 approve the message \u2192 verify a Notion task appears with Title = TaskName and Date = TaskDue.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "5463694c-b820-446b-be0d-e4f088e4b2eb",
  "connections": {
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Extract: TaskName & TaskDue",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Notion: Create Task (Page)": {
      "main": [
        [
          {
            "node": "Notify: Task Created (Telegram)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram New Message Trigger": {
      "main": [
        [
          {
            "node": "AI Extract: TaskName & TaskDue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Approval Check (If Approved?)": {
      "main": [
        [
          {
            "node": "Notion: Create Task (Page)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Notify: Declined - No Task (Telegram)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Extract: TaskName & TaskDue": {
      "main": [
        [
          {
            "node": "Send message and wait for response (Approve/Decline)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send message and wait for response (Approve/Decline)": {
      "main": [
        [
          {
            "node": "Approval Check (If Approved?)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}