{
  "name": "Save Telegram reply to journal spreadsheet",
  "nodes": [
    {
      "name": "Add entry to sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        700,
        240
      ],
      "parameters": {
        "options": {},
        "sheetId": "REPLACE_WITH_SHEETID",
        "operation": "append"
      },
      "typeVersion": 1
    },
    {
      "name": "Get journal reply",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        220,
        240
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "typeVersion": 1
    },
    {
      "name": "Parse message",
      "type": "n8n-nodes-base.functionItem",
      "position": [
        460,
        240
      ],
      "parameters": {
        "functionCode": "// When telgram sees a message it will make sure its a reply to its message and from the user. \n// If thats the case then it will return {entry: string, date: string}\n\nconst botUsername = 'BOT_USERNAME'\nconst user = 'YOUR_USERNAME'\n\nconst res = item.message\n\nconst isReplyToBot = res.reply_to_message.from.username === botUsername\nconst isFromUser = res.from.username === user\n\n// This assumes your message is formatted as follows: \"SOME CUSTOM MESSAGE: YYYY-MM-DD\"\nconst date = res.reply_to_message.text.split(':')[1].replace(/\\s/g, '');\n\nconst journalEntry = res.text\n\nif (isReplyToBot && isFromUser) {\n  return {entry: journalEntry, date}\n}\n\nreturn undefined;"
      },
      "typeVersion": 1
    },
    {
      "id": "17180603-db6c-5ba6-a5a9-02892b3e0cf6",
      "name": "Publication · Overview and setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -800,
        0
      ],
      "parameters": {
        "content": "# Save Telegram reply to journal spreadsheet\n\n## Purpose and structure\nThis folder contains the **Save Telegram reply to journal spreadsheet** workflow. Its executable nodes use `functionItem`, `googleSheets`, `telegramTrigger`. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.\n\n## Setup\nImport inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.\n\n## Entry points\nGet journal reply\n\n## Verification\nSanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.\n\n## Attribution\nhttps://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Googlesheets/0974_GoogleSheets_Telegram_Export_Triggered.json\nMIT; preserve source notices.",
        "width": 700,
        "height": 800,
        "color": 1
      }
    }
  ],
  "active": false,
  "settings": {},
  "connections": {
    "Parse message": {
      "main": [
        [
          {
            "node": "Add entry to sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get journal reply": {
      "main": [
        [
          {
            "node": "Parse message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
