{
  "name": "Hildebrand | Outlook Reader",
  "nodes": [
    {
      "parameters": {
        "resource": "folderMessage",
        "folderId": {
          "__rl": true,
          "value": "AQMkAGFiZjI2ZGU0LTJlOGMtNGEwYS1iMGZhLWIyMDhjMTU4ZDEyYQAuAAADT7jFUoWSiU_BeHWnLgmXOQEA7w5_Cl-AdkKaJaMlf2mpewAAAgEMAAAA",
          "mode": "list",
          "cachedResultName": "Bandeja de entrada",
          "cachedResultUrl": "https://outlook.office365.com/mail/AQMkAGFiZjI2ZGU0LTJlOGMtNGEwYS1iMGZhLWIyMDhjMTU4ZDEyYQAuAAADT7jFUoWSiU_BeHWnLgmXOQEA7w5_Cl%2FAdkKaJaMlf2mpewAAAgEMAAAA"
        },
        "output": "raw",
        "filtersUI": {
          "values": {
            "filters": {
              "hasAttachments": true,
              "readStatus": "unread",
              "receivedAfter": "=2025-08-30T00:00:00.000Z"
            }
          }
        },
        "options": {}
      },
      "type": "n8n-nodes-base.microsoftOutlook",
      "typeVersion": 2,
      "position": [
        368,
        0
      ],
      "id": "29667263-02ea-42d4-b9ca-254fa728e34d",
      "name": "Obtener Correos",
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "messageAttachment",
        "operation": "getAll",
        "messageId": {
          "__rl": true,
          "value": "={{ $(\"Obtener Correos\").item.json.id }}",
          "mode": "id"
        },
        "returnAll": true,
        "options": {
          "fields": []
        }
      },
      "type": "n8n-nodes-base.microsoftOutlook",
      "typeVersion": 2,
      "position": [
        624,
        16
      ],
      "id": "4f87b92b-fd46-404e-b5db-e58e4faa6752",
      "name": "Obtener Attachments",
      "executeOnce": false,
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "messageAttachment",
        "operation": "download",
        "messageId": {
          "__rl": true,
          "value": "={{$(\"Obtener Correos\").item.json.id}}",
          "mode": "id"
        },
        "attachmentId": {
          "__rl": true,
          "value": "={{$(\"Obtener Attachments\").item.json.id}}",
          "mode": "id"
        }
      },
      "type": "n8n-nodes-base.microsoftOutlook",
      "typeVersion": 2,
      "position": [
        880,
        64
      ],
      "id": "f8a51375-dd92-4b3d-948c-e6dbec34a768",
      "name": "Download Attachment",
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://factorhrgenesis.azurewebsites.net/account/login",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\n    \"email\": \"micorreo@empresa.com.py\",\n    \"password\": \"MiPasswordSeguro\"\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        192,
        0
      ],
      "id": "f1488274-b7dd-49f3-a47c-4d54493261ce",
      "name": "Factor RH | Login"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://factorhrgenesis.azurewebsites.net/api/N8nCurriculum/CreateProcessRun",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{$(\"Factor RH | Login\").item.json.token}}"
            }
          ]
        },
        "sendBody": true,
        "contentType": "multipart-form-data",
        "bodyParameters": {
          "parameters": [
            {
              "parameterType": "formBinaryData",
              "name": "FormFile",
              "inputDataFieldName": "data"
            },
            {
              "name": "BusinessId",
              "value": "52"
            },
            {
              "name": "Directory",
              "value": "curriculums"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1152,
        128
      ],
      "id": "f9a72c16-9103-4e8c-b035-652e95ac5297",
      "name": "Factor RH | Crear Proceso de Analisis"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://factorhrgenesis.azurewebsites.net/api/N8nCurriculum/UpdateProcessRunWithOutLookEmailData",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{$(\"Factor RH | Login\").item.json.token}}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ { processRunId: $(\"Preparar Objeto Email y Process Run\").item.json.processRunId, email: JSON.parse($(\"Preparar Objeto Email y Process Run\").item.json.email) } }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1152,
        576
      ],
      "id": "e42ee3c8-9df0-4b19-9b44-ee03047a9fba",
      "name": "Factor RH | Update Process Run With EmailData"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "dd9b04e8-659c-4d5c-a4e7-10c4d44fa07b",
              "name": "processRunId",
              "value": "={{$(\"Factor RH | Crear Proceso de Analisis\").item.json.processRunId}}",
              "type": "number"
            },
            {
              "id": "9fa2b942-5385-4646-9e57-810b6af936e0",
              "name": "email",
              "value": "={{ $(\"Obtener Correos\").item.json }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1152,
        368
      ],
      "id": "4a518ab6-7297-467a-abe7-c0caf96715f9",
      "name": "Preparar Objeto Email y Process Run"
    },
    {
      "parameters": {
        "operation": "update",
        "messageId": {
          "__rl": true,
          "value": "={{ JSON.parse($(\"Preparar Objeto Email y Process Run\").item.json.email).id }}",
          "mode": "id"
        },
        "updateFields": {
          "isRead": true
        }
      },
      "type": "n8n-nodes-base.microsoftOutlook",
      "typeVersion": 2,
      "position": [
        1152,
        800
      ],
      "id": "fdf179dc-dabf-4cd7-a453-8e13c68af099",
      "name": "Marcar Como Leido",
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -16,
        0
      ],
      "id": "bab98d60-e54f-4c33-9432-9014b181de34",
      "name": "Schedule Trigger"
    }
  ],
  "connections": {
    "Obtener Correos": {
      "main": [
        [
          {
            "node": "Obtener Attachments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Obtener Attachments": {
      "main": [
        [
          {
            "node": "Download Attachment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Attachment": {
      "main": [
        [
          {
            "node": "Factor RH | Crear Proceso de Analisis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Factor RH | Login": {
      "main": [
        [
          {
            "node": "Obtener Correos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Factor RH | Crear Proceso de Analisis": {
      "main": [
        [
          {
            "node": "Preparar Objeto Email y Process Run",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Factor RH | Update Process Run With EmailData": {
      "main": [
        [
          {
            "node": "Marcar Como Leido",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Preparar Objeto Email y Process Run": {
      "main": [
        [
          {
            "node": "Factor RH | Update Process Run With EmailData",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Marcar Como Leido": {
      "main": [
        []
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Factor RH | Login",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "aaa22331-11ca-4245-b500-51d6000fd63e",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "4ZvYDgGO3XrJIjWu",
  "tags": []
}