This workflow turns Google Docs-based contract & form templates into ready-to-sign PDFs in minutes—all from a single chat flow.
📝 Template Discovery
📂 The TemplateList node scans the Drive folder you specify via the ?mode=meta
endpoint and returns an id / title / desc
list. The bot shows this list in chat.
🎯 Selection & Metadata Fetch
The user types a template name.
🔍 GetMetaData opens the chosen Doc, extracts META_JSON
, placeholders, and conditional blocks, then lists mandatory & optional fields.
🗣 Data-Collection Loop
The bot asks for every placeholder value.
For each conditional block it asks 🟢 Yes / 🔴 No.
Answers are accumulated in a data
JSON object.
✅ Final Confirmation
The bot summarizes the inputs → when the user clicks Confirm, the DocProcess sub-workflow starts.
⚙️ DocProcess Sub-Workflow
🔧 Step | Node | Task |
---|---|---|
1 | User Choice Match Check | Verifies name–ID match; throws if wrong |
2 | GetMetaData (renew) | Gets the latest placeholder list |
3 | Validate JSON Format | Checks for missing / unknown fields |
4 | CopyTemplate | Copies the Doc via Drive API |
5 | FillDocument | Apps Script fills placeholders & removes blocks |
6 | Generate PDF Link | Builds an export?format=pdf URL |
📎 Delivery
The master agent sends 🔗 Download PDF & ✏️ Open Google Doc links.
🚫 Error Paths
status:"ERROR", missing:[…]
→ bot lists missing fields and re-asks.unknown:[…]
→ template list is outdated; rerun TemplateList.message
is shown verbatim in chat.Goal: Get a flawless PDF on the first run.
Mentally tick the ☑️ in front of every line as you go.