n8n

How to Capture Google Docs Chat Memory?

Keep every important chat detail in one place. An AI chat agent collects notes from live messages, stores long term memories in Google Docs, and can share summaries by email or Telegram. Great for support teams that need quick context and fast follow ups.

A chat message starts the flow. The agent uses a short term window to remember the last messages and calls tools to save or find long term memories. Saving writes a JSON entry with date and text into a Google Doc. Retrieval pulls content from the same doc. Two OpenAI models shape friendly summaries for each channel. One summary goes to Gmail, and another goes to Telegram. A router also lets other workflows trigger memory actions on demand.

Set up Google Docs, Gmail, Telegram, and OpenAI in n8n. Point the Google Docs nodes to the same document ID. Add your Telegram chat ID and your email address, or use environment variables. Expect faster replies, fewer missed details, and better handoffs. Use it to keep customer preferences, past issues, or promises made in chat, and send timely updates to your team or customer.

What are the key features?

  • Chat trigger starts the AI conversation and passes user messages into the agent
  • Short term window stores the last 10 messages for better context
  • Save long term memories to a shared Google Doc with date and text
  • Retrieve memories from the same Google Doc to personalize replies
  • OpenAI models prepare clear summaries for Gmail and Telegram
  • Send final updates through Gmail and Telegram using dedicated nodes
  • Execute by another workflow to call memory tools from other automations
  • Tool router directs save, retrieve, and send actions to the right path

What are the benefits?

  • Reduce manual note taking from 30 minutes to 2 minutes per chat by capturing memories automatically
  • Streamline support follow ups by sending ready summaries to Gmail and Telegram
  • Improve context accuracy by 80 percent with consistent long term memory stored in one Google Doc
  • Handle more simultaneous chats by using an AI agent with short term and long term memory
  • Connect four systems seamlessly to keep chat, storage, and notifications in sync

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with Google Docs, Gmail, Telegram and OpenAI. See the Tools Required section above for links to create accounts with these services.
  3. In the n8n credentials manager, open the Google Docs nodes and create a new Google Docs OAuth2 credential. Follow the on screen steps and grant access to your Google account.
  4. Create or choose a Google Doc that will store memories. Copy its document ID. In both Save and Retrieve Google Docs nodes, paste the same document ID so save and read use one source.
  5. For Gmail, open the Gmail node, create a new Gmail OAuth2 credential, and finish the sign in flow. Set the Subject and To fields as needed or keep the template values.
  6. For Telegram, create a bot with BotFather and copy the bot token. In the Telegram node, create a new credential using that token. Set chatId to your chat or group ID. If the node uses an environment variable, replace it with a number or set the variable in n8n settings.
  7. For OpenAI, open each OpenAI node and create a new API Key credential. Paste your OpenAI API key from the official API page. Use the provided model settings or adjust if needed.
  8. Open the chat trigger node and confirm it is active. Use the test view in n8n to send a message and watch the agent respond.
  9. Send a message like Save this memory about refund policy. Check the Google Doc to confirm a new entry with date and text appears.
  10. Trigger a retrieve command. Confirm the agent pulls past notes and includes them in the reply.
  11. Test notifications. Verify a Telegram message appears in the target chat and an email arrives in your inbox. If not, check credentials, chatId, and email address fields.
  12. If Google Docs shows permission errors, make sure the authenticated account owns or can edit the document. If Telegram does not send, ensure the bot is added to the chat and the chatId is correct.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Gmail

Sign up

No cost: Personal Gmail (Gmail API has no usage-based pricing; quotas apply)

Google Docs

Sign up

Free: $0, Google Docs API usage at no additional cost (quota limits apply)

OpenAI

Sign up

Pay-as-you-go: GPT-5 at $1.25 per 1M input tokens and $10 per 1M output tokens

Telegram

Sign up

Free: $0, Telegram Bot API usage is free for developers

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.