# Gmail

## Create credential in Flowise

1. Add a new Gmail OAuth2 credential
2. Enter a name for the credential.
3. Copy the OAuth Redirect URL.
4. Note that the following fields need to be filled in:
   * Client ID
   * Client Secret

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2FiMJCRGLFxuDHbBre8axG%2Fimage.png?alt=media&#x26;token=6333447c-5157-4a8a-a66d-136b953f834f" alt="" width="437"><figcaption></figcaption></figure>

## Create/Use Google Project

1. Log in to your [**Google Cloud**](https://console.cloud.google.com/) account.
2. Navigate to [**Google Cloud Console > APIs & Services**](https://console.cloud.google.com/apis/credentials), and select the project you want to use from the dropdown at the top left (or create a new project and select it).
3. Set up the **OAuth consent screen** if you haven't configured one before.

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2FXU8WhDfWRUBDkQnDlKBa%2Fimage.png?alt=media&#x26;token=47a21032-cc37-4b89-a97b-7b44e2c88026" alt="" width="563"><figcaption></figcaption></figure>

4. Go to **Credentials**, then click **+ CREATE CREDENTIALS > OAuth client ID**.

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2FrJRL3gwKozGqhetnBTy1%2Fimage.png?alt=media&#x26;token=c8616f76-4231-4da3-a337-b4f0cbc53bf4" alt="" width="563"><figcaption></figcaption></figure>

5. In the **Application type** dropdown, select **Web application**.
6. Under **Authorized redirect URIs**, click **+ ADD URI** and paste the OAuth redirect URL copied earlier.
7. Click **Create**.

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2FlxmMRYcSYAkYJQTrsvP7%2Fimage.png?alt=media&#x26;token=cbd7af36-fba9-4b3f-9b31-53afe5bac0cd" alt="" width="407"><figcaption></figcaption></figure>

8. Copy the Client ID and Client Secret:

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2FpimyhmnkK6tsiaB2xu30%2Fimage.png?alt=media&#x26;token=14f59d00-98fb-4e10-8fdc-92b1e88cdc60" alt="" width="489"><figcaption></figcaption></figure>

9. In **Enabled APIs & Services**, click **+ ENABLE APIS AND SERVICES**.
10. Search for and enable the **Gmail API**.

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2FiU1ragtvVWDA11LPFrMk%2Fimage.png?alt=media&#x26;token=23bbadb3-7d9d-4b9a-a396-46536bf78455" alt="" width="538"><figcaption></figcaption></figure>

11. Return to **Credentials**, click the newly created credential under **OAuth 2.0 Client IDs**, and on the detail page, you’ll find the **Client ID** and **Client Secret**.

## Finish setup in Flowise

1. Fill in all the values copied earlier. Then click "**Authenticate**":

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2FWCBJNmvERr1UNegyL17I%2Fimage.png?alt=media&#x26;token=44f23c95-6dd0-40d1-90be-0f9c2c1e07ab" alt="" width="433"><figcaption></figcaption></figure>

2. A Google login window will pop up:

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2F2du4kJJezWmMsUUH3udu%2Fimage.png?alt=media&#x26;token=570b45b2-0e9d-45b7-af24-173d96a0a2f6" alt="" width="448"><figcaption></figcaption></figure>

3. Grant the permissions:

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2FgRi2mgAQ1R2in0xLvv8M%2Fimage.png?alt=media&#x26;token=291c5e3d-9248-430c-bd28-d55a8478fddd" alt="" width="373"><figcaption></figcaption></figure>

4. Pop up window will be closed automatically and credential will be saved and ready to be used.

## Use as Agent Tool

Multiple actions can be selected to let the Agent intelligently choose the appropriate one.\
Parameters can be left empty to allow the Agent to determine the values on its own. However, if the user provides values, those will override the Agent's choices.

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2FX0kbvYsB8PhNRW7sFQ7V%2Fimage.png?alt=media&#x26;token=44682f7b-9c27-4785-b4a3-d22fa1dc7aba" alt=""><figcaption></figcaption></figure>

## Use as Tool Node

It can also be used as a Tool Node in a determined workflow scenario. For example, retrieving a list of draft messages before proceeding to the next step.\
In this mode, **Tool Input Arguments must be explicitly defined and filled with values**.\
Unlike the [**Use as Agent Tool**](#use-as-agent-tool) option, there is no Agent to automatically determine the inputs. The user must manually populate the fields, either by entering fixed values or using variables enclosed in double curly brackets `{{ }}`.

<figure><img src="https://823733684-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F00tYLwhz5RyR7fJEhrWy%2Fuploads%2Fd1lDjbK02WEySiy8sZKO%2Fimage.png?alt=media&#x26;token=9c5447ed-f45b-4f2d-b87b-a7e33615ac00" alt=""><figcaption></figcaption></figure>
