How to Automate Procurement in Your Shopify Store - Part 4
Welcome to the final part of our procurement automation series!
For the closing piece of this series, we will show you how to automatically watch your email inbox for invoices received from vendors, upload them to Google Drive and Airtable, and forward the emails to your finance team so they can process the corresponding payments.
Before we roll up our sleeves, let’s take a quick look at what the following scenario does, and how the steps are structured.
Automatically forwarding invoices received via email: How the process works
In the tutorial below, we will create an Make scenario that watches your email inbox for invoices, stores them on two apps (Airtable and Google Drive), and sends them to your finance team (or person) for processing.
The process works as follows. First, Make watches for invoices from the vendor.
To do so, a filter searches for the word “invoice” in the subject line of the email, and only emails with attachments are processed in the scenario. Bear in mind, you can change the word that you want to use to filter emails to match your real-life situation.
At the same time, when an invoice hits the inbox, Make creates a record on Airtable and sends a notification via Gmail.
The attachment (the invoice or invoices) are then uploaded to a Google Drive folder corresponding to the vendor in question. In other words, there are Google Drive folders for each vendor, and invoices are automatically forwarded to each one of these as they arrive.
Invoices are also uploaded to our master Airtable base, and listed in the “Supplier invoices” table. When this happens, the status of the records (invoices) are set to “awaiting payment”.
Finally, an email with the invoice is sent to the finance team for payment.
As you can see, this automation will remove a massive load of work from your shoulders, and work 24/7 for you at a fraction of what it costs to do this manually.
Before we start building this, remember that all our procurement automation scenarios rely on the same Airtable base, which you can find (and copy) here.
Now, let’s get down to work and see how to create this.
Step 1: Retrieving the invoices and uploading to Google Drive
After creating a new scenario from your dashboard, add the “Gmail > Watch emails” module.
Once you establish a connection to Make, configure the module as follows:
Select the inbox folder you want to watch for the invoices
Select Gmail filter as the Filter type
For the Query field, use a query that searches for the specific word in the subject line (like “invoice”) to identify the correct emails. Of course, if your vendor’s email contains something different then adapt the query accordingly
You can choose if you want the emails to be marked as read once fetched
You can also increase the maximum number of returned emails during a scenario execution to a higher number (if you receive lots of emails, the number should be high)
Now, we only want to process emails that have attachments (invoices), so to avoid “false positives”.
For example, a vendor might want to discuss something about an invoice and include the word “invoice” in the subject to do so. Since we want to avoid these emails getting processed by our scenario, we will rely on a specific module.
The Make Gmail app has its own iterator module. We will use it to iterate through the attachments so that these can be uploaded to Google Drive.
So add the “Gmail - Iterate attachments” module to the scenario. There’s no further configuration needed here as the previous module is pre-selected. So, after adding this module, just hit the “OK” button and proceed to the next step.
Step 2: Adding the Google Drive modules
In Google Drive you can have sub folders for each of your vendors, so you can save their invoices in matching folders:
Folder: InvoicesSub folder: Make
We will now see how to upload the invoices to the right folders.
Bear in mind, the names of the subfolders have to match the sender’s names in the emails for this to work correctly.
Begin by adding the “Google Drive - Search for files/folders” module to your scenario.
After connecting your Google Drive account to Make, follow the instructions below:
Choose Select from the list under method
Select My Drive
Select the parent/main folder
Select Folders under Retrieve
Search within file/folder names
Map the Sender: Sender name element to the Query field
Search for name containing the search term
Increase the maximum number of emails returned in an execution in the Limit field to 10 (or more)
Once you do this, hit the ”OK” button and add the “Google Drive - Upload a file” module to your scenario.
Here, simply map the File ID to the Folder ID field. The Source file is already selected for you.
After doing this, hit the “OK” button and move to the next step.
Step 3: Create a record on Airtable and send an email to finance for payment
To create a record on Airtable containing the sender’s name, email address, and the invoice file, we will need the Google Drive link to the file first.
In order to obtain this link, add the “Google Drive > Get a share link” module to your scenario.
In the configuration box, map the File ID from the “Google Drive - Upload a file” module to the File ID field, and ensure that the Role is set to “Reader” and the Type to “Anyone”.
Once done, hit “OK”, and move to the next step.
Step 4: Adding invoice data to Airtable
Now it’s time to add the “Airtable > Create a record” module to your scenario.
In the configuration box, select the Base and this time around select the Supplier invoices table, as this is where Make will be creating records for newly received invoices.
Next, map the Sender: Sender name and the Sender: Email address elements to the Sender and Email fields respectively.
Enter Awaiting payment in the Status field.
In the Invoice field, click Add item and map the Web Content Link element outputted by the “Google Drive - Create a share link” module to the File URL field.
Then, map the Name element from the “Google Drive - Upload a file” module to the File name field.
Step 5: Auto forwarding the invoice to the finance team
Finally, add the “Gmail > Send an email” module to your scenario.
In the configuration box, add the recipient (or recipients) that you want to send the invoices to for processing. Feel free to enter whatever subject line and content you want.
Scroll down to Attachments, click Add an attachment and you’ll see that “Gmail > Iterate attachments” is automatically selected as the Source file, so just click Add and you're good.
Then, click “OK”, and move to the next step.
Step 6: Testing the scenario
If you have an email in your inbox that matches your query in the trigger module (i.e. subject: invoice), execute the scenario.
This is what you should see happening:
Then, save and schedule the scenario accordingly.
Once the payment has been made to the vendor, the status of the record can be manually changed on the Suppliers invoices table to Paid.
You could also create another Make scenario to watch for payments made and change the statuses automatically; however this is not covered in this series.
Bonus: Slack notifications
You may have several teams in your business and probably use an IM tool like Slack for easy communication between departments.
If that’s the case, you could also notify your finance team about the new invoice over Slack.
So, add the “Upload a file” Slack module to the scenario.
After you connect your account to Make, click Add item under Channels.
Here, select the right Channel Type and tick the channel/s you want to send the invoice to. You can also add a title and comment to the message.
Once done, hit “OK”, save and activate the scenario.
Congratulations! You have now reached the end of our procurement automation series.
After implementing the scenarios, you will have a nice little system that will automatically manage the brunt of the procurement process for you: From monitoring inventory levels for all your products to sending purchase orders and forwarding the corresponding invoices for processing.
We are confident that the shorter you implement this, the faster you will start reaping benefits of procurement automation, including less time and resources spent on routine activities.
Ultimately, we believe that having this system in place will lift a weight from your shoulders, and allow you to focus on what matters the most: The success of your Shopify store.