n8nを統合:銀行ローンアシスタントの構築
概要
銀行ローンアシスタントは、商業ローンの相談、申請、管理プロセスを簡素化するためのインテリジェントなサービスシステムです。OneAIのインテリジェントQ&A機能とn8nのワークフロー自動化機能を組み合わせることで、ユーザーに包括的なローンサービス体験を提供します。
ビジネス価値
技術的ハイライト
システムアーキテクチャ
コアフロー
ローン申請ワークフロー
インタラクションシーケンス
インタラクション例
ユーザーがアシスタントに商業ローンに関する質問を相談
ユーザーが商業ローンを申請し、必要な情報の提供をガイド
正式にローン申請を提出し、ローン申請番号を取得
I want to apply for a business loan.
Company Name: Example Technology Co., Ltd
Contact Person: John Doe
Loan Amount: 200,000
Loan Term: 1 year
Purpose: For expanding production scale and purchasing new equipment
条件を満たしている場合、銀行マネージャーがメールでローン審査を受け取る
審査進捗を照会(審査中)
審査進捗を照会(審査通過)
ユーザーのローン申請金額が大きすぎる(商業ローンポリシーの最大金額を超過)、自動的に拒否し理由を通知
I want to apply for a business loan.
Company Name: Example Technology Co., Ltd
Contact Person: John Doe
Loan Amount: 200,000,000,000
Loan Term: 1 year
Purpose: For expanding production scale and purchasing new equipment
ユーザーのローン申請用途が不適合(不動産投資)、自動的に拒否し理由を通知
I want to apply for a business loan.
Company Name: Example Technology Co., Ltd
Contact Person: John Doe
Loan Amount: 200,000
Loan Term: 1 year
Purpose: Real estate investment
準備作業
本サンプルを完全に実行するには、構築を開始する前に以下の準備作業を完了してください。
- OneAPI要件
- n8nのデプロイ
- PostgreSQLデータベースのデプロイ
- n8n Credentialsの設定
OneAIバージョン
- まず3.2_u4以上のバージョンにアップグレードし、フロントエンドも対応する最新版にアップグレードすることを推奨します
n8nのデプロイ
ドキュメントを参照してください:n8n統合
- **「n8nのデプロイ」**を参考に、n8nのデプロイを完了してください。
- **「n8nによるOneAI APIの呼び出し」**を参考に、OneAIコミュニティノードのインストールを完了してください。
PostgreSQLデータベースのデプロイ
n8nのデプロイ時にすでにPostgreSQLデータベースを作成している場合は、そのデータベースをそのままご利用いただけます。追加のデプロイは不要です。
n8nが存在するネットワーク環境内にPostgreSQLデータベースインスタンスをデプロイしてください。デプロイ後、以下の情報を適切に記録してください。
- データベース接続アドレス
- データベースユーザー名
- データベースパスワード
次に、PostgreSQLで以下のSQLスクリプトを実行し、ローン申請テーブルを作成してください。
CREATE TABLE loan_applications (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
company_name VARCHAR(255) NOT NULL,
contact_person VARCHAR(100) NOT NULL,
loan_amount DECIMAL(15, 2) NOT NULL,
loan_term VARCHAR(50) NOT NULL,
purpose TEXT,
application_date TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
status VARCHAR(50) NOT NULL DEFAULT 'Pending Review',
review_notes TEXT,
assigned_reviewer VARCHAR(100),
review_date TIMESTAMP WITH TIME ZONE,
approval_date TIMESTAMP WITH TIME ZONE,
rejection_reason TEXT,
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP
);
n8n Credentialsの設定
本サンプルでは以下の認証情報の設定が必要です。n8n Credentialsで設定してください。
認証タイプ | 用途説明 | 設定例 |
---|---|---|
SMTP account | ローン審査関連のメール通知送信に使用。メールアカウントとSMTPサーバー情報を用意してください | ![]() |
Postgres account | ローン申請記録の保存・照会、申請ステータスの更新に使用 | ![]() |
OneAI account | OneAIプラットフォームのAPI呼び出しに使用 | ![]() |
Header Auth account | Workflowにセキュリティ認証機構を追加するために使用 | ![]() |
Azure Open AI account | Azure OpenAIモデルの呼び出しに使用 | ![]() |
完全なCredentials
構築開始
以下はローンアシスタントを構築する主なステップです。
- ナレッジスペースの初期化
- ローン申請ワークフローの作成
- ローン照会ワークフローの作成
- スキルの追加
- チャットボットの設定
ナレッジスペースの初期化
OneAIのナレッジスペース管理画面で、ナレッジスペースを作成します。
1、ナレッジスペース作成 | 2、ファイル設定 |
---|---|
![]() | ![]() |
ローンポリシーの説明資料をナレッジスペースにアップロードし、正常にインデックスされることを確認してください。
ローンポリシードキュメント例
# Commercial Loan Policy
## Loan Amount and Term Regulations
- Minimum loan amount: $100,000 USD
- Maximum loan amount: $10,000,000 USD
- Loan terms are categorized as follows:
- Short-term: 6 months to 1 year
- Medium-term: 1 to 3 years
- Long-term: 3 to 5 years
## Permitted Loan Purposes
The following are approved uses for commercial loans:
- Purchasing equipment or raw materials
- Expanding production scale
- Technical improvement or innovation
- Working capital requirements
## Prohibited Loan Purposes
Loans cannot be used for the following:
- Financial investments (stocks, futures, etc.)
- Real estate speculation
- Repaying loans from other financial institutions
- Any activities prohibited by laws and regulations
ローン照会ワークフローの作成
ワークフローを作成し、Query Application Process
と命名し、ステータスをActive
に設定します。
Import from file
でこのワークフローをインポート:Query Application Process Workflow
ワークフローのインポート
インポート後のワークフロー
修正と確認
- 各ノードのCredential設定が正しいか、前述のCredentialsを指しているか確認してください
テスト
- n8nのmock dataおよびTest workflow機能でテストし、フローが正しく実行されることを確認してください
WebhookノードでPathを取得し、保存してください
ローン申請ワークフローの作成
ワークフローを作成し、Loan Application
と命名し、ステータスをActive
に設定します。
Import from file
でこのワークフローをインポート:Loan Application Workflow
インポート後
確認と調整
- 各ノードのCredential設定が正しいか、前述のCredentialsを指しているか確認してください
- メールノードの送信者および受信者メールアドレスを修正してください
テスト
- n8nのmock dataおよびTest workflow機能でテストし、フローが正しく実行されることを確認してください
WebhookノードでPathを取得し、保存してください
スキルの追加
ローン進捗照会スキルQuery Loan Application
を追加
- n8nワークフローでHTTP Header Authを設定している場合、スキルのRequest headerに対応するHeader Auth認証情報を入力してください
- OpenAPI Schema内の
{n8n_domain}
はn8nの実際のドメインに、{path}
は前述で保存したWebhook Pathに置き換えてください
OpenAPI Schema例
クリックして完全なコードを表示
{
"openapi": "3.0.3",
"info": {
"title": "Query Loan Application",
"version": "1.0.0"
},
"servers": [
{
"url": "https://{n8n_domain}"
}
],
"paths": {
"/webhook/{path}": {
"get": {
"operationId": "queryLoanApplication",
"summary": "Query Loan process, status",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"applicationId": {
"type": "string",
"description": "Loan Application Id"
}
},
"required": [
"applicationId"
]
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"application_id": {
"type": "string",
"description": "Unique Application ID"
},
"companyName": {
"type": "string",
"description": "Company Name"
},
"contactPerson": {
"type": "string",
"description": "Contact Person Name"
},
"loanAmount": {
"type": "number",
"description": "Loan Amount"
},
"loanTerm": {
"type": "string",
"description": "Loan Term"
},
"purpose": {
"type": "string",
"description": "Loan Purpose"
},
"application_date": {
"type": "string",
"format": "date-time",
"description": "Date when the loan application was submitted"
},
"status": {
"type": "string",
"description": "Current status of the loan application"
},
"review_notes": {
"type": "string",
"description": "Notes from the reviewer about the application"
},
"assigned_reviewer": {
"type": "string",
"description": "Name of the person assigned to review the application"
},
"review_date": {
"type": "string",
"format": "date-time",
"description": "Date when the application was reviewed"
},
"approval_date": {
"type": "string",
"format": "date-time",
"description": "Date when the application was approved"
},
"rejection_reason": {
"type": "string",
"nullable": true,
"description": "Reason for rejection if the application was rejected"
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the record was created"
},
"updated_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the record was last updated"
}
},
"required": [
"application_id",
"companyName",
"contactPerson",
"loanAmount",
"loanTerm",
"purpose",
"status",
"application_date",
"created_at",
"updated_at"
]
}
}
}
}
}
}
}
}
}
ローン申請スキルLoan Application
を追加
- n8nワークフローでHTTP Header Authを設定している場合、スキルのRequest headerに対応するHeader Auth認証情報を入力してください
- OpenAPI Schema内の
{n8n_domain}
はn8nの実際のドメインに、{path}
は前述で保存したWebhook Pathに置き換えてください
OpenAPI Schema例
クリックして完全なコードを表示
{
"openapi": "3.0.3",
"info": {
"title": "Loan Application",
"version": "1.0.0"
},
"servers": [
{
"url": "https://{n8n_domain}"
}
],
"paths": {
"/webhook/{path}": {
"post": {
"operationId": "loanApplication",
"summary": "Loan Application",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"companyName": {
"type": "string",
"description": "Company Name"
},
"contactPerson": {
"type": "string",
"description": "Contact Person Name"
},
"loanAmount": {
"type": "number",
"description": "Loan Amount"
},
"loanTerm": {
"type": "string",
"description": "Loan Term"
},
"purpose": {
"type": "string",
"description": "Loan Purpose"
}
},
"required": [
"companyName",
"contactPerson",
"loanAmount",
"loanTerm",
"purpose"
]
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"application_id": {
"type": "string",
"description": "Unique Application ID"
},
"companyName": {
"type": "string",
"description": "Company Name"
},
"contactPerson": {
"type": "string",
"description": "Contact Person Name"
},
"loanAmount": {
"type": "number",
"description": "Loan Amount"
},
"loanTerm": {
"type": "string",
"description": "Loan Term"
},
"purpose": {
"type": "string",
"description": "Loan Purpose"
}
},
"required": [
"application_id",
"companyName",
"contactPerson",
"loanAmount",
"loanTerm",
"purpose"
]
}
}
}
}
}
}
}
}
}
Chatbotの設定
Code、名称、説明などの基本情報を入力します。
ウェルカムメッセージには、[]
を使っていくつかのクイック質問を配置できます。
例
Hello, I am the SWO Bank Loan Assistant. How can I help you today?
[I would like to know the maximum amount for a business loan]
[I want to apply for a business loan]
[I want to check the status of my loan application]
会話設定
- モデルは
gpt-4.1
を推奨 - コンテキスト数は最大まで調整
- 推奨質問はオフ
- プロンプトではスキル呼び出しの誘導に注意
例
You are SWO Bank's intelligent loan assistant, equipped with extensive loan knowledge and process guidance capabilities. You will help users complete the following three tasks professionally and accurately based on knowledge base content:
### Your responsibilities include the following three core skills:
### Skill 1: Loan Policy Query
* When users ask questions about loan policies, requirements, or processes, use the `searchHybrid` function to search in the knowledge base.
* If relevant information is found, please **accurately quote the content** in your response.
* If no relevant information is found, please reply: **"No relevant information found. Please contact bank staff."**
* **Prohibited** from making up content or answering based on common sense.
### Skill 2: Loan Application
- When users wish to apply for a loan, please guide them to provide the following information:
Loan application information:
* Company Name
* Contact Person
* Loan Amount
* Loan Term
* Purpose
- After the user provides complete information, call the `loanApplication` function to initiate the loan application and inform the user of the returned application ID (application_id).
### Skill 3: Loan Progress Query
* When users wish to check loan progress, call the `queryLoanApplication` function.
* Guide users to provide the necessary loan number.
* When returning results, inform users about the loan review progress, approval or rejection reasons, and approval time, ensuring content is concise, accurate, and professional.
### Usage Principles
* All answers must be based on knowledge base content or user input, no fabrication allowed.
* Always maintain professional, clear, and polite expression.
* Please do not output superfluous hyperlinks, function names, or square brackets in your answer.
* If there are cited documents, please embed them in the answer in markdown link format at the appropriate location.
* If user's request is unclear, guide them to choose one of the following operations:
* Learn about loan policies
* Initiate loan application
* Check loan progress
スキルプラグイン
Loan ApplicationおよびQuery Loan Applicationスキルを追加します。
ナレッジソース
- ナレッジベース:オン
- ナレッジスペース:先ほど作成したナレッジスペースを選択
- 検索戦略:インテリジェント検索を選択
- 引用の表示:オン