{
  "name": "Get Colombian peso to USD exchange rate with Telegram bot and AI date recognition",
  "nodes": [
    {
      "id": "f1d44561-9c6a-4e5d-835b-630e858a3181",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1140,
        -620
      ]
    },
    {
      "id": "2b3a4c40-77b2-48d3-a2af-8fc084d24183",
      "name": "Once a Telegram Message is received",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -400,
        -840
      ]
    },
    {
      "id": "d8686b18-59d7-461d-a24a-d8f44703db2c",
      "name": "Local Current Date and Time",
      "type": "n8n-nodes-base.code",
      "position": [
        920,
        -840
      ]
    },
    {
      "id": "022626cd-5a65-4225-9307-817a024799c2",
      "name": "Validate if Date is in the past",
      "type": "n8n-nodes-base.if",
      "position": [
        1700,
        -840
      ]
    },
    {
      "id": "f40edcdb-ff34-491e-b460-f09353aba40f",
      "name": "Notify past date",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1920,
        -940
      ]
    },
    {
      "id": "9d8c17b5-ce7f-40c0-8e35-64b9b42927f5",
      "name": "Get TRM",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1920,
        -740
      ]
    },
    {
      "id": "cd58e419-7d3a-4314-afa3-9fde3c7e998b",
      "name": "Check if Valor exists",
      "type": "n8n-nodes-base.if",
      "position": [
        2140,
        -740
      ]
    },
    {
      "id": "1813eccf-36ae-4201-bbbd-3bc6ebf63e3d",
      "name": "Send message to user",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2360,
        -840
      ]
    },
    {
      "id": "93bb62fb-6e42-4498-a758-4d99ea54a852",
      "name": "Generate an array with 10 numbers",
      "type": "n8n-nodes-base.code",
      "position": [
        2360,
        -640
      ]
    },
    {
      "id": "c85942c6-1627-49d4-8f62-ffda4f08c6f1",
      "name": "Split Items for the loop",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2580,
        -640
      ]
    },
    {
      "id": "9c57b15e-958e-4b1a-ac30-701e7b874319",
      "name": "Get the last 10 responses",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        2800,
        -640
      ]
    },
    {
      "id": "59168aad-9ec1-4dc9-9c46-85c1cf4f40a6",
      "name": "Get TRM for past date",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3240,
        -490
      ]
    },
    {
      "id": "9a802ea6-8591-4229-840e-b2789e1ef4b5",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3420,
        -500
      ],
      "parameters": {
        "width": 400,
        "height": 180,
        "content": "## Reason for Loop\nSome TRM are valid for several days, like during weekends or holidays, so 10 days are validated to grab the last available TRM"
      }
    },
    {
      "id": "ca8cae67-d0e1-4bb5-94b6-80c3d00f0b5c",
      "name": "Convert date",
      "type": "n8n-nodes-base.code",
      "position": [
        3020,
        -640
      ]
    },
    {
      "id": "370fd786-7611-4148-be16-df28ef18c637",
      "name": "Get non-empty rows",
      "type": "n8n-nodes-base.filter",
      "position": [
        3020,
        -840
      ]
    },
    {
      "id": "f468d509-68c5-4d78-b22d-86950d1a9792",
      "name": "Sort most recent data",
      "type": "n8n-nodes-base.sort",
      "position": [
        3460,
        -1040
      ]
    },
    {
      "id": "7696b138-dff9-4b08-848f-81d70422779a",
      "name": "Get the last data",
      "type": "n8n-nodes-base.limit",
      "position": [
        3680,
        -1040
      ]
    },
    {
      "id": "5fdafe49-ecec-45ac-8e58-f71951bdbacd",
      "name": "Send current TRM",
      "type": "n8n-nodes-base.telegram",
      "position": [
        3900,
        -1040
      ]
    },
    {
      "id": "cb29d564-95cd-4a66-b4a6-9f6ee5204452",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        3240,
        -840
      ]
    },
    {
      "id": "dee431c6-80ee-4f37-a291-61b5ee74557e",
      "name": "Send no data",
      "type": "n8n-nodes-base.telegram",
      "position": [
        3460,
        -840
      ]
    },
    {
      "id": "d3bef604-c465-48da-8f0b-50a47896968a",
      "name": "Calculator",
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "position": [
        1260,
        -620
      ]
    },
    {
      "id": "08e70a77-6801-4beb-b81f-766404cb992a",
      "name": "Think",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        1380,
        -620
      ]
    },
    {
      "id": "ffd80923-e0e2-4198-8ce5-66bff53993fe",
      "name": "Extractor Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1232,
        -840
      ]
    },
    {
      "id": "8b49d5c6-ce05-4ca9-a231-0bd4686040bf",
      "name": "Text only",
      "type": "n8n-nodes-base.set",
      "position": [
        480,
        -740
      ]
    },
    {
      "id": "e586891d-2af9-4a04-bb40-3b3f3f216bf4",
      "name": "Audio Text",
      "type": "n8n-nodes-base.set",
      "position": [
        480,
        -940
      ]
    },
    {
      "id": "ff0b076d-9c39-4e98-a71c-a2f3f6df3231",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        700,
        -840
      ]
    },
    {
      "id": "70c427d1-8f32-49a0-ac32-6cf4a57d92e1",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1500,
        -620
      ]
    },
    {
      "id": "9cde8b3a-6e49-4843-a11d-e78d46204c4c",
      "name": "Validate Text or Audio",
      "type": "n8n-nodes-base.switch",
      "position": [
        -180,
        -840
      ]
    },
    {
      "id": "75fc07c0-455c-490a-8ac9-422ddfee9b48",
      "name": "Download Audio",
      "type": "n8n-nodes-base.telegram",
      "position": [
        40,
        -940
      ]
    },
    {
      "id": "47379a28-148b-4a36-8f06-4c994613d83c",
      "name": "Transcribe Audio",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        260,
        -940
      ]
    },
    {
      "id": "1e3e8207-fc34-4c83-8fb4-8aa7a4639c4b",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -900,
        -1700
      ],
      "parameters": {
        "width": 840,
        "height": 780,
        "content": "# 📌 Workflow: Request TRM (Representative Market Rate)\n\n## 🎯 Objective\n\nRetrieve the TRM (Colombian Peso to US Dollar exchange rate) for a specific date provided by the user via Telegram.\n\n## 🔄 Summar"
      }
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Sort most recent data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send no data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Think": {
      "ai_tool": [
        [
          {
            "node": "Extractor Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get TRM": {
      "main": [
        [
          {
            "node": "Check if Valor exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Text only": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Audio Text": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "Extractor Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Local Current Date and Time",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert date": {
      "main": [
        [
          {
            "node": "Get TRM for past date",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Audio": {
      "main": [
        [
          {
            "node": "Transcribe Audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extractor Agent": {
      "main": [
        [
          {
            "node": "Validate if Date is in the past",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe Audio": {
      "main": [
        [
          {
            "node": "Audio Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get the last data": {
      "main": [
        [
          {
            "node": "Send current TRM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Extractor Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get non-empty rows": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if Valor exists": {
      "main": [
        [
          {
            "node": "Send message to user",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Generate an array with 10 numbers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get TRM for past date": {
      "main": [
        [
          {
            "node": "Get the last 10 responses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sort most recent data": {
      "main": [
        [
          {
            "node": "Get the last data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Text or Audio": {
      "main": [
        [
          {
            "node": "Download Audio",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Text only",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Items for the loop": {
      "main": [
        [
          {
            "node": "Get the last 10 responses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Extractor Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Get the last 10 responses": {
      "main": [
        [
          {
            "node": "Get non-empty rows",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Convert date",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Local Current Date and Time": {
      "main": [
        [
          {
            "node": "Extractor Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate if Date is in the past": {
      "main": [
        [
          {
            "node": "Notify past date",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get TRM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate an array with 10 numbers": {
      "main": [
        [
          {
            "node": "Split Items for the loop",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Once a Telegram Message is received": {
      "main": [
        [
          {
            "node": "Validate Text or Audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}