How to retrieve Google Docs ID/URL and automate content creation from Telegram to Google Docs

Hey everyone,

I have a couple of questions and would appreciate any guidance:

  1. Google Docs ID/URL:
    I’m trying to get the Google Docs ID and send it to Telegram. I’ve already experimented with Google Drive to download the docs, but I’m unsure how to retrieve the Docs ID or Docs URL. Could someone point me in the right direction?
  2. Filling Google Docs Content from Telegram:
    I’m also exploring whether it’s possible to fill Google Docs content based on user interactions in Telegram. Here’s the context:
  • I’m building an AI agent to assist in coding.
  • The AI agent interacts with users via Telegram, asking questions about the project (e.g., requirements, details, etc.).
  • The output of this process should be two Google Docs: a PRD (Product Requirements Document) and a Cursor AI Coding Plan.
  • These docs need to be sent back to Telegram once completed.

Is this achievable with n8n? If so, could someone share insights or examples on how to set this up?

Any help or suggestions would be greatly appreciated! Thanks in advance.

N8N version: 1.81.0

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Retrieving Google Docs ID

After uploading a document to Google Drive using n8n, you can easily obtain the document ID:

  1. In the Google Drive node output, look for the id field.
  2. This id is a unique identifier for the document in Google Drive.
  3. Example: 1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7

You can access this ID using an expression like:

text sample here paste it as expression:

{{$node["Google Drive"].json["id"]}}

Updating Google Docs Content

Updating the content of an existing Google Doc is challenging through the standard Google Drive node. Here’s a workaround:

  1. Use the “Write File” operation to modify the content locally.
  2. Upload the modified file to Google Drive as a new document.

Note: This method creates a new file rather than updating the existing one. You can update some metadata (like name) of the original file, but modifying its content directly is not straightforward with the current n8n Google Drive node.

Alternative Approach:

For more direct content updates, consider using the Google Docs API through an HTTP Request node. This requires additional setup but allows for in-place document editing.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.