{
  "id": "pbcfyhSZVp6vmltk",
  "name": "Tenant Risk & Credit Exposure Prediction with Automated Collection Strategy",
  "tags": [],
  "nodes": [
    {
      "id": "b0775c20-5bf9-42d6-95f7-9c3163bc5567",
      "name": "Daily Risk Assessment Schedule",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -528,
        592
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 2
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "55917262-5a0a-4e3f-9e3f-d920c7c01299",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -304,
        592
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "rentPaymentApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Rent Payment API Endpoint URL__>"
            },
            {
              "id": "id-2",
              "name": "creditBureauApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Credit Bureau API Endpoint URL__>"
            },
            {
              "id": "id-3",
              "name": "employmentApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Employment Records API Endpoint URL__>"
            },
            {
              "id": "id-4",
              "name": "collectionApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Collection System API Endpoint URL__>"
            },
            {
              "id": "id-5",
              "name": "tenantDatabaseApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Tenant Database API Endpoint URL__>"
            },
            {
              "id": "id-6",
              "name": "alertEmailRecipient",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Risk Alert Email Recipient__>"
            },
            {
              "id": "id-7",
              "name": "slackChannel",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Slack Channel ID for Notifications__>"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "e5f3dfe1-f30d-4d9b-8655-6e7ec6c22e28",
      "name": "Fetch Credit Bureau Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -80,
        672
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.creditBureauApiUrl }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "9f71f956-659d-4831-b718-d00acd81b5aa",
      "name": "Merge Tenant Data",
      "type": "n8n-nodes-base.set",
      "position": [
        176,
        592
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "rentPaymentData",
              "type": "object",
              "value": "={{ $('Fetch Rent Payment History').first().json }}"
            },
            {
              "id": "id-2",
              "name": "creditBureauData",
              "type": "object",
              "value": "={{ $('Fetch Credit Bureau Data').first().json }}"
            },
            {
              "id": "id-3",
              "name": "employmentData",
              "type": "object",
              "value": "={{ $('Fetch Employment Records').first().json }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "c291f70c-4649-490c-894c-2263b1453c9e",
      "name": "Risk Analysis AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        368,
        592
      ],
      "parameters": {
        "text": "=Analyze the following tenant data and predict default risk:\n\nRent Payment History: {{ $json.rentPaymentData }}\n\nCredit Bureau Data: {{ $json.creditBureauData }}\n\nEmployment Records: {{ $json.employmentData }}",
        "options": {
          "systemMessage": "You are a tenant risk assessment AI specialized in predicting rental payment default likelihood.\n\nYour task is to:\n1. Analyze rent payment behavior patterns (late payments, missed payments, payment consistency)\n2. Evaluate credit bureau data (credit score, debt-to-income ratio, payment history, bankruptcies)\n3. Assess employment stability (job tenure, income level, employment gaps)\n4. Calculate a comprehensive risk score (0-100, where 100 is highest risk)\n5. Assign a risk level: LOW (0-33), MEDIUM (34-66), or HIGH (67-100)\n6. Predict default probability as a percentage\n7. Recommend action: MONITOR (low risk), CONTACT (medium risk), or COLLECTION (high risk)\n8. Identify key risk factors driving the assessment\n\nConsider these risk indicators:\n- Payment history: Late payments in last 6 months, missed payments, NSF incidents\n- Credit metrics: Score below 600, high debt-to-income ratio, recent delinquencies\n- Employment: Job changes, income reduction, unemployment periods\n- Behavioral patterns: Declining payment timeliness, increasing late fees\n\nProvide a structured risk assessment with actionable recommendations."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3.1
    },
    {
      "id": "6f677afc-d204-45bc-9f78-b24112e186c9",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        384,
        816
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "gpt-4o"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "ac1335e4-12fd-4775-97ea-457915c7f290",
      "name": "Risk Score Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        512,
        816
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"riskScore\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"description\": \"Risk score from 0-100, where 100 is highest risk\"\n\t\t},\n\t\t\"riskLevel\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Risk category: LOW, MEDIUM, or HIGH\"\n\t\t},\n\t\t\"defaultProbability\": {\n\t\t\t\"type\": \"number\",\n\t\t\t\"description\": \"Probability of default as percentage (0-100)\"\n\t\t},\n\t\t\"recommendedAction\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Recommended action: MONITOR, CONTACT, or COLLECTION\"\n\t\t},\n\t\t\"keyRiskFactors\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"items\": {\n\t\t\t\t\"type\": \"string\"\n\t\t\t},\n\t\t\t\"description\": \"List of key risk factors identified\"\n\t\t},\n\t\t\"tenantId\": {\n\t\t\t\"type\": \"string\",\n\t\t\t\"description\": \"Tenant identifier\"\n\t\t}\n\t}\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "91bb5dca-233e-4a80-bb18-646c0a392379",
      "name": "Route by Risk Level",
      "type": "n8n-nodes-base.switch",
      "position": [
        720,
        576
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "High Risk",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.riskLevel }}",
                    "rightValue": "HIGH"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Medium Risk",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.riskLevel }}",
                    "rightValue": "MEDIUM"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Low Risk",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.riskLevel }}",
                    "rightValue": "LOW"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "id": "175af419-1674-4c27-a056-d20a8b977a13",
      "name": "Send High Risk Alert Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        944,
        496
      ],
      "parameters": {
        "sendTo": "={{ $('Workflow Configuration').first().json.alertEmailRecipient }}",
        "message": "=<h2>High Risk Tenant Alert</h2>\n<p><strong>Tenant ID:</strong> {{ $json.tenantId }}</p>\n<p><strong>Risk Score:</strong> {{ $json.riskScore }}/100</p>\n<p><strong>Default Probability:</strong> {{ $json.defaultProbability }}%</p>\n<p><strong>Recommended Action:</strong> {{ $json.recommendedAction }}</p>\n<h3>Key Risk Factors:</h3>\n<ul>\n{{ $json.keyRiskFactors.map(factor => `<li>${factor}</li>`).join(\"\") }}\n</ul>\n<p>Automated collection process has been initiated.</p>",
        "options": {},
        "subject": "=URGENT: High Risk Tenant Alert - {{ $json.tenantId }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "21e20d47-304b-4284-aa27-2e420e78169c",
      "name": "Send Medium Risk Notification",
      "type": "n8n-nodes-base.slack",
      "position": [
        1168,
        688
      ],
      "parameters": {
        "text": "=:warning: *Medium Risk Tenant Detected*\n\n*Tenant ID:* {{ $json.tenantId }}\n*Risk Score:* {{ $json.riskScore }}/100\n*Default Probability:* {{ $json.defaultProbability }}%\n*Recommended Action:* {{ $json.recommendedAction }}\n\n*Key Risk Factors:*\n{{ $json.keyRiskFactors.map(factor => `\u2022 ${factor}`).join(\"\\n\") }}\n\nPlease review and consider proactive outreach.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Workflow Configuration').first().json.slackChannel }}"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "2a08cda8-1017-4ca7-940c-2e37b95c292d",
      "name": "Trigger Automated Collection",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1168,
        496
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.collectionApiUrl }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"tenantId\": \"{{ $json.tenantId }}\",\n  \"riskScore\": {{ $json.riskScore }},\n  \"defaultProbability\": {{ $json.defaultProbability }},\n  \"action\": \"INITIATE_COLLECTION\",\n  \"priority\": \"HIGH\",\n  \"keyRiskFactors\": {{ JSON.stringify($json.keyRiskFactors) }}\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "f78c195c-d495-493b-8c00-91de3b7535ed",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -624,
        384
      ],
      "parameters": {
        "color": 7,
        "width": 912,
        "height": 768,
        "content": "## Multi-Source Data Aggregation\n\n**What:** Fetches rent payment history, credit bureau data, and employment records \n\n**Why:** Fragmented data creates blind spots in risk assessment. "
      },
      "typeVersion": 1
    },
    {
      "id": "57acefd0-fa78-43ce-be53-174b1a130a16",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        64
      ],
      "parameters": {
        "color": 4,
        "width": 672,
        "height": 288,
        "content": "## Prerequisites\nPayment system API, credit bureau access, employment verification API\n## Use Cases\nRental application screening, existing tenant monitoring \n## Customization\nModify risk scoring criteria, adjust alert thresholds\n## Benefits\nReduces defaults through early detection, eliminates screening bias"
      },
      "typeVersion": 1
    },
    {
      "id": "caced8da-50a0-4b35-9368-3feb19bb304d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        80
      ],
      "parameters": {
        "width": 352,
        "content": "## Setup Steps\n1. Configure payment history, credit bureau, and employment credentials in fetch nodes\n2. Add OpenAI API key for risk analysis and set Gmail/Slack credentials for alerts\n3. Customize risk score thresholds "
      },
      "typeVersion": 1
    },
    {
      "id": "8085016d-d906-449d-9118-92890b13dc77",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        64
      ],
      "parameters": {
        "width": 656,
        "height": 256,
        "content": "## How It Works\nThis workflow automates tenant screening by analyzing payment history, credit, and employment data to predict rental risks. Designed for property managers, landlords, and real estate agencies, it solves the challenge of objectively evaluating tenant reliability and preventing payment defaults.The system runs daily assessments, fetching rent payment history, credit bureau reports, and employment records. An AI agent merges this data, calculates risk scores, and routes alerts based on severity. High-risk tenants trigger immediate email notifications for intervention, medium-risk cases post to Slack for monitoring, while low-risk updates save quietly to databases. Automated collection workflows initiate for high-risk cases."
      },
      "typeVersion": 1
    },
    {
      "id": "0fafd82b-1926-4a24-96f7-8a0c09e68b6b",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        320,
        416
      ],
      "parameters": {
        "color": 7,
        "width": 1392,
        "height": 672,
        "content": "## AI Risk Scoring & Automated Response\n\n**What:** AI agent analyzes merged data, calculates risk scores, routes alerts by severity  \n\n**Why:** Manual risk evaluation is subjective and slow. AI delivers consistent "
      },
      "typeVersion": 1
    },
    {
      "id": "e1f42d20-c20d-4f1a-aec1-152a1bc86c8d",
      "name": "Fetch Employment Records",
      "type": "n8n-nodes-base.bambooHr",
      "position": [
        -80,
        848
      ],
      "parameters": {
        "operation": "getAll"
      },
      "typeVersion": 1
    },
    {
      "id": "bc4f44a4-746c-48cc-aa52-ce8650e6b59c",
      "name": "Get a rent payment item",
      "type": "n8n-nodes-base.payPal",
      "position": [
        -80,
        512
      ],
      "parameters": {
        "resource": "payoutItem"
      },
      "typeVersion": 1
    },
    {
      "id": "31d3b348-cefd-4df9-9a44-2d72f6056442",
      "name": "Create or update a record",
      "type": "n8n-nodes-base.airtable",
      "position": [
        1424,
        592
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "upsert"
      },
      "typeVersion": 2.1
    }
  ],
  "active": false,
  "settings": {
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "b97ed408-b185-4d34-b576-a577e4c97f2b",
  "connections": {
    "Merge Tenant Data": {
      "main": [
        [
          {
            "node": "Risk Analysis AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Risk Analysis AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Route by Risk Level": {
      "main": [
        [
          {
            "node": "Send High Risk Alert Email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Medium Risk Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Risk Analysis AI Agent": {
      "main": [
        [
          {
            "node": "Route by Risk Level",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Fetch Credit Bureau Data",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get a rent payment item",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Employment Records",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a rent payment item": {
      "main": [
        [
          {
            "node": "Merge Tenant Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Credit Bureau Data": {
      "main": [
        [
          {
            "node": "Merge Tenant Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Employment Records": {
      "main": [
        [
          {
            "node": "Merge Tenant Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Risk Score Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Risk Analysis AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Send High Risk Alert Email": {
      "main": [
        [
          {
            "node": "Trigger Automated Collection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger Automated Collection": {
      "main": [
        [
          {
            "node": "Create or update a record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Medium Risk Notification": {
      "main": [
        [
          {
            "node": "Create or update a record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily Risk Assessment Schedule": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}