How to automatically parse receipts in Flow Builder
Last updated
Last updated
In this guide, you’ll learn how to automatically extract information from incoming photos of receipts using the Analyze Image step in .
A
A or any other channel from
A workflow to handle the messages -
An (optional)
When working with text recognition (OCR), it’s a good idea to provide your customers with tips on how to upload quality images that will allow for correct text extraction. If you’ve ever had to sign up for an online banking service and uploaded a photo of your ID, you’ll probably be familiar with some of these guidelines!
Recommendations:
Placement: Make sure that the whole document is visible within the image. Don’t cut off any corners.
Orientation: Position the document with its original orientation. Avoid tilted images.
Supported file types: JPEG, PNG, and PDF.
When the Analyze Image step is configured for parsing receipt documents, the output will be a JSON object containing all detected properties. You can choose to make use of the whole object, or a certain property. Take a look at the examples below.
In this quickstart, we'll set up a flow that demonstrates how to automatically extract data from a receipt image and send it back to the user is the receipt belongs to a certain company.
Select an existing flow or create a new one. For this example, we're going to create a new custom flow with a Telegram trigger.
Add the Analyze Image step to your flow.
In the step's settings, under Image content to recognize, select Document.
Under Document type, select Receipt.
In the Output variable field, type image_content.
Click Save.
Add a branch step and check if the value of image_content.supplier_name matches the company name you would expect with a custom condition. For this example, we only want to consider receipts from the “Museumfoto” company, so we will match the image_content.supplier_name with “Museumfoto”.
In the success branch, add a Reply to channel message step. Add the image_content variable as the content. This will access the whole raw output instead of a single property.
Publish your flow in the top-right corner of your screen, and you're good to go!
Here's how it should look when you test it!
Log in to your and navigate to .
Example input | Example output |
"total_amount": 140, "purchase_timestamp": "1578418800", "supplier_name": "Museumfoto", "supplier_address": "Eggertstraat 2\n1012 NN Amsterdam\nNederland", "total_tax_amount": 24.3, "currency": "EUR" |