Skip to content

Every 10 minutes

Pull key fields from emailed invoices and POs

Purchase orders and invoices that arrive in Outlook are read for you, and the supplier, amounts and due date reach you in one summary.

Runs
Every 10 minutes
Apps
Outlook
AI
Yes, uses the built-in AI allowance
Access
Mail.ReadWrite

Send this to your assistant

Create a ClickRuntime automation: every 10 minutes, check my Outlook for emails with PO or invoice PDFs attached, extract the supplier, document number, line items, total and due date, and email me a summary.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

The finance assistant at a small construction supplier receives purchase orders, supplier invoices and subcontractor timesheets as PDF attachments on emails from dozens of senders, all in different layouts. Someone opens each attachment, finds the PO number, amounts, dates and hours, and types them into a spreadsheet or the accounting system. It is slow, tedious and error-prone, and a mistyped digit leads to a mismatched order or a wrong payment.

Every 10 minutes, new Outlook messages that have attachments are listed, and each attachment is downloaded. ClickRuntime's built-in AI reads it and extracts fields such as document type, number, counterparty, date, amounts and hours. The result is sent to you by email or Slack, and the original message can be moved to a folder to show it was processed.

It suits back-office teams in construction, wholesale, staffing and services businesses that handle paperwork by email.

What you get out of it

  • Keying errors fall

    Pulling numbers straight from the document avoids transposed digits and missed decimals. A clerk then compares the extracted figures to the document, which is faster and more accurate than typing from scratch.

  • Documents are recognized on arrival

    An email with a purchase order, an invoice or a timesheet gets identified as such, so the right person sees it immediately. Nothing sits in a general inbox while the sender wonders whether it arrived.

  • Layout variety is not a problem

    Dozens of suppliers use dozens of layouts. Reading documents with AI does not need a template per sender, so a new supplier works from the very first invoice. That flexibility matters for a small firm that cannot dictate formats to suppliers or subcontractors.

  • Month-end closes faster

    When every document is already summarized into fields throughout the month, there is no stack of unopened attachments to type up on the last day. That reduces the stress of close and lets the team spend the final days on checks instead of typing.

  • Processed mail is easy to tell apart

    Moving handled messages into a folder keeps the inbox focused on what still needs human attention, and it gives you a record of what was processed and when. It also provides a handy audit trail of which documents were seen and when.

How it works

What happens, step by step

  1. Every 10 minutes, ClickRuntime checks your Outlook inbox for new emails with attachments. Emails it has already read are skipped.

  2. It opens each attached purchase order, invoice or timesheet.

  3. AI picks out the document type, supplier, amount and due date.

  4. You get one summary with a line per document, and if you choose, the emails are moved to a folder once they are read.

Before it runs live

  • Connect Outlook

What you get

RunsEvery 10 minutes
Pull key fields from emailed invoices and POstoday, 9:00Succeeded
Email · 2 documents readInvoice: Northwind Supplies, $4,280.00, due 2026-11-15 (INV-2291.pdf) Purchase order: Acme Corp, $12,600.00, due 2026-11-02 (PO-7781.pdf)

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Act only on the items that match your own rules, and skip the rest
  • Change what the AI looks for, or how it writes the result
  • Add another app, for example also send it to Slack
  • Combine it with other Outlook steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
ai_extraction_from_incoming_documents_pos_invoices_timesheets.pyexample
import base64
from datetime import datetime, timezone
from clickruntime import on_trigger, credentials, http, state, ai, notify, report_fetched

GRAPH = "https://graph.microsoft.com/v1.0"
DONE_FOLDER_ID = "AAMkAD...processed"

@on_trigger
def run(event):
    h = {"Authorization": f"Bearer {credentials.connection('microsoft', 'work')}"}
    since = state.get("since") or datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
    msgs = http.get(f"{GRAPH}/me/messages", headers=h, params={
        "$filter": f"receivedDateTime gt {since} and hasAttachments eq true",
        "$select": "id,subject,from,receivedDateTime", "$orderby": "receivedDateTime asc"}).json()["value"]
    report_fetched(len(msgs))
    if not msgs:
        return {"summary": "Nothing new"}
    lines = []
    for m in msgs:
        for att in http.get(f"{GRAPH}/me/messages/{m['id']}/attachments", headers=h).json()["value"]:
            if att.get("contentType") != "application/pdf" and not att["name"].lower().endswith((".txt", ".csv")):
                continue
            text = base64.b64decode(att["contentBytes"]).decode("latin-1")[:12000]
            f = ai.generate(text, system="Extract fields from this purchase order, invoice or timesheet.", max_output_tokens=200,
                            json_schema={"type": "object", "properties": {"type": {"type": "string"}, "supplier": {"type": "string"},
                                         "total": {"type": "string"}, "due_date": {"type": "string"}}}).json
            lines.append(f"{f['type']}: {f['supplier']}, {f['total']}, due {f['due_date']} ({att['name']})")
        http.post(f"{GRAPH}/me/messages/{m['id']}/move", headers=h, json={"destinationId": DONE_FOLDER_ID})
    state.set("since", msgs[-1]["receivedDateTime"])
    notify.email_me(f"{len(lines)} documents read", "\n".join(lines))
    return {"documents": len(lines)}

FAQ

Common questions

Which document types can it handle?
Purchase orders, invoices, delivery notes, timesheets and similar business documents sent as PDF or image attachments. You tell it which fields to look for in each type, and it reports them in a consistent layout.
What happens if a field cannot be read?
The field is left blank or marked as uncertain, and the message is flagged for a person to check. It does not invent values, though AI reading can still misinterpret poor scans, so key numbers deserve a quick check.
Does it only look at attachments?
It examines attachments, and the email body can be included for context, such as a PO number in the subject. Messages without attachments are skipped, and attachment types you do not care about, like logos, are ignored.
What permissions does it need?
Mail.ReadWrite. Nothing else in your accounts is used.
Does it need AI?
Yes. It uses ClickRuntime's built-in AI, so you don't need an OpenAI or Anthropic key. Every plan includes a monthly AI allowance.
How many runs does it use?
One run each time it checks. Checks that find nothing new and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Pull key fields from emailed invoices and POs” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.