11 – الجزء 2: كيفية توصيل Gmail API بـ n8n في وضع Self-Hosting

Share

Summary

This video explains how to connect the Gmail API to n8n in self-hosting mode, focusing on creating credentials and understanding the authentication process.

Highlights

Introduction to Connecting n8n with Gmail
00:00:00

The video starts by recalling the previous session about connecting n8n with Gmail. The goal is to set up an automated process to send emails. The presenter emphasizes that connecting n8n to Google's Gmail API requires understanding the authentication process.

Understanding Google Account Structure and API Communication
00:01:09

The presenter explains that a Google account holds various services like Gmail, Google Drive, Contacts, and Photos. n8n specifically needs to access only Gmail for this application. To establish this connection, an API (Application Programming Interface) is used, which defines rules and protocols for communication between n8n and Gmail.

The Analogy of a House and Doors for Google Account Access
00:02:39

An analogy of a house with different doors (Gmail, Google Drive, Contacts, Photos) is used to illustrate how n8n needs to access only a specific 'door' (Gmail) within the Google account. This requires a specific 'key' and 'secret' to prevent unauthorized access to other parts of the account.

Introducing OAuth 2.0 and Client ID/Secret
00:04:10

Google uses OAuth 2.0 (Authentication Server) for secure access. n8n introduces itself to this server using a 'Client ID' and a 'Client Secret'. These act as keys to grant n8n specific permissions, like sending emails via Gmail, without accessing other Google account data.

Setting Up Google Cloud Project for Gmail API
00:05:49

The video guides through setting up a Google Cloud project. This involves creating a new project, naming it, and enabling the Gmail API. This is the first step in generating the Client ID and Client Secret.

Configuring OAuth Consent Screen
00:08:48

The next step is to configure the OAuth consent screen. This includes setting the application name (n8n), user support email, and selecting the user type (external) since it's not an internal organization application. This step ensures users are aware of what n8n is trying to access.

Creating OAuth Client ID and Client Secret
00:10:49

The presenter demonstrates creating the OAuth Client ID and Client Secret. This involves specifying the application type as 'Web application', naming it, and providing the redirect URI from n8n. The redirect URI is crucial for Google to verify requests from n8n.

Connecting n8n with Google Cloud Credentials
00:12:24

Once the Client ID and Client Secret are generated, they are copied from Google Cloud and pasted into n8n's credentials section. It's important to save the Client Secret immediately as it won't be accessible again after closing the window.

Adding Test Users and Finalizing Connection
00:13:08

A critical step is adding the email address that will be used for n8n in the 'Test Users' section of the Google Cloud console. This allows n8n to connect successfully. After this, signing in from n8n using that email will establish a successful connection.

Sending an Email with n8n
00:15:30

The video then demonstrates how to send an email using the newly established connection. This involves selecting 'Send Message' on n8n's Gmail node, specifying the recipient email, subject, and the message content, which can be dynamically pulled from the n8n chat input.

Demonstration and Verification of Email Sending
00:18:36

A live demonstration shows sending a test message from n8n's chat. The message is successfully sent to the specified email address, verifying the integration works. The sent email in the recipient's inbox confirms the subject and content from n8n.

Reviewing Executions and Data Formats in n8n
00:19:48

The presenter reviews the execution history in n8n, showing the details of successful email sends. It also briefly touches on how data is handled in n8n, such as input/output formats (schema, table, JSON) and how the trigger node only has output.

Conclusion and Future Steps
00:23:52

The video concludes by reiterating the simplicity of connecting n8n with Gmail using these steps and encourages viewers to try it, emphasizing the benefits of self-hosting n8n (free and unlimited executions). The next video will cover more advanced applications.

Recently Summarized Articles

Loading...