Overview AP Module Modules Stack Docs

FBM Limited Malta · Finance Operations · BUHAY Group

Finance
Hyper­automation

Transforming 5 core Finance processes through AI-driven automation. One pipeline. Seven entities. Zero manual classification.

0 Modules
0 Entities
0 Invoices/yr
0% Accuracy target
● LIVE — WF_AP_001_InvoiceIngestion
📧
TRIGGER_M365_APMailbox
📎
FILTER_AttachmentIsPDF
VALIDATE_TextExtractable
🤖
AI_ClaudeClassifyEntity
FILTER_ConfidenceThreshold
DRB_UploadInvoice + DBC_Draft
📋
LOG_AuditNotion
Pipeline active · Polling every 5 min
scroll

What we're building
and why it matters

1 inbox · 7 entities · 0% automation

The Problem

All 7 Malta entities receive invoices at one shared mailbox. Every invoice was read and classified manually — ~1,400 per year, by one person, with no audit trail.

AI-driven end-to-end pipeline

The Solution

Claude API classifies each invoice, extracts fields, routes to the correct entity, and posts the draft purchase entry to Business Central — automatically.

5 modules · Live ops + academic capstone

The Scale

Built as a real operational system for FBM Limited Malta and simultaneously as a Master's capstone at EBIS Education on AI Agents & Hyperautomation.

AP Process
Automation

Complete executive briefing — from problem statement to live pipeline architecture. Every component, every decision, every edge case.

01

The Problem

State before automation — baseline from which we measure impact

1

Shared inbox for all Malta entities

7

Distinct legal entities receiving invoices

0%

Automation prior to this project

~1,400

Invoices processed manually per year

All seven Malta entities receive invoices to one shared mailbox — accounts.payable@fbm.mt. Every invoice was manually read, classified, and filed — one person, every working day, year-round. A single point of failure with no audit trail, no SLA, no scalability, and full exposure to misrouting risk.

02

The Solution

AI-driven, end-to-end invoice ingestion and routing pipeline

📧 M365 Outlook Email trigger
📄 PDF Extraction Base64 + metadata
🤖 Claude API Entity classification
Confidence Gate ≥90% auto-route
🗄️ Dropbox (DRB) Archived by entity
📊 Business Central Purchase draft (DBC)
📋 Notion Audit Full audit trail

Claude API reads each PDF invoice, identifies the correct recipient Malta entity using bill-to fields, VAT numbers, and supplier mappings, then automatically archives it to the entity's Dropbox folder and creates a draft Purchase Invoice in Microsoft Dynamics Business Central. Every event — success and failure — is logged to the Notion Audit Trail.

03

Pipeline Architecture

WF_AP_001_InvoiceIngestion — complete node map and decision tree

OUTLOOK TRIGGER accounts.payable@fbm.mt — polls every 5 min
  └─► FILTER_AttachmentIsPDF Pass only emails with PDF attachment
          └─► TRANSFORM_ExtractBase64 PDF + email metadata
                  └─► VALIDATE_TextExtractable Is text extractable?
                          ├─► NOQUEUE_ManualReview (ERR_IMAGE_ONLY_PDF)
                          │         └─► LOG_AuditNotion
                          └─► YESTRANSFORM_BuildPrompt Inject entity list + VAT flags
                                    └─► AI_ClaudeClassifyEntity POST → Claude API → JSON
                                              └─► TRANSFORM_ValidateAPIResponse
                                                        └─► FILTER_ConfidenceThreshold
                                                                  ├─► ≥ 90%TRANSFORM_NormalizeFields
                                                                  │           ├─► DRB_UploadInvoice /AP/TEST/[Entity]/YYYY/MM/
                                                                  │           ├─► HTTP_DBC_CreatePurchaseDraft
                                                                  │           └─► NOTIFY_APExecutive_AutoRoute
                                                                  └─► < 90%QUEUE_ManualReview
                                                                              └─► LOG_AuditNotion ←── ALL branches
NODE 01
TRIGGER_M365_APMailbox
Email Trigger · 5 min poll
NODE 02
FILTER_AttachmentIsPDF
IF node · PDF only
NODE 03
TRANSFORM_ExtractBase64
Code node · PDF + metadata
NODE 3.5
VALIDATE_TextExtractable
IF node · Blocks image-only PDFs
NODE 04
TRANSFORM_BuildPrompt
Code node · Entity list injection
NODE 05
AI_ClaudeClassifyEntity
HTTP Request · Claude API
NODE 06
TRANSFORM_ValidateAPIResponse
Code node · Hallucination guard
NODE 07
FILTER_ConfidenceThreshold
IF node · ≥0.90 auto / <0.90 manual
NODE 08a
TRANSFORM_NormalizeFields
Code node · Build DRB path
NODE 08b
DRB_UploadInvoice
HTTP Request · Dropbox Business
NODE 08c
HTTP_DBC_CreatePurchaseDraft
HTTP Request · BC OData v4
NODE 10
LOG_AuditNotion
HTTP Request · ALL branches
04

The 7 Malta Entities

All invoices classified and routed to the correct BUHAY Group legal entity

BH
BUHAY Holding Limited
BHL · Holding company
FB
FBM Limited
FBM · Core operations
NT
NTT Limited
NTT · Technology
D2
D2R Limited
D2R · Operations
FD
FBM Digital Systems
FDS · Digital
DK
DRAKO Limited
DRK · Gaming
LS
LuckySix Limited
LSX · iGaming

Each entity has its own Dropbox folder and Business Central company. The AI classifier must correctly identify the recipient entity before any routing can occur. Classification accuracy is the #1 KPI for this module.

05

Classification Logic & Confidence Routing

5 priority signals · 90% threshold · Auto-route or Human Review

Classification Signals — Priority Order

P1 Bill To field Exact entity name match
P2 VAT number Match against Entity Mapping DB
P3 Supplier name Known entity → supplier mapping
P4 Document header Letterhead / company text
P5 Email subject / sender domain Fallback only
≥ 90%
AUTO-ROUTE
Normalize fields & build DRB path
Upload to Dropbox /AP/TEST/[Entity]/
Create Purchase Invoice Draft in DBC
Notify AP Executive via Teams/email
Log to Notion Audit Trail
< 90%
HUMAN REVIEW QUEUE
Route to manual review queue
Notify AP Executive with context
Log to Notion Audit Trail (DLQ)
AP Executive classifies manually
Feedback loop for prompt tuning
06

Error Handling

Every failure mode defined — Saga/DLQ pattern, Notion as official audit log

ERR_NO_ATTACHMENT
Stage: Ingestion
Skip + log · No user notification
No notification required
ERR_EXTRACTION_FAILED
Stage: Pre-processing
Retry ×1, then manual queue
Notify: AP Executive
ERR_IMAGE_ONLY_PDF
Stage: Pre-processing
Block AI call → Manual Review + Audit Log
Notify: AP Executive
ERR_API_TIMEOUT
Stage: AI Call
Retry ×3 with exponential backoff (5s→15s→30s)
Notify: Data Engineer
ERR_LOW_CONFIDENCE
Stage: Post-AI Classification
Manual review queue
Notify: AP Executive
ERR_HALLUCINATED_ENTITY
Stage: Post-AI Validation
Manual review queue + critical alert
Notify: Data Engineer
ERR_DRB_UPLOAD_FAILED
Stage: Storage (Dropbox)
Retry ×1, then alert
Notify: Data Engineer
ERR_DBC_FAILED
Stage: ERP (Business Central)
Log + manual entry flag
Notify: AP Executive

⚠️ LOG_AuditNotion must be connected to every terminal branch — including all error paths. The Notion Audit Trail is the official Dead Letter Queue (DLQ) for this pipeline.

07

Storage Structure & Environments

Dropbox Business folder hierarchy · TEST vs PROD isolation

Dropbox Folder Structure (DRB)

/AP/
  /TEST/  ← Active · UAT
    /BUHAY-Holding-Limited/
    /FBM-Limited/
    /NTT-Limited/
    /D2R-Limited/
    /FBM-Digital-Systems/
    /DRAKO-Limited/
    /LuckySix-Limited/
  /PROD/  ← Post-UAT
    [same structure]

File naming convention:
INVREF – INVOICE – SUPPLIER.pdf
e.g: INV-2026-0042 – INVOICE –
     Supplier Name.pdf

Environment Strategy

TEST — ACTIVE
Pipeline validation + prompt tuning
Real anonymised invoices · DBC Test Company
PROD — POST-UAT
Live operations · Real invoices
⚠ Never run PROD until UAT complete

Go-live strategy: Shadow Mode first (Strangler Fig — Phase 1). Auto-route activation only after ≥90% accuracy confirmed over test corpus.

Automation Modules

Five Finance processes. One platform. Built to scale across the entire BUHAY Group.

01
AP Process Automation
AI classification and routing of ~1,400 annual invoices across 7 Malta entities. Claude API + n8n + DBC.
n8n Claude API Dynamics BC Dropbox Business
ACTIVE
02
Revenue Invoicing MX / Online
Automated revenue invoice generation for Mexico and online business lines.
n8n Dynamics BC Orion
NEXT
03
Collections / AR Chase
Automated AR chase sequences and collections workflow management.
n8n M365 Power BI
PLANNED
04
VAT Return
End-to-end VAT return preparation and submission pipeline.
n8n Dynamics BC Reportal
PLANNED
05
Daily Cash Reconciliation
Daily automated reconciliation of cash positions across all entities.
n8n Dynamics BC ACE
PLANNED

Technology Stack

The tools that power the pipeline — from workflow orchestration to ERP integration.

n8n

n8n

Workflow Orchestration
AI

Claude API

AI Document Intelligence
BC

Dynamics BC

ERP · Source of Truth
DRB

Dropbox Business

Document Storage
PBI

Power BI

Reporting & BI
M365

Microsoft 365

Email · Collaboration
CF

Cloudflare

Hosting · Security · DNS
OR

Orion

Field Service Data
ACE

ACE

Gaming Server Data

Project Documentation

Architecture · Workflows · Reports · Academic Deliverables

Architecture Design

System design, data flow, component specs, and open architecture decisions.

View →

Workflow Specs

n8n node-by-node documentation for WF_AP_001 and future workflow modules.

View →

UAT / Test Reports

Test corpus results, confidence scores, and classification accuracy tracking.

View →

Academic Deliverables

EBIS capstone submissions and reports for the Master en AI Agents & Hyperautomation.

View →

Notion Tracker

Live project board, sprint tracker, and Audit Trail. Source of truth for project status.

Open →

AP Prompt Library

Claude API prompts for invoice classification. PROMPT_AP_ClassifyEntity_v1.1 and variants.

View →