In this article, we’ll explain how to import files from Google Drive, by sending them to Funnel using Zapier and Funnel's webhook. To learn more about our webhook in general, please see this article.
Prerequisites
We will use Zapier's webhook feature for this process, so you'll need to be a Zapier Premium customer.
Overview
1. Setup in Google Drive
In this example, we'll start with an empty folder in Google Drive. The most important step is to ensure that the sharing options are set to "Anyone with the link" can view.
When new files are added to this folder, Funnel will import them automatically providing they are CSV, TSV, TXT, XLSX, or ZIP files.
2. Create a webhook data source in Funnel
Head to the Data Sources section, click "Connect Data Source", and select File Import, or Webhook from the list.
Give the File Import source a name and make sure Webhook is selected under transport types.
If you already have a File Import source, you can click on “Transport types” in the top right corner of the existing source, select the webhook transport type and click save.
We’ll need the Endpoint URL and Token from this section in the next step.
3. Create a zap in Zapier
Step 1
Head to zapier.com/app/zaps and click on "Create Zap" in the top left corner.
In the first step, select the Google Drive app as the Trigger. We're going to select "New File in Folder" since in this example we want Funnel to import new files as they're added to the folder.
You could for example use "Updated File" if you have a single file in Google Drive which is updated frequently.
Authenticate with your Google account and ensure that the trigger points to the correct Drive and Folder before testing this step.
Step 2
For the second and final step in this zap, we want to select the "Webhook by Zapier" app, select the "Custom Request" event, and click continue.
Select "POST" as the method, and copy and paste the endpoint URL in Funnel to the "URL" section. Next, paste the code below into the "Data" section and replace "DRIVE ACTION HERE" with the Google Drive Zapier action "Web Content Link".
{ "urls": [ "DRIVE ACTION HERE" ] }
It's really important that the Web Content Link action is surrounded by quotation marks, otherwise, it won't work. This is highlighted in the screenshot below.
You should notice that an "Insert Data..." window appears when you click in the "Data" section. This is where you select the "Web Content Link" action.
Finally, scroll to the bottom and add two headers. The first header should be called "x-funnel-fileimport-token" and it should contain the token from Funnel.
The second header should be called "content-type" and contain "application/json".
Click continue and test this step. If you see "No data was found", don't worry! That's just because we don't have a file in our folder at the moment. Providing all sections now have a green checkmark, you can publish the zap by clicking on the button in the top right corner.
If you receive a different error when testing this step, please refer to the webhook API documentation for error codes and troubleshooting.
4. Finishing up
After the webhook has been published, add a new file to your Google Drive folder, head to your Funnel account and wait a few minutes.
The time it takes to appear in Funnel can vary depending on the file size.
Once you can see the file in Funnel, click on "Finish Configuration" in the top right corner to define your fields and finish the setup.
You should now have an active webhook source in Funnel that runs every time a new file appears in your Google Drive folder.