Start Your Automation
Fill out the form and one of our consultants will reach out to you within a day! Or just drop an email at... contact@cloudifybiz.com
N8N is a powerful automation tool that allows you to connect various services and create custom workflows. Integrating Google Drive or Gmail with n8n using APIs opens up a world of possibilities for automating tasks like file management, email automation, and much more.
In this guide, we’ll walk through how to connect Google Drive and Gmail to n8n using their respective APIs, so you can automate your workflows and save time.
Before you can connect Gmail or Google Drive to n8n, you need to create a project in the Google Cloud Console.
1. Go to Google Cloud Console: Open the Google Cloud Console.
2. Create a new project:
• Click the project dropdown on the top and select New Project.
• Name the project (e.g., “n8n Integration”).
• Choose your organization or leave it as “No organization” if you don’t have one.
• Click Create.
3. Enable APIs:
• After your project is created, you will be redirected to the dashboard.
• Click on APIs & Services > Library.
• Enable Google Drive API and Gmail API by searching for them in the API library and clicking Enable for each.
1. Create OAuth Consent Screen:
• Go to APIs & Services > OAuth Consent Screen.
• Select External and click Create.
• Fill in the necessary fields, including the app name and support email.
• Under “Scopes for Google APIs”, you can leave it empty for now or add required scopes later.
• Save your changes.
2. Create OAuth Client Credentials:
• Go to Credentials and click Create Credentials > OAuth Client ID.
• Select Web application.
• Under Authorized redirect URIs, add the redirect URI from your n8n instance (e.g., https://<n8n-instance-url>/rest/oauth2-credential/callback).
• Save the credentials. You will be given a Client ID and Client Secret. Copy these as they will be needed for the n8n configuration.
1. Access n8n: Log in to your n8n instance.
2. Create OAuth2 Credentials:
• Go to Credentials from the left-hand menu.
• Click Create New Credential > Google > Google OAuth2 API.
• Enter the Client ID and Client Secret you obtained from the Google Cloud Console.
• Set the Scope according to the service you want to integrate. For example:
• For Google Drive: https://www.googleapis.com/auth/drive.
• For Gmail: https://mail.google.com/.
• Click Save.
3. Authenticate: Once the credentials are saved, click Connect OAuth2 Account. This will redirect you to Google to authenticate and grant permissions to the n8n app. Upon successful authentication, your credentials will be connected to n8n.
Now that your credentials are set, you can start using Google Drive or Gmail in your workflows.
1. Create a New Workflow:
• In n8n, click New Workflow.
2. Add Google Drive Node:
• Add a node by clicking the + button.
• Search for Google Drive and select it.
• In the node settings, select the credentials you created earlier.
3. Configure the Action:
• Choose the action you want to perform, such as Upload File, List Files, Delete File, etc.
• Configure the necessary inputs, such as the file path, folder, or file name.
• For example, if you want to upload a file, specify the file path, and n8n will automatically handle the upload to your Google Drive.
1. Create a New Workflow:
• Create a new workflow as before.
2. Add Gmail Node:
• Click + to add a new node.
• Search for Gmail and select it.
• Choose the credentials you created.
3. Configure the Action:
• You can choose actions like Send Email, List Emails, Delete Email, etc.
• For sending an email, configure the subject, recipient email, and body content.
You can combine both Google Drive and Gmail in a single workflow. Here’s an example:
1. Start with Google Drive:
• Add the Google Drive node and configure it to upload a file.
2. Add Gmail Node:
• After the Google Drive node, add a Gmail node.
• Configure it to send an email notification with the details of the uploaded file (e.g., include the file link).
3. Execute Workflow: Run the workflow to see it in action.
Once your workflow is set up, it’s important to test it thoroughly. Run the workflow in Test Mode to ensure the nodes are properly connected, and the automation is working as expected. You can also use n8n’s built-in debugging tools to identify any issues.
With the integration in place, you can automate recurring tasks like:
• Automatically uploading files from a source to Google Drive.
• Sending templated emails using Gmail for notifications, updates, or promotions.
• Combining the two for workflows like receiving files, processing them, and sending results via email.
Integrating Google Drive and Gmail with n8n using APIs gives you a robust platform to automate tasks that can save time and reduce manual efforts. With OAuth2 credentials and easy-to-configure workflows, you can quickly start automating processes involving Google services. Whether you want to manage files in Google Drive or automate email responses in Gmail, n8n provides a flexible solution for all your automation needs.
Happy automating!
Fill out the form and one of our consultants will reach out to you within a day! Or just drop an email at... contact@cloudifybiz.com