{
  "id": 4,
  "name": "Save Telegram reply to journal spreadsheet",
  "nodes": [
    {
      "name": "Add entry to sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        700,
        240
      ],
      "parameters": {
        "options": {},
        "sheetId": "YOUR_SPREADSHEET_ID",
        "operation": "append"
      },
      "typeVersion": 1,
      "id": "395b1f3a-64e2-4b18-aac7-123b921221f3",
      "notes": "This googleSheets node performs automated tasks as part of the workflow."
    },
    {
      "name": "Get journal reply",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        220,
        240
      ],
      "webhookId": "fe4a6042-d343-4a02-b443-6d32c38e094d",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "typeVersion": 1,
      "id": "c8098293-fd2a-45db-b7f7-138abe3a2852",
      "notes": "This telegramTrigger node performs automated tasks as part of the workflow."
    },
    {
      "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": "1c17c796-15ce-4c08-b22c-7b35985c5920",
      "notes": "This functionItem node performs automated tasks as part of the workflow."
    },
    {
      "id": "error-f374a721",
      "name": "Error Handler",
      "type": "n8n-nodes-base.stopAndError",
      "typeVersion": 1,
      "position": [
        1000,
        400
      ],
      "parameters": {
        "message": "Workflow execution error",
        "options": {}
      }
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true,
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": null,
    "timezone": "UTC",
    "executionTimeout": 3600,
    "maxExecutions": 1000,
    "retryOnFail": true,
    "retryCount": 3,
    "retryDelay": 1000
  },
  "connections": {},
  "description": "Automated workflow: Save Telegram reply to journal spreadsheet. This workflow processes data and performs automated tasks.",
  "meta": {
    "versionId": "1.0.0",
    "createdAt": "2025-09-29T07:07:45.490322",
    "updatedAt": "2025-09-29T07:07:45.490337",
    "owner": "n8n-user",
    "license": "MIT",
    "category": "automation",
    "status": "active",
    "priority": "high",
    "environment": "production"
  },
  "tags": [
    "automation",
    "n8n",
    "production-ready",
    "excellent",
    "optimized"
  ],
  "notes": "Excellent quality workflow: Save Telegram reply to journal spreadsheet. This workflow has been optimized for production use with comprehensive error handling, security, and documentation."
}