← Back to library

Answer bot questions from synced n8n tables, not live APIs

On the n8n Community forum, Khalid_Allam described a Telegram assistant he built for a small-business customer. It handles tasks in ClickUp, appointments in Google Calendar and expense logs. Instead of letting agents query those services for every question, a second workflow mirrors them into Data Tables. This is our write-up, with credit.

  • OutcomeBuild a chat assistant that replies to everyday questions such as tomorrow's schedule from n8n Data Tables kept in sync with your task and calendar tools, filters dates in code instead of asking the model, remembers the last few messages, and only reaches the live systems when something has to be created, edited or removed.
  • SetupAn afternoon+
  • LevelAdvanced
  • CreditKhalid_Allam
View original
Works with
n8nChatGPTClaudeCustom agent

Published Dec 1, 2026Updated Dec 1, 2026AI dry run on sample input: passed Dec 1, 2026Source verified Dec 1, 2026

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?

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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)

Prompt2 variables
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?
It works, but each question can mean several calls, slower replies and the model doing date filtering. Reading a table and filtering in code is faster and more predictable, and the agents still reach the live systems to make a change.
Is the workflow available?
The author links his own GitHub repository with the two workflow files and table layouts from the forum post. We link only the forum post; check the repository's terms before reusing his files.

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.

More in Operations & Admin

All 225 Operations & Admin playbooks →

Related playbooks

Operations & AdminWorkflow✓ AI dry run

Check an AI-built n8n workflow before you trust it

When an assistant writes an automation for you, go through the imported file before it touches real customers: confirm each node's credential, pick model names from the live list, add retries and a time limit to the AI step, search for placeholder text, and judge the result by one genuine end-to-end test instead of a green run.

Credit: Huzaifa_Aamish

Under an hour
Operations & AdminPrompt✓ AI dry run

Find jobs your bot could start when something happens

Get a short list of chores you currently start by hand after an email, form entry, booking or chat message arrives, with the event that could start each one, what the assistant would then do, the access it needs, and a tested setup you approve before anything runs on its own.

Credit: Michael Fenech (@Michael_Fenech_)

Under an hour
Operations & AdminWorkflow✓ AI dry run

Log every agent action as ok, failed or unknown

Give each write an agent makes one structured log line with its attempt ID, request key, an outcome of ok, failed or unknown, and what the agent did next, then keep one saved query for the combination that should never happen, an unknown outcome the agent confirmed to the customer, so a repeat of the incident shows up in minutes.

Credit: ccch713

Under an hour
Operations & AdminWorkflow✓ AI dry run

Pin your agent's write path with one contract test

Build a single fast test workflow that sends the same request key to your agent's booking or order write twice against a stand-in backend, then confirms from an append-only log that exactly one write happened, that the repeat ends as a deliberate skip, and that a forced timeout still lands as unknown and reaches a person, so refactors cannot quietly bring back duplicate writes.

Credit: ccch713

An afternoon+
Operations & AdminWorkflow✓ AI dry run

Gate after-hours dental phone triage and booking

Calls are answered and booked against the real schedule, emergencies reach the dentist, and reminders and recalls run without front-desk time.

Credit: u/anassy1 on r/AiAutomations

An afternoon+