In this guide, you’ll learn how to automatically extract information from incoming photos of invoices using the Analyze Image step in Flow Builder.
What you'll need
- A MessageBird account
- A WhatsApp for Business account or any other channel from MessageBird's offering
- A workflow to handle the messages - Flow Builder
- An Inbox account (optional)
Image quality best practices
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!
- 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.
Input and output examples
When the Analyze Image step is configured for parsing invoice 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 example below.
|Example input||Example output|
Step-by-step: Setting up an invoice parsing flow
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.
- Log in to your MessageBird Dashboard and navigate to Flow Builder.
- 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 Invoice.
- 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 invoices from the “Messagebird” company, so we will match the image_content.supplier_name with “Messagebird”.
- 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!