个人 - 申请 TRM
高级
这是一个Finance, AI领域的自动化工作流,包含 31 个节点。主要使用 If, Set, Code, Sort, Limit 等节点,结合人工智能技术实现智能自动化。 通过 Telegram 机器人和 AI 日期识别获取哥伦比亚比索兑美元汇率
前置要求
- •Telegram Bot Token
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
使用的节点 (31)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "MVcw4IwqLxTDzdt5",
"meta": {
"instanceId": "51270372ea87f40bc06437a6d111ae29e684e524a2e6c52d7a6f84dde18d4a17",
"templateCredsSetupCompleted": true
},
"name": "个人 - 申请 TRM",
"tags": [],
"nodes": [
{
"id": "f1d44561-9c6a-4e5d-835b-630e858a3181",
"name": "OpenAI 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1140,
-620
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-nano",
"cachedResultName": "gpt-4.1-nano"
},
"options": {
"maxRetries": 2,
"temperature": 0
}
},
"credentials": {
"openAiApi": {
"id": "BfhecJBx32L0a2gT",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "2b3a4c40-77b2-48d3-a2af-8fc084d24183",
"name": "当收到 Telegram 消息时",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-400,
-840
],
"webhookId": "76fd085e-cba0-40ab-9937-3efb9057d4de",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "xxxxxxx",
"name": "name_bot"
}
},
"typeVersion": 1.2
},
{
"id": "d8686b18-59d7-461d-a24a-d8f44703db2c",
"name": "本地当前日期和时间",
"type": "n8n-nodes-base.code",
"position": [
920,
-840
],
"parameters": {
"jsCode": "const now = new Date();\n\n// Ajustar a hora local de Colombia (UTC-5)\nconst utc = now.getTime() + now.getTimezoneOffset() * 60000;\nconst colombiaTime = new Date(utc - 5 * 3600000);\n\n// Formato YYYY-MM-DD\nconst fecha = colombiaTime.toISOString().split('T')[0];\n\n// Formato YYYY-MM-DD HH:mm:ss\nconst fechaHora = colombiaTime.toISOString().replace('T', ' ').substring(0, 19);\n\nreturn [\n {\n json: {\n fecha_actual: fecha,\n fecha_hora_actual: fechaHora,\n }\n }\n];"
},
"typeVersion": 2
},
{
"id": "022626cd-5a65-4225-9307-817a024799c2",
"name": "验证日期是否为过去日期",
"type": "n8n-nodes-base.if",
"position": [
1700,
-840
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "b245d771-5b2e-4384-8357-0357e5a1ce2e",
"operator": {
"type": "dateTime",
"operation": "after"
},
"leftValue": "={{ $json.output.date }}",
"rightValue": "={{ $('Local Current Date and Time').item.json.fecha_actual }}"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "f40edcdb-ff34-491e-b460-f09353aba40f",
"name": "通知过去日期",
"type": "n8n-nodes-base.telegram",
"position": [
1920,
-940
],
"webhookId": "4761d2c3-62ee-413d-b114-67ef7a49f4eb",
"parameters": {
"text": "=Fecha posterior a fecha actual",
"chatId": "={{ $('Once a Telegram Message is received').item.json.message.from.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "xxxxxx",
"name": "name_bot"
}
},
"typeVersion": 1.2
},
{
"id": "9d8c17b5-ce7f-40c0-8e35-64b9b42927f5",
"name": "获取 TRM",
"type": "n8n-nodes-base.httpRequest",
"position": [
1920,
-740
],
"parameters": {
"url": "=https://www.datos.gov.co/resource/32sa-8pi3.json?vigenciadesde={{ $json.output.date }}",
"options": {}
},
"typeVersion": 4.2,
"alwaysOutputData": true
},
{
"id": "cd58e419-7d3a-4314-afa3-9fde3c7e998b",
"name": "检查 Valor 是否存在",
"type": "n8n-nodes-base.if",
"position": [
2140,
-740
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "9f3ed730-0414-4f19-9941-2e6663ae221c",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.valor }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "1813eccf-36ae-4201-bbbd-3bc6ebf63e3d",
"name": "向用户发送消息",
"type": "n8n-nodes-base.telegram",
"position": [
2360,
-840
],
"webhookId": "4761d2c3-62ee-413d-b114-67ef7a49f4eb",
"parameters": {
"text": "={{ $json.valor }}\nTRM del {{ $('Extractor Agent').item.json.output.date }}",
"chatId": "={{ $('Once a Telegram Message is received').item.json.message.from.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "xxxxxx",
"name": "name_bot"
}
},
"typeVersion": 1.2
},
{
"id": "93bb62fb-6e42-4498-a758-4d99ea54a852",
"name": "生成包含10个数字的数组",
"type": "n8n-nodes-base.code",
"position": [
2360,
-640
],
"parameters": {
"jsCode": "// Generar array del 1 al 10\nconst counter = Array.from({ length: 10 }, (_, i) => i + 1);\n\n// Devolver el resultado en el formato adecuado\nreturn [\n {\n json: {\n counter\n }\n }\n];"
},
"typeVersion": 2
},
{
"id": "c85942c6-1627-49d4-8f62-ffda4f08c6f1",
"name": "为循环拆分项目",
"type": "n8n-nodes-base.splitOut",
"position": [
2580,
-640
],
"parameters": {
"options": {},
"fieldToSplitOut": "counter"
},
"typeVersion": 1
},
{
"id": "9c57b15e-958e-4b1a-ac30-701e7b874319",
"name": "获取最近10个响应",
"type": "n8n-nodes-base.splitInBatches",
"position": [
2800,
-640
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "59168aad-9ec1-4dc9-9c46-85c1cf4f40a6",
"name": "获取过去日期的 TRM",
"type": "n8n-nodes-base.httpRequest",
"position": [
3240,
-490
],
"parameters": {
"url": "=https://www.datos.gov.co/resource/32sa-8pi3.json?vigenciadesde={{ $json.adjustedDate }}",
"options": {}
},
"typeVersion": 4.2,
"alwaysOutputData": true
},
{
"id": "9a802ea6-8591-4229-840e-b2789e1ef4b5",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
3420,
-500
],
"parameters": {
"color": 4,
"width": 400,
"height": 180,
"content": "## 循环的原因"
},
"typeVersion": 1
},
{
"id": "ca8cae67-d0e1-4bb5-94b6-80c3d00f0b5c",
"name": "转换日期",
"type": "n8n-nodes-base.code",
"position": [
3020,
-640
],
"parameters": {
"jsCode": "const items = $input.all();\nlet counter = $input.first().json.counter;\n\nreturn items.map(item => {\n const originalDate = new Date($('Validate if Date is in the past').item.json.output.date);\n originalDate.setDate(originalDate.getDate() - counter);\n const adjustedDate = originalDate.toISOString().split('T')[0];\n\n const result = {\n ...item.json,\n adjustedDate,\n loopCounter: counter\n };\n\n counter++;\n return { json: result };\n});"
},
"typeVersion": 2
},
{
"id": "370fd786-7611-4148-be16-df28ef18c637",
"name": "获取非空行",
"type": "n8n-nodes-base.filter",
"position": [
3020,
-840
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "2de92428-e76f-4a46-a67a-e28b3fefc845",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.valor }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2,
"alwaysOutputData": true
},
{
"id": "f468d509-68c5-4d78-b22d-86950d1a9792",
"name": "排序最新数据",
"type": "n8n-nodes-base.sort",
"position": [
3460,
-1040
],
"parameters": {
"options": {},
"sortFieldsUi": {
"sortField": [
{
"order": "descending",
"fieldName": "vigenciadesde"
}
]
}
},
"typeVersion": 1
},
{
"id": "7696b138-dff9-4b08-848f-81d70422779a",
"name": "获取最后数据",
"type": "n8n-nodes-base.limit",
"position": [
3680,
-1040
],
"parameters": {},
"typeVersion": 1
},
{
"id": "5fdafe49-ecec-45ac-8e58-f71951bdbacd",
"name": "发送当前 TRM",
"type": "n8n-nodes-base.telegram",
"position": [
3900,
-1040
],
"webhookId": "4761d2c3-62ee-413d-b114-67ef7a49f4eb",
"parameters": {
"text": "={{ $json.valor }}\nTRM del {{ $('Extractor Agent').item.json.output.date }}",
"chatId": "={{ $('Once a Telegram Message is received').item.json.message.from.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "xxxxxxxx",
"name": "name_bot"
}
},
"typeVersion": 1.2
},
{
"id": "cb29d564-95cd-4a66-b4a6-9f6ee5204452",
"name": "如果",
"type": "n8n-nodes-base.if",
"position": [
3240,
-840
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "d8eff85a-bedc-4363-a46b-5ec32953113f",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.valor }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "dee431c6-80ee-4f37-a291-61b5ee74557e",
"name": "发送无数据",
"type": "n8n-nodes-base.telegram",
"position": [
3460,
-840
],
"webhookId": "4761d2c3-62ee-413d-b114-67ef7a49f4eb",
"parameters": {
"text": "=No existe información para la fecha proporcionada: {{ $('Extractor Agent').item.json.output.date }}",
"chatId": "={{ $('Once a Telegram Message is received').item.json.message.from.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "xxxxxxx",
"name": "name_bot"
}
},
"typeVersion": 1.2
},
{
"id": "d3bef604-c465-48da-8f0b-50a47896968a",
"name": "计算器",
"type": "@n8n/n8n-nodes-langchain.toolCalculator",
"position": [
1260,
-620
],
"parameters": {},
"typeVersion": 1
},
{
"id": "08e70a77-6801-4beb-b81f-766404cb992a",
"name": "思考",
"type": "@n8n/n8n-nodes-langchain.toolThink",
"position": [
1380,
-620
],
"parameters": {},
"typeVersion": 1
},
{
"id": "ffd80923-e0e2-4198-8ce5-66bff53993fe",
"name": "提取代理",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1232,
-840
],
"parameters": {
"text": "={{ $('Edit Fields').item.json.text }}",
"options": {
"systemMessage": "=Eres un algoritmo experto en extracción de información.\nFecha actual: {{ $json.fecha_actual }}\nTu tarea es identificar y extraer fechas mencionadas en un texto escrito en español, incluso si están redactadas de forma natural o ambigua.\nSigue estas reglas:\n\t•\tSi el texto menciona una fecha explícita o relativa (por ejemplo: “20 de mayo”, “el 17”, “ayer”, “antier”, “hoy”), extrae la fecha en formato AAAA-MM-DD.\n\t•\tSi una fecha no incluye el año, asume el año actual.\n\t•\tSi no incluye ni mes ni año, asume el mes y año actuales.\n\t•\tSi el texto no contiene una fecha clara pero es ambiguo (como “Hola”, “ok”, “listo”, “gracias”), devuelve la fecha actual.\n\t•\tNo generes ningún texto adicional, solo la fecha en formato AAAA-MM-DD."
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.9
},
{
"id": "8b49d5c6-ce05-4ca9-a231-0bd4686040bf",
"name": "仅文本",
"type": "n8n-nodes-base.set",
"position": [
480,
-740
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "311e21c9-7edc-446d-9857-c9e60a429678",
"name": "text",
"type": "string",
"value": "={{ $json.message.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "e586891d-2af9-4a04-bb40-3b3f3f216bf4",
"name": "音频文本",
"type": "n8n-nodes-base.set",
"position": [
480,
-940
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "49569683-a732-47a9-8fbf-6e6303c03ad1",
"name": "text",
"type": "string",
"value": "={{ $json.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "ff0b076d-9c39-4e98-a71c-a2f3f6df3231",
"name": "编辑字段",
"type": "n8n-nodes-base.set",
"position": [
700,
-840
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "72ede214-3023-459d-8a27-14be602440bf",
"name": "text",
"type": "string",
"value": "={{ $json.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "70c427d1-8f32-49a0-ac32-6cf4a57d92e1",
"name": "结构化输出解析器",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
1500,
-620
],
"parameters": {
"jsonSchemaExample": "{\n\t\"date\": \"2025-04-01\"\n}"
},
"typeVersion": 1.2
},
{
"id": "9cde8b3a-6e49-4843-a11d-e78d46204c4c",
"name": "验证文本或音频",
"type": "n8n-nodes-base.switch",
"position": [
-180,
-840
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "voice",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "eaaa57f6-51e2-41c9-8a56-a78547c0a8c5",
"operator": {
"type": "object",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.voice }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "text",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "1fda3a77-2a23-43b2-aaae-2ed3f0eed1f6",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.message.text }}",
"rightValue": ""
}
]
},
"renameOutput": true
}
]
},
"options": {
"fallbackOutput": "none"
}
},
"typeVersion": 3.2
},
{
"id": "75fc07c0-455c-490a-8ac9-422ddfee9b48",
"name": "下载音频",
"type": "n8n-nodes-base.telegram",
"position": [
40,
-940
],
"webhookId": "d8240579-0461-483d-8ed0-93ddce22a1cd",
"parameters": {
"fileId": "={{ $json.message.voice.file_id }}",
"resource": "file"
},
"credentials": {
"telegramApi": {
"id": "xxxxxxx",
"name": "name_bot"
}
},
"typeVersion": 1.2
},
{
"id": "47379a28-148b-4a36-8f06-4c994613d83c",
"name": "转录音频",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
260,
-940
],
"parameters": {
"options": {
"language": "es",
"temperature": 0
},
"resource": "audio",
"operation": "transcribe",
"binaryPropertyName": "=data"
},
"credentials": {
"openAiApi": {
"id": "BfhecJBx32L0a2gT",
"name": "OpenAi account"
}
},
"typeVersion": 1.8
},
{
"id": "1e3e8207-fc34-4c83-8fb4-8aa7a4639c4b",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-900,
-1700
],
"parameters": {
"color": 3,
"width": 840,
"height": 780,
"content": "# 📌 工作流:请求 TRM(代表性市场汇率)"
},
"typeVersion": 1
}
],
"active": true,
"pinData": {
"Once a Telegram Message is received": [
{
"json": {
"message": {
"chat": {
"id": 6162094450,
"type": "private",
"first_name": "Juan"
},
"date": 1747764561,
"from": {
"id": 6162094450,
"is_bot": false,
"first_name": "Juan",
"language_code": "en"
},
"text": "enviame un audio",
"message_id": 61
},
"update_id": 612273063
}
}
]
},
"settings": {
"callerPolicy": "workflowsFromSameOwner",
"executionOrder": "v1",
"executionTimeout": 60
},
"versionId": "1141769b-3bb4-4f42-8bcf-d8c64ae27cd6",
"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
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 财务, 人工智能
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
[模板] AI宠物店 v8
🐶 AI宠物店助手 - 集成GPT-4o、Google日历和WhatsApp/Instagram/Facebook
If
N8n
Set
+38
244 节点Amanda Benks
销售
AI 代理餐厅 [模板]
🤖 WhatsApp、Instagram 和 Messenger 的 AI 餐厅助手
If
N8n
Set
+37
239 节点Amanda Benks
其他
GPT-4驱动的冷邮件工作流,包含完全定制的3封邮件跟进
使用GPT-4、Mailgun和Supabase自动化个性化冷邮件序列
If
Set
Code
+22
100 节点Paul
客户培育
完整的 B2B 销售流程:Apollo 潜在客户生成、Mailgun 外展和 AI 回复管理
完整的 B2B 销售流程:Apollo 潜在客户生成、Mailgun 外展和 AI 回复管理
If
Set
Code
+26
116 节点Paul
内容创作
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
哥伦比亚发票处理
使用Gmail、GPT-4o和Google Workspace提取并整理哥伦比亚发票
Xml
Code
Merge
+15
23 节点Juan Sanchez
财务
工作流信息
难度等级
高级
节点数量31
分类2
节点类型19
作者
Juan Sanchez
@juansaveExperienced cloud solutions professional with a strong focus on Microsoft technologies, including Microsoft 365, Azure, Entra, and the Power Platform. Skilled in designing and implementing automation using Power Automate and PowerShell. Proven track record in sales, marketing, and delivering managed services for cloud environments. Passionate about digital transformation, AI integration, and streamlining business processes through low-code platforms.
外部链接
在 n8n.io 查看 →
分享此工作流