A Step-by-Step Guide to implementing AI in your App using IFTTT
Tutorial

A Step-by-Step Guide to implementing AI in your App using IFTTT

In this tutorial, we'll show you how to integrate Eden AI's Invoice parser API into your software using IFTTT to help streamline your financial operations and free up time for more important tasks. The same process applies if you want to include other features like : Image tagging, Explicit content detection, Text analysis and many more AI APIs we offer.

Build AI on IFTTT with Eden AI

Eden AI was created for no-coders having difficulties with choosing the right AI provider and/or integrating several APIs. Managing multiple accounts for each app can be a tough job, but with Eden AI, you can connect and manage all your APIs on a single account. Since some AI providers can be complex to use, we wanted to simplify the “no code” part and make AI available to as many people as possible.

Eden AI allows you to solve multiple AI tasks on IFTTT:

Let's practice with Invoice parsing!

Just like Receipt and Resume Parsing, Invoice Parsing is a tool powered by OCR to extract and digitalize meaningful data, Computer Vision to identify structure of the document, and NLP techniques to pin down the fields. Invoice parser technology extracts key information from an invoice (.pdf, .png or .jpg format) such as the invoice ID, total amount due, invoice date, customer name, etc.

Invoice Parsing results on Eden AI

Invoice Processing implies the necessity of software and technology to automate the processing and management of invoices. It includes tasks such as capturing invoice data, validating it in comparison to purchase orders, and routing it for approval, payment and archiving. The goal of AI in invoice processing is to improve efficiency, accuracy, and speed in handling invoices without any human intervention.

How to add invoice parsing to your app with IFTTT?

To better understand the capabilities of using Eden AI, let’s see in the example below how to use the Eden AI applet.

In this example, you can send an email containing an invoice file to the “Email integrations” Applet, which will extract the file, pass it to the “Eden AI” applet, which in turn will process the file and send the extracted information to the sender.

1. Add a "If This" trigger

Start by choosing the Email integrations applet to automatically extract an URL path of the file received in the email, serving as a “trigger”: the “If this” part of the equation. The applet will return some information.

For this example, we will consider only the two ingredients: “AttachmentUrl” which will contain an URL path of the invoice file sent to the email address, and the “from” ingredient which will contain the email address of the sender:

2. Add a "Then That" trigger

Next , select the second part of the equation: “then that”. We will be using the “Eden AI”  Applet to process  the file returned, and send back the data extracted to the email address specified in the Applet  

An action “perform invoice processing”, is created with two “action fields”: file_rul and Email address. The file_rul will be automatically populated with the “AttachmentUrl” ingredient and the Email address with the “from” ingredient.

Of course, you can choose other ingredients provided by the “Email” applet, but for the purpose of this example, you will only need these two ingredients.

3. Add an action to launch the invoice processing

In order to implement the Eden AI applet efficiently, please follow the the guidelines below to start building a simple service https://ifttt.com/docs/example_services

Then, you'll need to add an action to launch the invoice processing after receiving the file URL as follows:


@app.post('/ifttt/v1/actions/post_invoice_document', status_code=status.HTTP_200_OK)
def post_invoice_document(action_field : dict):
   # action fields
   file_url = action_field["actionFields"]["file_url"]
   email = action_field["actionFields"]["email_address"]
   # get file content from the file path url
   file_content = http.request("GET", file_url)
   # perform the Eden AI invoice processing
   edenai_ai_response= edenai_invoice_parser("en", ["amazon"], file_content.data)
   data = edenai_ai_response["extracted_data"][0]
   # translate the json response to an html code to be sent as an email body
   body_html = format_json_html(data)
   # send an email to the user
   send_email("Invoice informations", body_html, [email])
   # return the data or something else
   return {
       "data" : {
           **data,
       }
   }

The endpoint “post_invoice_document” will grab the specified action fields as explained above. After that, it will get the file content from the the URL. Using the file content’s bytes, you will launch an Invoice parser using the Eden AI API (simple lines to run an invoice processing using Eden AI are shown below).


def edenai_invoice_parser(language:str, providers: list, file: bytes):
   headers = {"Authorization": f"Bearer {EDENAI_KEY}"}


   url="https://api.edenai.run/v2/ocr/invoice_parser"
   data={
       "providers": providers,
       "language": language}


   files = {'file': file}


   response = requests.post(url, data=data, files=files, headers=headers)
   return response.json()["amazon"]

For reasons of simplicity, we'll be using Amazon Web Services as a provider to perform this invoice processing.

4. 🥳 Let's test applet!

Last but not least, you'll need to send an email to the following email address: trigger@applet.ifttt.com with an attached invoice file to test the applet. You will receive an email containing all the data extracted from the invoice file into the same email inbox.

If you're interesting in more low-code tools, have a look at our step-by-step tutorials on how to bring AI to your application with Power Apps, Google App Script, Retool, Make, n8n, Bubble, Dataiku, and Zapier.

Related Posts

Try Eden AI for free.

You can directly start building now. If you have any questions, feel free to schedule a call with us!

Get startedContact sales