Thank you @rbreen
I think your example is a bit different from what I need here is my flow:
{
“name”: “My Sub-workflow”,
“nodes”: [
{
“parameters”: {
“operation”: “getAll”,
“limit”: 10,
“simple”: false,
“filters”: {
“sender”: “``alertasynotificaciones@bancolombia.com.co``”
},
“options”: {}
},
“type”: “n8n-nodes-base.gmail”,
“typeVersion”: 2.1,
“position”: [
-608,
-736
],
“id”: “c85dc61d-5c8d-496a-b9ae-be8f084c100e”,
“name”: “Get many messages”,
“webhookId”: “cbf4d93a-7245-4f71-8090-62c3dc0ea53a”,
“retryOnFail”: true,
“credentials”: {
“gmailOAuth2”: {
“id”: “FdWZxOiO8N6fKdxn”,
“name”: “Gmail account”
}
}
},
{
“parameters”: {
“jsCode”: “const items = $input.all(); // 👈 todos los items que llegan\nconst results = ;\n\nfor (const item of items) {\n const id = String(item.json.id || ""); // forzar a string\n const html = String(item.json.html || item.json.text || "");\n\n let textoPlano = html\n .replace(/<br\s*\/?>/gi, "\n")\n .replace(/<\/p>/gi, "\n")\n .replace(/<script[\s\S]?<\/script>/gi, "")\n .replace(/<style[\s\S]?<\/style>/gi, "")\n .replace(/<[^>]+>/g, "")\n .replace(/\n\s*\n/g, "\n")\n .trim();\n\n results.push({\n json: {\n id: id,\n texto: textoPlano\n }\n });\n}\n\nreturn results;\n”
},
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
-432,
-736
],
“id”: “84c13265-6366-479c-aff3-24c82f661ac9”,
“name”: “HTML to text”
},
{
“parameters”: {
“conditions”: {
“options”: {
“caseSensitive”: true,
“leftValue”: “”,
“typeValidation”: “strict”,
“version”: 2
},
“conditions”: [
{
“id”: “db5a58c3-252d-4d46-8a22-5da3b7f003ed”,
“leftValue”: “={{ $json.id }}”,
“rightValue”: “={{ $json.mov_id }}”,
“operator”: {
“type”: “string”,
“operation”: “notEquals”
}
}
],
“combinator”: “and”
},
“options”: {}
},
“type”: “n8n-nodes-base.if”,
“typeVersion”: 2.2,
“position”: [
-112,
-736
],
“id”: “a35247f9-e33e-41f7-8434-26dd32c7fcc9”,
“name”: “If”
},
{
“parameters”: {
“documentId”: {
“__rl”: true,
“value”: “``https://docs.google.com/spreadsheets/d/1LvWDO6jjORvLnBVYAwNQCPO8ouUpjph6UVq42rrxWgg/edit?gid=0#gid=0”``,
“mode”: “url”
},
“sheetName”: {
“__rl”: true,
“value”: 1912928006,
“mode”: “list”,
“cachedResultName”: “Mov Ids”,
“cachedResultUrl”: “``https://docs.google.com/spreadsheets/d/1LvWDO6jjORvLnBVYAwNQCPO8ouUpjph6UVq42rrxWgg/edit#gid=1912928006”
},
“options”: {
“outputFormatting”: {
“values”: {
“general”: “FORMATTED_VALUE”,
“date”: “FORMATTED_STRING”
}
}
}
},
“type”: “n8n-nodes-base.googleSheets”,
“typeVersion”: 4.7,
“position”: [
-608,
-912
],
“id”: “f9a546a7-2f96-4d6d-b957-63b9c10a2aca”,
“name”: “Get_Transaction_ID”,
“credentials”: {
“googleSheetsOAuth2Api”: {
“id”: “uEcvCTjsqi9rVjTn”,
“name”: “Google Sheets account”
}
}
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “b7abc1e4-299c-4b0b-b512-2e7dad34c7d3”,
“name”: “mov_id”,
“value”: “={{ $json.mov_id }}”,
“type”: “string”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
-416,
-912
],
“id”: “cf0253be-29c7-4687-a0d8-ede6133562d4”,
“name”: “Edit Fields”
},
{
“parameters”: {
“mode”: “combine”,
“advanced”: true,
“mergeByFields”: {
“values”: [
{
“field1”: “mov_id”,
“field2”: “id”
}
]
},
“joinMode”: “keepNonMatches”,
“options”: {}
},
“type”: “n8n-nodes-base.merge”,
“typeVersion”: 3.2,
“position”: [
-128,
-928
],
“id”: “a0f5d336-70b4-46d5-b642-bfae287ee493”,
“name”: “Merge”
},
{
“parameters”: {
“inputSource”: “passthrough”
},
“id”: “37340b75-107c-4c4b-8022-70a110473d76”,
“typeVersion”: 1.1,
“name”: “Start”,
“type”: “n8n-nodes-base.executeWorkflowTrigger”,
“position”: [
-816,
-736
]
}
],
“pinData”: {},
“connections”: {
“Get many messages”: {
“main”: [
[
{
“node”: “HTML to text”,
“type”: “main”,
“index”: 0
}
]
]
},
“Get_Transaction_ID”: {
“main”: [
[
{
“node”: “Edit Fields”,
“type”: “main”,
“index”: 0
}
]
]
},
“HTML to text”: {
“main”: [
[
{
“node”: “If”,
“type”: “main”,
“index”: 0
},
{
“node”: “Merge”,
“type”: “main”,
“index”: 1
}
]
]
},
“Edit Fields”: {
“main”: [
[
{
“node”: “If”,
“type”: “main”,
“index”: 0
},
{
“node”: “Merge”,
“type”: “main”,
“index”: 0
}
]
]
},
“Start”: {
“main”: [
[
{
“node”: “Get many messages”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“active”: false,
“settings”: {
“executionOrder”: “v1”
},
“versionId”: “4ce757ee-44a5-4e3a-9358-8c634550c2eb”,
“meta”: {
“instanceId”: “c252c3b7f0f4cd189e23fa962db89f953d006db0fbfe50d8ec33877d17846751”
},
“id”: “XeGFF333e62CtpVz”,
“tags”:
}