When should you use it?
- Your n8n agent is slow because it calls several APIs to answer a simple question
- The model keeps getting date ranges or weekday math wrong
- Short replies like 'yes, remove it' lose their meaning because the bot forgets the last message
Not for: Assistants that must always show live, to-the-second data; Very large task lists where copying everything into tables is impractical; Anyone not yet comfortable with webhooks and n8n Code nodes
What do you need, and what do you get?
You need
- Access to the systems you want mirrored, such as a task tool and a calendar
- A chat channel for the assistant, for example Telegram
- A model API key for intent parsing and the scoped agents
You get
- A sync workflow that keeps local tables current when records change
- A message-history table keyed by chat
- An assistant that answers read questions from tables and routes changes to narrowly scoped agents
How does it work, step by step?
- Mirror the dataCreate a sync workflow triggered by your task tool's change events that refreshes a table of tasks, a table of calendar entries and a combined table that pairs them.
- Keep a short memoryLog each user message and bot reply to a history table keyed by the chat ID, and load only the latest handful of turns before each run.
- Classify firstHave a model step return a small JSON intent. Read-only questions skip the agents entirely and are answered by a Code node that filters the tables by date.
- Scope the agentsSend writes to separate agents that each hold only the tools for adding, editing, removing or logging money, and send unclear requests to a chat step that asks a follow-up.
- Know the limitsTest what happens with matching names, edits made only in the calendar and requests beyond the sync window, and decide how you will handle each.
The prompt
Our own prompt, inspired by Khalid_Allam and written to work in n8n, ChatGPT, Claude and others. Values in lime are placeholders.
Fill in the blanks (optional; the copied prompt uses your values)
I am building a chat assistant in n8n for {business}. It works with {systems}. Help me design it so everyday questions are answered from local tables instead of live API lookups. - Sync: propose a separate workflow that copies the records the assistant needs from each system into n8n Data Tables whenever a record is added, changed or removed, plus one joined table if records from two systems belong together. Say which field you would match on and where that match could break. - Chat history: propose a table of past messages keyed by chat ID and how many recent turns to load before each run. - Routing: design an intent step that returns JSON naming one action (read, add, change, remove, money or chat). Read-only questions are answered by a Code node from the tables, with dates filtered in code rather than by the model. Unclear messages go to a step that asks me a clarifying question. - Writes: give each agent only the tools its action needs, and require my confirmation before anything is removed. - Limits: list the weak spots of this design (how far ahead the sync looks, stale rows, duplicate names) and a test with sample records for each. Use placeholders for every credential and ID.
Inspired by Khalid_Allam: n8n Community: a Telegram AI assistant that reads from n8n Data Tables instead of live APIs. The prompt above is written by playbooks.bot in our own words; nothing from the original is quoted.
What can go wrong?
- Matching records by name alone. Two items with the same title will collide; use an ID if your tools allow it.
- A one-way sync. If the trigger only fires from the task tool, edits made directly in the calendar wait until the next task change.
- Loading the entire history and trimming afterward. Limit the read itself once the table grows.
Our take
This is a design lesson more than a template, and it is a good one. Many agent builds hand the model every tool and let it fetch whatever it needs, which costs time and hands date filtering to the model, a job it does poorly. Separating what exists from what was just said, and answering read questions from synced tables with plain code, makes the common case fast and boring in the best sense. We also like that the agents are split by job, each holding only the tools for its action, and that unclear messages go to a step that asks a question instead of guessing. The author is candid about the weak spots: a sync window of a few days in each direction, matching by name and one-directional triggers. Those are the first things to test in your own version. In our dry run for an invented two-person cleaning company using Trello and Google Calendar, the model proposed a shared job key stored in both systems instead of matching names, loading the last ten turns after filtering by chat, a confirmation step before any removal, and a test where a date beyond the sync window returns 'outside coverage' rather than 'nothing booked'. We did not import his workflow files.
Where the time goes back: Answering reads from local tables cuts response time and API usage, and removing date math from the model removes a common source of wrong answers, so the owner spends less time double-checking what the bot says.
FAQ
Why not let the agent call the APIs directly?
Is the workflow available?
Source and credit
Inspired by Khalid_Allam. We describe the idea in our own words, link to the original, and wrote the prompt ourselves; nothing is quoted.
- Inspired by
- n8n Community: a Telegram AI assistant that reads from n8n Data Tables instead of live APIs
- Creator
- Khalid_Allam
- Published on
- n8n Community
- Original date
- Dec 1, 2026
- License
- Not openly licensed (the poster keeps all rights), so we quote nothing and link to the original
- Originally for
- n8n
- AI dry run
- Dec 1, 2026: passed. Dry-run tested by our AI test agent on sample input. Design matches the page's outputs and guardrails. Design-only dry run; the author's n8n workflow files were not imported or run.
AI dry run on sample data; not run with live connected accounts. The playbooks.bot test agent filled the prompt with synthetic inputs, produced the output and checked it against the page's stated outputs and guardrails. - Verified
- Dec 1, 2026: source link resolves to the original, the credited creator published it, our excerpt or prompt matches it, and the license allows our use.
Are you the creator? Claim or correct this page.