Back to Templates 
This n8n workflow receives files sent in a Telegram chat, uploads them to Google Drive, extracts text using OCR (for images and PDFs), and stores the extracted content in Airtable for quick search and retrieval.
Users can later search through documents using a Telegram /search command.
/search command in Telegram| Step | Action | Description | 
|---|---|---|
| 1 | Telegram Trigger | Detects incoming docs/images or /search command | 
| 2 | Filter File or Search | Routes based on whether message has file or search command | 
| 3 | Extract Metadata | Reads file info such as name, MIME type, user | 
| 4 | Download File | Downloads file via Telegram API | 
| 5 | Upload to Drive | Saves file in Google Drive | 
| 6 | OCR Check | Determines if file supports OCR | 
| 7 | Google OCR | Runs OCR for images/PDFs | 
| 8 | Extract Text | Pulls text output from OCR | 
| 9 | Merge OCR Text | Combines file data + text | 
| 10 | Save to Airtable | Indexes with metadata + text | 
| 11 | Success Reply | Sends link + success message | 
| 12 | /search Flow | 
Parse search query | 
| 13 | Airtable Search | Full-text search for records | 
| 14 | Send Results | Sends matches to Telegram | 
| 15 | Error Handler | Notifies user on failure | 
/search keyword
Example:
/search invoice
✅ File saved & indexed successfully!
🔗 Drive Link: <link>
Returns structured result:
| Field | Description | 
|---|---|
| File Name | Original name | 
| File Link | Google Drive link | 
| MIME Type | File type | 
| Telegram User | Sender info | 
| OCR Text | Extracted searchable text | 
| Uploaded Date | Timestamp | 
✅ Ready for production
✅ Handles images, PDFs, and files
✅ End-to-end automation
🛠 Optional: add more AI enrichment later