# How to process images from Google Drive using Zapier

[Zapier](https://zapier.com) is a popular no-code tool that allows you to easily integrate and automate multiple tools.

In this tutorial, you'll learn how to use Zapier to create an integration that:

1. Watches a Google Drive folder to detect new images
2. Sends the new images to the [Image Editing API](https://docs.photoroom.com/image-editing-api-plus-plan)
3. Saves the result of the API call to another Google Drive folder

## Step 1: Watching a Google Drive folder <a href="#step-1-watching-a-google-drive-folder" id="step-1-watching-a-google-drive-folder"></a>

In Zapier, first create a new Zap, click to configure its *Trigger* and then select *Google Drive*:

<figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FgzcWeurbdZnKC5p7u8O6%2FScreenshot%202024-05-22%20at%2010.32.35.png?alt=media&#x26;token=6feb9d7d-e78d-461e-8b58-911e2e7bb44f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2F2cYNknvOsJURIOQnwmwQ%2FScreenshot%202024-05-22%20at%2010.32.42.png?alt=media&#x26;token=d32e5a96-df34-4b0c-bf9b-5ab5882e4535" alt=""><figcaption></figcaption></figure>

Then, select the event *New File in Folder*:

<figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FU2hBEbXAJ8kNyuiqamR6%2FScreenshot%202024-05-22%20at%2010.32.51.png?alt=media&#x26;token=3825d857-99ff-4faf-b801-c3ff0b35d99e" alt=""><figcaption></figcaption></figure>

Next, configure the connection to your Google Drive account and select the *Folder* where you will deposit the images that you want to process:

<figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FtW3IybhAqjzM70kX1DMU%2FScreenshot%202024-05-22%20at%2010.51.29.png?alt=media&#x26;token=90a21558-d640-408e-9383-5a867fb8fdf6" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2Ffe2MsU5bw2vOZpnjK6nh%2FScreenshot%202024-05-22%20at%2010.33.46.png?alt=media&#x26;token=1c39d48e-5f56-48e3-ab80-7c578e19f1ab" alt=""><figcaption></figcaption></figure>

## Step 2: Processing Images through the Image Editing API <a href="#step-2-downloading-files-from-google-drive" id="step-2-downloading-files-from-google-drive"></a>

Now that you've configured the event that will trigger your Zap, it's time to configure the action that your Zap will execute.

To do this, click on *Action*, search for "Photoroom" and pick *Photoroom (latest)*:

<figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FaYbIVrD2G2dWPf1F4cSQ%2FScreenshot%202024-05-22%20at%2010.55.22.png?alt=media&#x26;token=ba314a21-4084-40b8-a22b-ec6a2c309a4f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2F8v17RYohsbP8GgxfO1U6%2FScreenshot%202024-05-22%20at%2010.34.07.png?alt=media&#x26;token=3a4b90d9-be90-4446-82b7-93278b4cd69c" alt=""><figcaption></figcaption></figure>

Next, you'll set the *Event* to choose which API you want to call.

In this tutorial, we want to call the [Image Editing API](https://docs.photoroom.com/image-editing-api-plus-plan):

<figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FkOXmrRhCTnBZmJmOjYqu%2FScreenshot%202024-05-22%20at%2010.34.17.png?alt=media&#x26;token=4bde43f2-f42e-4652-8292-3b0f335b54c4" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
As you can notice, our Zapier integration also allows you to call our [Remove Background API](https://docs.photoroom.com/remove-background-api-basic-plan).
{% endhint %}

Then, you'll need to input your API key so that Zapier can call the Photoroom API on your behalf:

<figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FJU56OB3Xl1chjlFcJAKn%2FScreenshot%202024-05-22%20at%2010.34.22.png?alt=media&#x26;token=188e6bd3-61f7-40f2-9f78-1adb009967b0" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FfQ41bmJMzT8A0AKqkRv8%2FScreenshot%202024-05-22%20at%2010.34.48.png?alt=media&#x26;token=429492df-4732-4ec8-8d82-e38a83139221" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
If you don't have an API key, here are the [steps to create yours](https://docs.photoroom.com/getting-started/introduction#how-can-i-get-my-api-key).
{% endhint %}

Finally, you need to configure the parameters of the API call.&#x20;

First, you'll set the value of the `imageFile` argument to be the data of the file that has been added to the Google Drive folder:

<figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2F0cGCkNA9xW9xgcl8Ykeh%2FScreenshot%202024-05-22%20at%2010.35.47.png?alt=media&#x26;token=f54f1435-cfdb-4de5-96ca-624a803ea957" alt=""><figcaption></figcaption></figure>

Then, you can also add additional fields for the edits that you want to apply to the image.

Here we're setting an `outputSize` of `1000x1000` and a `padding` of `10%`:

<figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2F9EvidAOltGqn2B6JwfJr%2FScreenshot%202024-05-22%20at%2010.36.24.png?alt=media&#x26;token=39d18db0-361d-4620-8b81-551d058d6595" alt=""><figcaption></figcaption></figure>

## Step 3: Uploading the Result to Google Drive

You're almost finished, now you just need to upload the image returned by the [Image Editing API](https://docs.photoroom.com/image-editing-api-plus-plan) back to Google Drive.

To do this, you'll add a new Google Drive *Step*:

<figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FIdlZVKF73DXDur86KBtW%2FScreenshot%202024-05-22%20at%2010.36.42.png?alt=media&#x26;token=368d141f-8a8c-4d9c-9851-e2041b3e7406" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2Fh1tMrCmOl9akTQeVQyGo%2FScreenshot%202024-05-22%20at%2010.36.46.png?alt=media&#x26;token=47b4851e-f966-4fb0-810d-97874b828994" alt=""><figcaption></figcaption></figure>

Then, to configure this *Action*, you'll first set the *Event* to *Upload File*:

<figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FXSiG1ym11lLENJHhmtx3%2FScreenshot%202024-05-22%20at%2010.37.01.png?alt=media&#x26;token=60175532-4d32-4582-9746-9017005e52b5" alt=""><figcaption></figcaption></figure>

And then you'll set:

* the *Drive* and *Folder* where we want to save the result&#x20;
* the content of the *File* to the data returned by the API call
* &#x20;the *File Name* to that of the original file

<figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2F42lKqebrIS9Gq7ixzvdv%2FScreenshot%202024-05-22%20at%2010.38.07.png?alt=media&#x26;token=63ef28fd-9b01-405b-8b8e-5e5ef0fa59d2" alt=""><figcaption></figcaption></figure>

## Step 4: Testing the Integration

That's it, you've finished implementing your Zap!

You can click to *Publish* it:

<figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FUdKE2gAo6mkCyV3bulFf%2FScreenshot%202024-05-22%20at%2011.20.14.png?alt=media&#x26;token=41ebc374-1f05-4744-ac07-48d64027dc31" alt=""><figcaption></figcaption></figure>

And now that your Zap has been published, it's time to test it!

To do this, you'll simply add some images to the Google Drive folder that your Zap has been configured to watch:

<figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2FCQ0Nw3J0hgpIgqT6qZoN%2FScreenshot%202024-05-22%20at%2010.39.10.png?alt=media&#x26;token=3ef64c3f-ae82-4ea2-b27d-bc0045a6367a" alt=""><figcaption></figcaption></figure>

And then you can move to the folder that's been configured to receive the results and after a few moments you'll see the processed images appear:

<figure><img src="https://2855892273-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1SYxn7dWbQYsNtUdJE3f%2Fuploads%2F4zTMEb1w3IzF3N1eIkeY%2FScreenshot%202024-05-22%20at%2010.42.30.png?alt=media&#x26;token=c6256f52-10c7-487d-b345-047a98998769" alt=""><figcaption></figcaption></figure>

## Conclusion <a href="#conclusion" id="conclusion"></a>

In this tutorial, we saw how to use Zapier to easily integrate Google Drive with the Photoroom API.

We took the example of watching a Google Drive folder and automatically processing images through the [Image Editing API](https://docs.photoroom.com/image-editing-api-plus-plan), but it's of course possible to modify the workflow to:

* replace Google Drive with another storing service
* call another Photoroom API, like the [Remove Background API](https://docs.photoroom.com/remove-background-api-basic-plan)
* add additional steps to run some logic specific to your use case
