I am running my own company for years. Every month I need to gather all cost bills and invoices (really 95% of them are sent via mail), put them in a single e-mail and send to my accountant. Previously every such e-mail I received, I had to flag, then copy its attachment to a draft mail that was sent by the end of month to my accountant. Manually it was a significant amount of work
Therefore I decided to built a Flow and to engage LUIS for help. The process is quite simple:
LUIS (Language Understanding Intelligent Service)
I decided to utilize the power of Cognitive Services to automatically parse and verify if the received e-mail contains invoice or not. For this purpose I have created new app under: https://www.luis.ai/applications and then two Intents: Invoices and None:
Next, I created an Entity (type Simple) containing keywords (Role names) identifying invoice-related contents, such as: "invoice", "bill", "itinnerary", etc..., for languages in which I usually receive documents (English, Polish, German):
Then I used already received e-mails to train my model. And also, while adding, to bind keywords with Role names:
To do that simply hover keyword (1), then open the created Entity (2), and then select related Role name (3).
Finally I hit "Train", so that my model became ready to test:
Next I verified for some random mail bodies, if the model works fine and finally I've published it.
The Flow
Below is the initiation part of the Microsoft Flow I am using
Next it's checking if the prediction value fits within tresholds:
If the score is bewteen 0.7 and 0.9, Flow is moving into "Switch" action, to check outcome of the approval:
Adding utterances to intents and training the model is done using P1 HTTP actions, that are using LUIS endpoints as described here: https://westus.dev.cognitive.microsoft.com/docs/services/5890b47c39e2bb17b84a55ff/operations/5890b47...
Next Flow is processing the mail itself:
Final words
This is how the Flow works - it saves me really lots of work. What I wish it is also able to do, is to read through the attachments to automatically discover the amount, payment due date etc... so that it would also be able to:
However since the documents are mostly often PDF files, and having different formats, there is no easy way today to get these information using Microsoft Flow only. Possibly one day OCR present in Cognitive Services actions will allow also to process PDF files.
Here is the video that I recently posted covering this scenario!
I hope you find this process inspirational for covering your own needs. If you have any quesitons reach me out here or via my blog (https://poszytek.eu) or through Twitter (@TomaszPoszytek).
Thanks for reading! 😁