Supercharge your Substack: Build a personalized AI assistant in a few clicks 🚀🤖
Turn your latest posts and notes into new ideas with an AI sidekick powered by n8n and ChatGPT
I’ve always loved writing 📚, but lately I was drowning in ideas and struggling to organize my newsletter content. I was reading about n8n’s1 AI capabilities and realized I could automate some of my workflow. n8n even has a Telegram2 AI bot template3 where a LangChain agent talks to GPT-4. Inspired by that, I decided to build a Telegram bot assistant that pulls in my Substack newsletter posts and helps me brainstorm new ideas.
In the beginning, I was just a busy writer turned no-code tinkerer. I set up a Telegram bot (via BotFather4) to send messages to my phone, and got to work wiring up an n8n workflow. It felt amazing to empower myself with code – I mean no-code! – to solve my own problem. Peek at this. 👀
Now I have a helper that listens on Telegram, reads my recent Substack notes and posts, summarizes them, and even helps me come up with newsletter ideas. It’s like having a 🤖 editor-in-chief who knows all my content.
🚀 Like where this is going? Subscribe today and join a growing community of creators experimenting with AI workflows. You’ll get step-by-step guides, real examples, and fresh ideas delivered straight to your inbox.
🚀🛠️ What the AI assistant can do
Here’s a quick overview of what my Telegram AI assistant can do.
Chat on Telegram. It listens for any message I send on Telegram and responds in a friendly chat. Behind the scenes it uses OpenAI’s GPT-4.1 model5 to generate its replies. Because GPT-4.1 is optimized for instruction-following and has a huge context window, it can handle pretty complex prompts.
Fetch Substack Content. It can pull in my latest Substack notes or posts6. In practice, this means I can ask the bot things like “What were my last 3 notes about?” or “Show me a summary of the last post.” and it will fetch that content for reference.
Summarize and Brainstorm. The agent can summarize a full post when asked for, or brainstorm new content. I prompt it with something like “Summarize my last newsletter” or “Brainstorm 5 ideas based on these notes”, and GPT-4.1 generates helpful suggestions. Thanks to the model’s 1-million-token context window, it can “read” entire articles or notes I give it. It’s also trained to follow instructions, so it knows to output a structured summary or list of ideas.
Remember Chat History. It keeps track of our conversation context using a simple buffer memory. In n8n I attached a Simple Memory to the agent, which “stores the entire conversation history”. This means the bot can recall what we talked about earlier in the chat, so brainstorming is more coherent (it knows what we discussed last week, for example).
By combining GPT-4.1 with these tools, my assistant can chat with me, look up my own content from Substack, and help turn my notes into new ideas. It’s a handy creative partner that keeps me on track with my newsletter.
💡 I’ve shown you what my AI assistant can do - but what about yours? Imagine building your own version: what features would you add, or what problems would you solve first? Share your thoughts in the comments, I’d love to exchange ideas with you.
🗂️🔄 How the workflow works
The n8n workflow is a chain of connected nodes, each doing one step.
Here’s a friendly walk-through of each part.
💬📲 Telegram Trigger node
The Telegram Trigger node is where it all starts.
I connected this node to my Telegram Bot’s credentials. Whenever I send a message to the bot, this trigger fires and passes the chat message text to the next node.
Essentially, it says “New input from Telegram: here is the user’s message”, so the workflow knows to react.
📲 Pretty cool, right? If you know someone who’s struggling with content overload or could use a little AI boost in their daily workflow, share this post with them. It might be exactly the inspiration they need to start building their own assistant.
🧠🤖 AI Agent node
Next is the AI Agent node. I set it up as a conversation agent with a custom system prompt that tells it to focus on content brainstorming. Here is the system prompt I have provided.
You are a helpful personal assistant focused on content creation.
Your role is to help brainstorm new ideas for upcoming newsletters by reviewing and drawing inspiration from recently published content.
You can use the following tools:
* `Get recent notes`: Fetch the user’s latest notes (default: last 15).
* `Get recent posts previews`: Retrieve previews of the most recent posts, including their IDs. You use those IDs to fetch complete content of a post if needed.
* `Get full post by ID`: Fetch the complete content of a specific post, given its ID. You obtain an ID from post preview if needed.
Always use these tools when helpful to provide context, summaries, and inspiration.
Today is {{ $now }}.In n8n’s world, an AI Agent is “an autonomous system that receives data, makes decisions, and acts within its environment”. By attaching my own tools to it, I give it power to look up information and craft answers.
OpenAI Chat (GPT-4.1). This chat model node calls OpenAI’s chat completion (using GPT-4.1). It is the “brain” of the agent.
Whenever the agent decides it needs to generate text (like an answer or idea list), it uses this node.
Memory Buffer. I added a Simple Memory node. This stores our chat history so the agent can refer back to earlier messages.
In practice, this means if I say “following up on the idea about AI in education”, the agent still remembers what we talked about before.
Inside the agent node, I hook up a few Substack Tools. Crucially, I created custom sub-nodes that call the Substack API. These tools let the agent fetch my content.



For example, one tool calls “Get All Posts” to grab the titles or previews of my most recent articles. Another tool calls “Get Post by ID” to fetch an entire post’s content. So if I ask “What’s in post #123?”, the agent uses the Substack tool to retrieve that post text and then passes it to the GPT model to summarize or analyze.
Because all these are connected, the agent intelligently decides when to use which tool. For example, if I type “Show me my latest post”, the agent might call the “Get All Posts” tool and “Get Post by ID“ under the hood and then display the results. It can even call multiple tools in one answer if needed.
✂️🧾 Code Node
After the AI agent generates a response, it might be several hundred words long. I added a Code node next in line to handle splitting.
This node runs a bit of JavaScript that takes the agent’s output text and breaks it into an array of chunks, each under 1000 characters.
const inputText = $input.first().json.output || "";
const lines = inputText.split("\n");
let output = [];
let currentChunk = "";
for (const line of lines) {
if ((currentChunk + line + "\n").length > 1000) {
if (currentChunk) output.push(currentChunk.trim());
currentChunk = line + "\n";
} else {
currentChunk += line + "\n";
}
}
if (currentChunk) output.push(currentChunk.trim());
return { output }This is necessary because Telegram messages have a character limit and we want to avoid cutting anything off. Think of this node as a smart text buffer: it makes sure each piece is short enough to send.
🤔 The workflow I built connects quite a few moving parts. If something isn’t clear or you’d like me to break down a specific step in more detail, drop a comment below. I check them all and I’m happy to help troubleshoot or brainstorm improvements together.
🔀📤 Split Out Node
Next, a Split Out node takes that array of text chunks and splits them into separate “items” in n8n’s workflow.
Essentially, if the code node created an array like ["Hello world...", "How are you?", ""], the Split Out node will produce three output items from it (ignoring any empty tail). This sets us up to send each chunk as a separate message.
🔄📦 Loop Over Items node
Now I use a Loop Over Items node to handle each chunk one by one. This node goes through each split message in order.
On each loop iteration, it takes the next text chunk and passes it to the Telegram reply node. In n8n terms, this ensures the messages are sent sequentially so nothing gets lost. It’s basically a loop that says “for each piece of text, do the next step”.
💬📬 Telegram Reply node
Finally, a Telegram Reply node sends the text chunk back into the Telegram chat. Each loop iteration triggers this node once, so the user (me) sees multiple messages in sequence that together make up the full answer. I configured it to reply in the same chat ID.
Optionally, there’s a setting to mask or escape any HTML/Markdown (n8n’s docs even mention using a special node to mask HTML syntax for stability ). In practice, this means I get all the parts of the answer delivered one after the other as tidy messages on Telegram.
This covers the main nodes; the flow is: (1) Telegram Trigger → (2) AI Agent (with tools) → (3) Code split → (4) Split Out → (5) Loop → (6) Telegram Reply.
Each node’s output feeds into the next, so a Telegram message goes in, data flows through the agent tools, and replies come back chunk by chunk.
🔑🌐 Getting API keys
Before running this workflow, you need API keys/credentials for each service.
OpenAI API key
Go to OpenAI Platform and sign up or log in. In the dashboard, click your account icon and select API keys. Then click Create new secret key to generate a key. Copy that key (you won’t be able to see it again) and add it as credentials in n8n. This lets the AI Agent node call GPT-4.1 via OpenAI’s API.
Substack credentials
I used unofficial Substack API along with Substack community node for this. To make it work, I had to obtain Substack credentials/API key. This part is a bit tricky, but you can learn how to do it the following post.
Telegram Bot API token
Open the Telegram app and start a chat with @BotFather. Send /newbot and follow the prompts to name your bot and set its username. BotFather will reply with a message that includes your new bot’s API token. (It looks like 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11). Copy this token into n8n’s Telegram credentials. Now your workflow can connect to that bot and send/reply to messages.
Each of these steps only takes a few minutes. Once the keys are stored in n8n, my workflow nodes could authenticate to OpenAI, Substack, and Telegram seamlessly.
🙌 This guide took a lot of tinkering (and coffee ☕) to put together, but I truly believe it can save creators hours of work. If it sparked new ideas for you, please hit Share so others can discover it too - let’s spread the word and help more people build smarter with AI.
✨🙌 Recap
Putting this all together, I ended up with a smart, Telegram-based assistant for my newsletter work. It responds to my messages, knows my recent Substack content, and helps me generate or refine ideas. The AI agent, armed with GPT-4.1 and a memory buffer, can chat naturally and reference past notes. And by chunking outputs for Telegram, nothing gets cut off.
This assistant saves me a ton of time. Instead of manually digging through my Substack or brainstorming alone, I just text the bot: “Any ideas for this week’s topic?” or “Summarize my last post”. It’s like having a personal AI editor in my pocket. Best of all, since n8n is so flexible, I can keep customizing and extending this workflow. For example, I could add a tool that scrapes RSS feeds, or connect it to Google Sheets to log ideas – n8n makes it easy to plug in new steps.
I hope this walk-through shows how even no-code/low-code developers can build something awesome. If you have your own newsletter or content pipeline, try adapting this setup. Swap in your Substack (or Medium, or blog RSS), or use a different messaging app – the pieces will be similar. The key idea is: chain the tools you need in n8n, give an agent a good prompt, and let GPT-4.1 do the heavy lifting.
Happy automating ✨ – and may your content ideas flow freely with a little AI help!
📦⚡ Want to skip the setup and dive right in?
Grab my exported workflow JSON below - just copy-paste it into your own n8n instance and you’re ready to roll!
✨ If you enjoyed this walk-through and want more practical tutorials, behind-the-scenes experiments, and honest lessons from my own journey, hit Subscribe now. Don’t miss the next post - your future AI assistant might be just one click away.

























Turns your archive into a creative partner that actually knows your work! For anyone feeling buried in half-formed ideas, having a system that connects old thoughts to new possibilities seems genuinely helpful.
This is awesome, Jakub. I’ve been drowning in notes for my own Substack too, so I totally get the pain point. Haven’t tried wiring it through Telegram, though; curious, do you find it works better for you than just keeping it inside Notion or another workspace?