- 3
- April
OpenClaw Deep Dive Series EP.6 (Finale) — From EP.5 where we deployed OpenClaw to Production, it's now time to connect OpenClaw to a real ERP system — building an AI Assistant that knows your organization's data, answers budget questions, approves documents, and summarizes reports instantly. No more logging into the ERP just to check a number!
Quick Summary — What You'll Learn in This Article:
- ERP API Integration — Connect AI to ERP securely via REST API
- Build 5 ERP Skills — Budget Query, Document Approval, Report Summary, Inventory Alert, Employee Info
- Data Security & Access Control — Role-based access + sensitive data masking
- 5 Real Use Cases — Practical examples of AI + ERP in action
- ROI of AI + ERP — 90% less time, 75% fewer errors, 40% cost savings
Why Connect AI to ERP?
Currently, executives and employees must log in to the ERP system → navigate to the right menu → export a report → read and analyze manually → make a decision. These steps take 5-10 minutes each time, require knowledge of which menu holds the data, and must be repeated daily. With an AI Assistant, simply ask "Summarize this month's budget" and the AI pulls data from the ERP and summarizes it instantly within 10 seconds, in plain language anyone can understand.
| Comparison | Traditional (Manual) | AI Assistant |
|---|---|---|
| Time Required | 5-10 minutes per query (login → navigate → export → read) | 10 seconds (ask in natural language → get instant answer) |
| Knowledge Needed | Must know which menu holds the data, training required | Ask in plain language, no system knowledge needed |
| Channel | Must open the ERP screen only | Ask via LINE, WhatsApp, or Web Chat |
| Analysis | Must read numbers and summarize yourself | AI summarizes with comparison to previous month |
Architecture — OpenClaw + ERP
Connecting OpenClaw to ERP follows a 3-layer architecture — the User communicates via Chat (LINE/WhatsApp/Web) → OpenClaw Agent receives the command and selects the appropriate Skill → calls the ERP API Layer to fetch data from the ERP Database:
# Architecture: OpenClaw + ERP Integration
User (LINE / WhatsApp / Web Chat)
|
v
[OpenClaw Agent] -- selects Skill based on question -->
|
|--> [Budget Query Skill] --> GET /api/budget/{dept}
|--> [Document Approval Skill] --> POST /api/approval
|--> [Report Summary Skill] --> GET /api/reports/sales
|--> [Inventory Alert Skill] --> GET /api/inventory/low-stock
|--> [Employee Info Skill] --> GET /api/hr/new-employees
|
v
[ERP API Layer] -- REST API with Authentication -->
|
v
[ERP Database]
| Integration Method | Principle | Pros | Cons |
|---|---|---|---|
| REST API (Recommended) | Call via HTTP endpoints with authentication | Most secure, clear layer separation, fine-grained access control | Requires developing an API layer |
| Database Direct | Connect to the database directly (SQL queries) | Fast, no API development needed | Security risk, AI may run incorrect queries |
| Webhook (Event-driven) | ERP sends events on changes, AI receives and processes | Real-time, no polling needed | Complex, requires event queue management |
REST API is recommended as the safest approach because it cleanly separates the AI from the ERP, authenticates every request, controls exactly what data the AI can access, prevents SQL Injection, and enables full audit logging of every request.
Build ERP Skills — 5 Real Examples
Each Skill is a function that the OpenClaw Agent invokes when a user asks a matching question — similar to the Custom Skills we learned in EP.2, but this time connected to a real ERP system:
1. Budget Query Skill — "How much budget is left?"
// skills/budget-query.js — Query department budget
const { Skill } = require('@openclaw/sdk');
module.exports = new Skill({
name: 'budget-query',
description: 'Fetch budget data by department',
parameters: {
department: { type: 'string', required: true, description: 'Department name' },
year: { type: 'number', default: 2026 }
},
async execute({ department, year }) {
const response = await fetch(
`${ERP_API_URL}/api/budget/${encodeURIComponent(department)}?year=${year}`,
{ headers: { 'Authorization': `Bearer ${ERP_API_TOKEN}` } }
);
const data = await response.json();
return {
department: data.department,
totalBudget: data.totalBudget.toLocaleString(),
spent: data.spent.toLocaleString(),
remaining: data.remaining.toLocaleString(),
percentUsed: ((data.spent / data.totalBudget) * 100).toFixed(1) + '%',
summary: `${department} dept has spent ${data.spent.toLocaleString()} THB ` +
`out of ${data.totalBudget.toLocaleString()} THB total budget. ` +
`Remaining: ${data.remaining.toLocaleString()} THB (${((data.spent / data.totalBudget) * 100).toFixed(1)}%)`
};
}
});
2. Document Approval Skill — "Approve PR-001"
// skills/document-approval.js — Approve documents via AI
module.exports = new Skill({
name: 'document-approval',
description: 'Approve or reject documents (PR, PO, Payment)',
parameters: {
documentId: { type: 'string', required: true },
action: { type: 'string', enum: ['approve', 'reject'], required: true },
reason: { type: 'string', default: '' }
},
async execute({ documentId, action, reason }, context) {
// Check permissions before approval
if (!context.user.permissions.includes('approval')) {
return { error: 'You do not have approval permissions. Please contact the administrator.' };
}
const response = await fetch(`${ERP_API_URL}/api/approval`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${ERP_API_TOKEN}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
documentId, action, reason,
approvedBy: context.user.id,
approvedAt: new Date().toISOString()
})
});
const result = await response.json();
return {
status: result.success ? 'Success' : 'Failed',
summary: `Document ${documentId} has been ${action === 'approve' ? 'approved' : 'rejected'}`
};
}
});
3. Report Summary Skill — "Summarize this month's sales"
// skills/report-summary.js — Fetch report and have AI summarize
module.exports = new Skill({
name: 'report-summary',
description: 'Fetch sales/expense/profit reports and summarize in plain language',
parameters: {
reportType: { type: 'string', enum: ['sales', 'expenses', 'profit'], required: true },
period: { type: 'string', default: 'current-month' }
},
async execute({ reportType, period }) {
const response = await fetch(
`${ERP_API_URL}/api/reports/${reportType}?period=${period}`,
{ headers: { 'Authorization': `Bearer ${ERP_API_TOKEN}` } }
);
const data = await response.json();
// Send raw data to AI for natural language summary
return {
rawData: data,
promptForAI: `Summarize the ${reportType} report, ` +
`compare with the previous month, highlight key points ` +
`in language that executives can easily understand`
};
}
});
4. Inventory Alert Skill — "Which items are running low?"
// skills/inventory-alert.js — Alert on items below minimum stock
module.exports = new Skill({
name: 'inventory-alert',
description: 'Check items below min stock and suggest purchase orders',
async execute() {
const response = await fetch(
`${ERP_API_URL}/api/inventory/low-stock`,
{ headers: { 'Authorization': `Bearer ${ERP_API_TOKEN}` } }
);
const items = await response.json();
return {
totalLowStock: items.length,
items: items.map(item => ({
name: item.name,
currentStock: item.currentStock,
minStock: item.minStock,
suggestedOrder: item.minStock * 2 - item.currentStock,
lastOrderDate: item.lastOrderDate
})),
summary: `${items.length} items are below minimum stock. ` +
`Urgent: ${items.filter(i => i.currentStock === 0).length} items are completely out of stock`
};
}
});
5. Employee Info Skill — "How many new hires this month?"
// skills/employee-info.js — Fetch HR data and summarize
module.exports = new Skill({
name: 'employee-info',
description: 'Fetch employee data, summarize headcount, turnover, leave',
parameters: {
query: { type: 'string', required: true, description: 'HR-related question' },
period: { type: 'string', default: 'current-month' }
},
async execute({ query, period }) {
const response = await fetch(
`${ERP_API_URL}/api/hr/summary?period=${period}`,
{ headers: { 'Authorization': `Bearer ${ERP_API_TOKEN}` } }
);
const data = await response.json();
return {
totalEmployees: data.totalEmployees,
newHires: data.newHires,
resignations: data.resignations,
turnoverRate: data.turnoverRate + '%',
onLeaveToday: data.onLeaveToday,
summary: `Total employees: ${data.totalEmployees}. ` +
`This month: ${data.newHires} new hires, ${data.resignations} resignations. ` +
`Turnover rate: ${data.turnoverRate}%. On leave today: ${data.onLeaveToday}`
};
}
});
These ERP Skills connect to real data in the ERP system via REST API — enabling the AI to instantly answer questions about manufacturing costs, warehouse inventory, and human resources without logging into the system.
Data Security & Access Control
Connecting AI to ERP requires security as the top priority because ERP contains highly sensitive data — two-factor authentication (2FA) should be used alongside role-based access control:
| Role | Data Visible | Can Do | Cannot Do |
|---|---|---|---|
| CEO / Top Executive | All departments, all data, organization-wide overview | View all reports, approve at all levels | - |
| Manager / Department Head | Own department only | View department reports, approve within limits | View other departments, approve beyond limits |
| Staff / Employee | Own data only | View own payslip, check leave, request supplies | View others' salaries, view budgets, approve |
// middleware/permission-check.js — Check permissions before calling ERP API
function checkPermission(user, skill, params) {
const permissions = {
'CEO': { skills: ['*'], departments: ['*'] },
'Manager': { skills: ['budget-query', 'report-summary', 'inventory-alert',
'employee-info', 'document-approval'],
departments: [user.department] },
'Staff': { skills: ['employee-info'], departments: [] }
};
const perm = permissions[user.role];
if (!perm) return { allowed: false, reason: 'Role not found in system' };
// Check skill permission
if (!perm.skills.includes('*') && !perm.skills.includes(skill)) {
return { allowed: false, reason: `${user.role} does not have access to ${skill}` };
}
// Check department permission
if (params.department && !perm.departments.includes('*')
&& !perm.departments.includes(params.department)) {
return { allowed: false, reason: `No access to ${params.department} department data` };
}
return { allowed: true };
}
// Sensitive Data Masking — Hide personal information
function maskSensitiveData(data, userRole) {
if (userRole !== 'CEO') {
// Mask national ID
if (data.nationalId) data.nationalId = '****-*****-**-*';
// Mask others' salaries
if (data.salary && !data.isOwnData) data.salary = '***,***';
// Mask personal phone
if (data.personalPhone) data.personalPhone = '***-***-' + data.personalPhone.slice(-4);
}
return data;
}
Real-world Use Cases — 5 Scenarios
| # | Scenario | What AI Does | Result |
|---|---|---|---|
| 1 | Executive asks "Summarize this month's budget" | AI pulls data from ERP, compares with previous month, identifies departments over budget | One-paragraph summary with figures + alerts for over-budget departments |
| 2 | Employee requests "Requisition 5 reams of A4 paper" | AI checks department budget + verifies stock + auto-approves (if within limits) | Instant approval, auto-creates PR, notifies warehouse |
| 3 | Warehouse alerts "Items running low" | AI checks min stock for all items, auto-creates PR, notifies Manager | No more stockouts, orders placed before running out |
| 4 | HR asks "Employee stats this month" | AI summarizes headcount, turnover, sick leave, vacation, new hires | Instant HR dashboard overview, no Excel exports needed |
| 5 | Auditor requests "Flag anomalies" | AI pulls transaction log, analyzes anomalies (unusual amounts, unusual timing) | Anomaly report with red flags + details for each item |
ROI of AI + ERP
Connecting AI to ERP isn't just about convenience — it's an investment with real, measurable returns. Here are the numbers:
| Metric | Before (Manual) | After (AI + ERP) | Improvement |
|---|---|---|---|
| Report Retrieval Time | 10-15 min/query | 10-30 sec/query | 90% reduction |
| Human Errors | 5-8%/month (wrong exports, misread data) | 1-2%/month | 75% reduction |
| Labor Cost (Admin) | 3-4 hours/day on routine tasks | 1-2 hours/day | 40% savings |
| Decision-Making Time | Wait 1-2 days for reports | Instant data access | Real-time |
| Stockouts | 3-5 times/month | 0-1 times/month | 80% reduction |
These figures are based on case studies from mid-sized organizations (100-500 employees) that started using AI with ERP. The larger the organization, the higher the ROI because the volume of routine work is greater. See the full guide on planning your ERP implementation if your organization is interested.
Important Warnings When Connecting AI to ERP:
- AI should not have write access to everything in ERP — limit to read-only by default, allow writes only for specific actions (e.g., approvals, creating PRs).
- Human-in-the-Loop is essential for critical transactions — payments, data deletion, contract modifications must always require human confirmation.
- Test on Staging before Production — never connect AI directly to production ERP. Always test thoroughly first.
- Log every action — every request the AI sends to ERP must be logged. Who asked, what was asked, what answer was given, and when.
Saeree ERP + AI Assistant — Ready for the Future:
Saeree ERP is developing an AI Assistant capable of doing all of this — query budgets, approve documents, summarize reports, check inventory, all through a single Chat interface. Supporting both On-premise and Cloud deployment, with SSL A+ and 2FA for maximum security.
Interested in having Saeree ERP + AI help your organization? Consult with our team for free
OpenClaw Deep Dive Series — All 6 Episodes Complete!
OpenClaw Deep Dive Series — 6 Episodes of In-Depth AI Agent Exploration:
- EP.1: Install OpenClaw and Build Your First AI Agent
- EP.2: OpenClaw Skills Deep Dive — Build Custom Skills from Scratch
- EP.3: OpenClaw Kernel Module Hands-On — Write Your Own Module Step by Step
- EP.4: Build Multi-Agent Workflows with OpenClaw — Design & Implement
- EP.5: Deploy OpenClaw to Production — Security, Monitoring, Scaling
- EP.6: Connect OpenClaw to ERP — Build an AI Assistant for Your Organization (this article)
All 6 episodes complete! From installation to ERP integration — you're now ready to build AI Agents that work in real organizations.
"AI + ERP is no longer the future — organizations that start today will have an advantage over competitors who wait. Because AI brings the data inside ERP to life — answering instantly, no more waiting for reports."
- Saeree ERP Team




