Mailhook and Knowledge: Image Receipt OCR Template
Email a photo of a receipt to a Spojit Mailhook address and get the merchant, date, and total back as clean JSON, read straight from the image with OCR.
What It Builds
This template starts with a Mailhook trigger, which gives the workflow its own dedicated email address. When someone emails a photographed receipt to it, an Attachment node fetches the image bytes and a Knowledge node embeds it as an Images-via-OCR document into a Transient collection (built and discarded within the single run). A second Knowledge node in Query mode then reads the text and returns the merchant name, date, and total as structured JSON.
The Prompt
Paste this into Miraxa and it builds the workflow, connecting the tools for you:
Build a workflow with a Mailhook trigger. When a receipt photo is emailed in, fetch the image attachment, embed it into a transient Knowledge collection using OCR, then query that collection to extract the merchant name, purchase date, and total amount and return them as JSON.
Connectors Used
- Mailhook - the trigger; gives the workflow a unique address that runs whenever mail arrives.
- Attachment - fetches the receipt image bytes from the incoming email.
- Knowledge - embeds the image via OCR, then queries it for the three fields.
Customize It
Change the extracted fields by editing the prompt: add tax, line items, or currency, or ask for a category guess. Swap the Transient collection for a persistent one if you want to keep every receipt searchable. You can also add a Send Email step to mail the JSON back to the sender.
Tips
- OCR works best on flat, well-lit photos; blurry or angled shots may drop the total.
- A Transient collection keeps storage clean for one-off receipts; use a persistent one only when you need history.
- Define a Response Schema on the Query node so the JSON shape stays consistent across every receipt.