Back to Use Cases

Invoice Processing Automation

From email inbox to accounting system — zero manual data entry.

Power Automate Azure Functions AI Builder SharePoint

The Problem

A mid-size company receives 200+ invoices per month via email (PDF attachments). The current process:

  1. Admin manually opens each email and downloads the PDF
  2. Types invoice data into an Excel sheet (vendor, amount, date, items)
  3. Forwards to the approver based on department
  4. Waits for email approval (often 2-3 days)
  5. Enters approved invoices into accounting software

Result: 15+ hours/week on manual entry, frequent errors, and missed payment deadlines.

The Solution

Fully automated pipeline: email → AI extraction → approval → accounting sync.

Architecture

Email Trigger

Outlook / Gmail

AI Extraction

AI Builder / Azure Form Recognizer

Approval

Teams / Email

Accounting Sync

Tally / QuickBooks API

Step-by-Step Execution Flow

Step 1: Email Trigger (Power Automate)

Power Automate monitors a shared mailbox. When an email arrives with a PDF attachment, the flow triggers.

// Power Automate trigger configuration (pseudo-JSON)
{
  "trigger": "When a new email arrives",
  "mailbox": "invoices@company.com",
  "filter": {
    "hasAttachment": true,
    "attachmentType": ".pdf"
  },
  "actions": [
    "Save attachment to SharePoint",
    "Call Azure Function for extraction"
  ]
}

Step 2: AI Data Extraction (Azure Function — C#)

An HTTP-triggered Azure Function receives the PDF, sends it to Azure Form Recognizer, and returns structured data.

using Azure.AI.FormRecognizer.DocumentAnalysis;

[Function("ExtractInvoice")]
public async Task<IActionResult> Run(
    [HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequest req)
{
    var stream = req.Body;

    var client = new DocumentAnalysisClient(
        new Uri(Environment.GetEnvironmentVariable("FORM_RECOGNIZER_ENDPOINT")),
        new AzureKeyCredential(
            Environment.GetEnvironmentVariable("FORM_RECOGNIZER_KEY"))
    );

    var operation = await client.AnalyzeDocumentAsync(
        WaitUntil.Completed, "prebuilt-invoice", stream);

    var result = operation.Value;
    var invoice = result.Documents[0];

    return new OkObjectResult(new
    {
        VendorName = invoice.Fields["VendorName"].Content,
        InvoiceTotal = invoice.Fields["InvoiceTotal"].Value,
        InvoiceDate = invoice.Fields["InvoiceDate"].Value,
        LineItems = invoice.Fields["Items"].Value
    });
}

Step 3: Approval Routing (Power Automate)

Based on the invoice amount, the flow routes to the correct approver:

  • < ₹10,000: Auto-approved, logged
  • ₹10,000 - ₹1,00,000: Department manager approval (Teams)
  • > ₹1,00,000: CFO approval chain
// Approval logic (Power Automate expression)
if(
  greaterOrEquals(triggerBody()?['invoiceTotal'], 100000),
  'CFO@company.com',
  if(
    greaterOrEquals(triggerBody()?['invoiceTotal'], 10000),
    getDepartmentManager(triggerBody()?['department']),
    'auto-approved'
  )
)

Step 4: Accounting Sync (Azure Function — C#)

Once approved, another function posts the invoice data to the accounting system via API.

[Function("SyncToAccounting")]
public async Task<IActionResult> Run(
    [HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequest req)
{
    var invoice = await req.ReadFromJsonAsync<InvoiceData>();

    using var client = new HttpClient();
    client.DefaultRequestHeaders.Authorization =
        new AuthenticationHeaderValue("Bearer", _accountingApiKey);

    var payload = new
    {
        vendor = invoice.VendorName,
        amount = invoice.InvoiceTotal,
        date = invoice.InvoiceDate,
        reference = invoice.InvoiceNumber,
        status = "approved"
    };

    var response = await client.PostAsJsonAsync(
        "https://api.accounting-system.com/v1/invoices", payload);

    return response.IsSuccessStatusCode
        ? new OkObjectResult("Synced successfully")
        : new StatusCodeResult(500);
}

Business Impact

15+ hrs/week saved

Zero manual data entry

99.2% accuracy

AI extraction vs. manual errors

2-hour approvals

Down from 2-3 days

₹3L+ annual savings

Labour + late payment penalties

Tech Stack

  • Orchestration: Power Automate (Premium license for HTTP connector)
  • AI Extraction: Azure AI Document Intelligence (Form Recognizer)
  • Compute: Azure Functions (.NET 8, Consumption plan)
  • Storage: SharePoint Online (invoice PDFs + metadata)
  • Approval: Microsoft Teams Approvals
  • Accounting: REST API integration (Tally / QuickBooks / Zoho)

Want This Built for Your Business?

We'll customize this solution to fit your invoice workflow, approval chain, and accounting system.

Book Free Consultation