Juan Sanchez
Workflows by Juan Sanchez
Get Colombian peso to USD exchange rate with Telegram bot and AI date recognition
# 📌 Request TRM (Colombian Peso to US Dollar exchange rate) ## 🎯 Objective Retrieve the TRM (Colombian Peso to US Dollar exchange rate) for a specific date provided by the user via Telegram. ## 🔄 Summary Flow 1. 📨 **Telegram Message** The user sends a text or audio message to the Telegram Bot. 2. 🧠 **Date Extraction** AI (OpenAI) is used to identify the date in `YYYY-MM-DD` format. 3. 📅 **Validation** If the date is in the future, the user is notified that it is not valid. 4. 📡 **TRM Query** The bot queries the open data API from the Colombian government. 5. 📥 **Result** - ✅ If TRM data exists for that date → The bot replies to the user. - ❌ If not → It searches up to 10 previous days for available data. 6. 📤 **Final Response** The most recent available value is sent, or a message indicating no information is available. ## 🔗 Data Source **datos.gov.co** – [TRM](https://www.datos.gov.co/)
Extract and organize Colombian invoices with Gmail, GPT-4o & Google Workspace
# 🧾 Personal Invoice Processor This N8N workflow automates the extraction and organization of **personal invoices in Colombia** received via **Gmail**. It includes the following key steps: ## 🔁 Flow Summary 1. **Email Trigger** - Polls Gmail every **30 minutes** for emails with `.zip` attachments (assumed to contain invoices). - Expects ZIP file following DIAN standards. 2. **ZIP File Handling** - Extracts all files. - Filters only **PDF** and **XML** files for processing. 3. **Data Extraction & Processing** - Uses **LangChain Agent + OpenAI (GPT-4o-mini)** to extract: - Tipo de documento (Factura / Nota Crédito) - Número de factura - Fecha de emisión (YYYY-MM-DD) - NIT emisor y receptor (sin dígito de verificación) - Razón social del emisor - Subtotal, IVA, Total - CUFE - Resumen de compra (max 20 words, formatted sentence) 4. **Validation** - Ensures **Total = Subtotal + IVA** using a calculator node. 5. **Storage** - Uploads the original PDF to **Google Drive**. - Renames the file to: `YYYY-MM-DD-NUMERO_FACTURA.pdf`. - Inserts or updates invoice details in **Google Sheets** using a unique `Key` (`NIT_Emisor + Numero_Factura`) to prevent duplication. --- > ⚙️ Designed for personal use with minimal latency tolerance and high automation reliability.