AutomationFlowsAI & RAG › Brain — Append (telegram → Brain-note)

Brain — Append (telegram → Brain-note)

Brain — Append (Telegram → brain-note). Uses telegramTrigger, telegram, openAi, ssh. Event-driven trigger; 13 nodes.

Event trigger★★★★☆ complexityAI-powered13 nodesTelegram TriggerTelegramOpenAISsh
AI & RAG Trigger: Event Nodes: 13 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the OpenAI → Telegram recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Brain \u2014 Append (Telegram \u2192 brain-note)",
  "nodes": [
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.2,
      "position": [
        -600,
        0
      ],
      "id": "node-telegram-trigger",
      "name": "Telegram Trigger",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "leftValue": "={{ $json.message.from.id }}",
              "rightValue": "__TELEGRAM_CHAT_ID__",
              "operator": {
                "type": "number",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -490,
        0
      ],
      "id": "node-if-authorized",
      "name": "Is from me?"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "leftValue": "={{ $json.message.voice }}",
              "rightValue": "",
              "operator": {
                "type": "object",
                "operation": "exists",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -380,
        0
      ],
      "id": "node-if-voice",
      "name": "Is voice?"
    },
    {
      "parameters": {
        "resource": "file",
        "fileId": "={{ $json.message.voice.file_id }}"
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        -160,
        -120
      ],
      "id": "node-tg-getfile",
      "name": "Telegram Get File",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "audio",
        "operation": "transcribe",
        "options": {
          "language": "ar"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        60,
        -120
      ],
      "id": "node-whisper",
      "name": "Whisper Transcribe",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "asg-text-voice",
              "name": "text",
              "value": "={{ $json.text }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        280,
        -120
      ],
      "id": "node-set-voice",
      "name": "Set text (voice)"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "asg-text-text",
              "name": "text",
              "value": "={{ $('Telegram Trigger').item.json.message.text }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        60,
        120
      ],
      "id": "node-set-text",
      "name": "Set text (text)"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "leftValue": "={{ $json.text }}",
              "rightValue": "/",
              "operator": {
                "type": "string",
                "operation": "startsWith"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        500,
        0
      ],
      "id": "node-if-slash",
      "name": "Is slash command?"
    },
    {
      "parameters": {
        "jsCode": "const text = $input.item.json.text || '';\nconst m = text.trim().match(/^\\/(\\w+)(?:\\s+([\\s\\S]*))?$/);\nconst cmd = (m ? m[1] : 'help').toLowerCase();\nconst args = (m && m[2]) ? m[2].trim() : '';\n\nlet cli;\nif (['today', 'yesterday', 'week', 'help'].includes(cmd)) {\n  cli = `recall ${cmd}`;\n} else if (cmd === 'search') {\n  if (!args) {\n    cli = 'recall help';\n  } else {\n    const b64 = Buffer.from(args, 'utf-8').toString('base64');\n    cli = `search --b64 ${b64}`;\n  }\n} else if (cmd === 'undo') {\n  cli = 'undo';\n} else {\n  cli = `recall ${cmd}`;\n}\n\nreturn { json: { cli } };"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        720,
        -120
      ],
      "id": "node-code-cmd",
      "name": "Extract command"
    },
    {
      "parameters": {
        "resource": "command",
        "command": "=cd /Users/khalifah/Projects/brain-code && ./.venv/bin/brain-note {{ $json.cli }}"
      },
      "type": "n8n-nodes-base.ssh",
      "typeVersion": 1,
      "position": [
        940,
        -120
      ],
      "id": "node-ssh-recall",
      "name": "SSH brain-note slash",
      "credentials": {
        "sshPassword": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "const text = $input.item.json.text || '';\nconst b64 = Buffer.from(text, 'utf-8').toString('base64');\nreturn { json: { text, b64text: b64 } };"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        720,
        120
      ],
      "id": "node-code-b64",
      "name": "Encode b64"
    },
    {
      "parameters": {
        "resource": "command",
        "command": "=cd /Users/khalifah/Projects/brain-code && echo \"{{ $json.b64text }}\" | base64 -d | ./.venv/bin/brain-note capture --stdin"
      },
      "type": "n8n-nodes-base.ssh",
      "typeVersion": 1,
      "position": [
        940,
        0
      ],
      "id": "node-ssh",
      "name": "SSH brain-note capture",
      "credentials": {
        "sshPassword": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "text": "={{ $json.stdout || $json.stderr || 'no output' }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1160,
        0
      ],
      "id": "node-tg-reply",
      "name": "Telegram Reply",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Is from me?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is from me?": {
      "main": [
        [
          {
            "node": "Is voice?",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Is voice?": {
      "main": [
        [
          {
            "node": "Telegram Get File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set text (text)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Get File": {
      "main": [
        [
          {
            "node": "Whisper Transcribe",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Whisper Transcribe": {
      "main": [
        [
          {
            "node": "Set text (voice)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set text (voice)": {
      "main": [
        [
          {
            "node": "Encode b64",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set text (text)": {
      "main": [
        [
          {
            "node": "Is slash command?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is slash command?": {
      "main": [
        [
          {
            "node": "Extract command",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Encode b64",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract command": {
      "main": [
        [
          {
            "node": "SSH brain-note slash",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SSH brain-note slash": {
      "main": [
        [
          {
            "node": "Telegram Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Encode b64": {
      "main": [
        [
          {
            "node": "SSH brain-note capture",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SSH brain-note capture": {
      "main": [
        [
          {
            "node": "Telegram Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Brain — Append (Telegram → brain-note). Uses telegramTrigger, telegram, openAi, ssh. Event-driven trigger; 13 nodes.

Source: https://github.com/khalifahalsadah/brain-code/blob/f1fdc15f8e291fc47e85760c1db51656f6d1a361/n8n/append.workflow.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Ask questions like “How much did I spend on food last month?” and get instant answers from your financial data — directly in Telegram.

Telegram Trigger, OpenAI, Google Sheets +2
AI & RAG

Build a Telegram bot that helps users find AliExpress products using natural language requests. The bot uses OpenAI to optimize search queries, Decodo to scrape product listings, and AI analysis to se

Telegram Trigger, OpenAI, Telegram +3
AI & RAG

Voice Note -> Veo 3 AD. Uses telegramTrigger, telegram, openAi, httpRequest. Event-driven trigger; 49 nodes.

Telegram Trigger, Telegram, OpenAI +3
AI & RAG

&gt; ⚠️ Disclaimer: This workflow uses Community Nodes and must be run on a self-hosted instance of n8n.

HTTP Request, Telegram Trigger, Telegram +2
AI & RAG

Viral Tik Tok Clone Finder. Uses httpRequest, telegramTrigger, openAi, googleSheets. Event-driven trigger; 41 nodes.

HTTP Request, Telegram Trigger, OpenAI +2