Mailhook and NetSuite: AI Invoice-Field Extraction Template
Turn an emailed PDF invoice into a NetSuite record by extracting the vendor, total, and line items as structured data, all from a single Miraxa prompt in Spojit.
What It Builds
This template wires a Mailhook trigger to a unique Spojit address so that any vendor invoice mailed to it starts a run within seconds. An Attachment node fetches the bytes of the attached PDF, a Knowledge node embeds that one document into a transient collection and then queries it with a Response Schema to pull out the vendor name, invoice total, and line items as clean structured output. A Connector node on the netsuite connector then creates the matching record so the data lands in your ledger without manual keying.
The Prompt
Paste this into Miraxa, the intelligent layer across your automation, and it builds the workflow and connects the tools for you:
Build a workflow triggered by a Mailhook. When an email with a PDF invoice arrives, use an Attachment node to fetch the first PDF, then use a Knowledge node in transient mode to extract the vendor name, invoice total, currency, invoice number, and line items (description, quantity, unit price) as structured output. Finally create a record in NetSuite from those extracted fields.
Connectors Used
- Mailhook (trigger) - generates a unique
@mailhook.spojit.comaddress; any mail sent to it starts the run, no mailbox or sign-in needed. - Attachment node - fetches the PDF bytes referenced by the Mailhook email; works only in Mailhook workflows.
- Knowledge node - in transient mode, embeds the single invoice and queries it with a Response Schema to force structured fields.
- netsuite - creates the record from the extracted fields (for example with
create-recordorcreate-invoice).
Customize It
Tell Miraxa exactly which fields you need (tax, due date, purchase-order number) and they become keys in the Response Schema. Change the Attachment Content type filter or Filename pattern (for example *.pdf) if vendors send other formats, and name the precise NetSuite record type or sublist you want populated so the extracted line items map straight into it. You can also add a Human approval step before the record is created if invoices over a threshold should be reviewed first.
Tips
- Keep the Knowledge node on a Transient collection so each invoice is embedded, queried, and discarded in the same run with no leftover storage.
- Use a Response Schema with explicit field types so the NetSuite mapping stays reliable even when invoice layouts vary between vendors.
- Use the netsuite Connector node in Direct mode for the final create step so the call is deterministic and costs no AI credits; reserve the AI work for the extraction.