> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vectorshift.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Gmail trigger

![Gmail Trigger Node](https://mintcdn.com/vectorshift/ko1lD3nuBSgpmLV4/images/platform/pipelines/start/gmail-trigger.png?fit=max\&auto=format\&n=ko1lD3nuBSgpmLV4\&q=85\&s=2ba98d7f186d9c96116a9e97d8828c79)

This node allows you to run the pipeline when “something” happens in your Gmail app (e.g., new email comes into your inbox).

The node has three progressive steps:

1. Action: Select the trigger action/event

   ![Gmail Trigger Node](https://mintcdn.com/vectorshift/ko1lD3nuBSgpmLV4/images/platform/pipelines/start/gmail-trigger.png?fit=max\&auto=format\&n=ko1lD3nuBSgpmLV4\&q=85\&s=2ba98d7f186d9c96116a9e97d8828c79)
2. Account: Select or connect the Gmail account you want to monitor

   ![Gmail Trigger Node](https://mintcdn.com/vectorshift/ko1lD3nuBSgpmLV4/images/platform/pipelines/start/gmail-trigger-1.png?fit=max\&auto=format\&n=ko1lD3nuBSgpmLV4\&q=85\&s=7c94ee672ba0a9493ef462b213443004)
3. Configure: Configure the trigger

   ![Gmail Trigger Node](https://mintcdn.com/vectorshift/ko1lD3nuBSgpmLV4/images/platform/pipelines/start/gmail-trigger-2.png?fit=max\&auto=format\&n=ko1lD3nuBSgpmLV4\&q=85\&s=05ced174ee0e2009802a5695fa108d35)

## Node Inputs

In the step 3:

1. Select Trigger: Select the trigger action/event. This will include options like `Inbox`, `Spam`, `Trash`, `Starred`, `Unread`, `Important`, `Drafts`, `Sent`
   * Type: `Dropdown`

## Node Parameters

On the face of the node:

In the step 1:

1. Select a Trigger Event: Select the trigger action/event. Currently, the only trigger event is `New Email`which triggers when a new email is received in the specified mailbox.
   * Type: `Select`

In the step 2:

1. Connect an Account: Select or connect the Gmail account you want to monitor
   * Type: `Select`

In the step 3:

1. Select an Event to respond to: Select the trigger action/event. Currently, the only trigger event is `New Email`which triggers when a new email triggers in the specified mailbox.
   * Type: `Select`
2. Enable Automation: Enable the automation to run the pipeline when the trigger event happens.
   * Type: `Toggle`

## Node Outputs

1. email\_id: The email id of the email that triggered the pipeline
   * Type: `Text`
   * Example usage: `{{trigger_0.email_id}}`
2. subject: The subject of the email that triggered the pipeline
   * Type: `Text`
   * Example usage: `{{trigger_0.subject}}`
3. sender\_email: The sender email of the email that triggered the pipeline
   * Type: `Text`
   * Example usage: `{{trigger_0.sender_email}}`
4. recipient\_email: The recipient email of the email that triggered the pipeline
   * Type: `Text`
   * Example usage: `{{trigger_0.recipient_email}}`
5. received\_time: The date and time the email was received
   * Type: `Text`
   * Example usage: `{{trigger_0.received_time}}`
6. contents\_of\_email: The body of the email that triggered the pipeline
   * Type: `Text`
   * Example usage: `{{trigger_0.contents_of_email}}`
7. attachments: The attachments of the email that triggered the pipeline
   * Type: `List<File>`
   * Example usage: `{{trigger_0.attachments}}`

## Considerations

* The trigger node will only work if the pipeline is deployed and the `Enable Automation` parameter is set to `true`.
* The parameter email\_id is often used in conjunction with the reply gmail action to reply in the same thread.

## Example

The below example is a pipeline which replies to an email which asks about VectorShift.

1. Gmail Trigger Node: Triggers the pipeline when a new email arrives in the inbox
   * Trigger Event: `New Email`
   * Enable Automation: `true`
2. Knowledge Base Node: Contains the information about Vectorshift. Queries the knowledge base using the body of the email.
   * Search Query: `{{trigger_0.contents_of_email}}`
   * Knowledge Base: `Trigger Demo Knowledge Base`
3. LLM Node: Uses the LLM to generate a response to the email using the context from the knowledge base.
   * System (Instruction): `Write an email in response to the given email using Context. Just write the email body, not subject.`
   * Prompt: `Email: {{trigger_0.contents_of_email}} Context: {{knowledge_base_0.context}}`
4. Gmail Node: Sends the generated email to the sender
   * Action: `Send Reply`
   * Body: `{{openai_0.response}}`
   * To: `{{trigger_0.sender_email}}`
   * EmailID: `{{trigger_0.email_id}}`

![Screenshot2025 05 23at1 57 45AM Pn](https://mintcdn.com/vectorshift/PSG1OGMwi51Mi0EL/images/Screenshot2025-05-23at1.57.45AM.png?fit=max\&auto=format\&n=PSG1OGMwi51Mi0EL\&q=85\&s=3874e56492f2b5e63eb173cf4e2ee232)

![Gmail Trigger Example](https://mintcdn.com/vectorshift/ko1lD3nuBSgpmLV4/images/platform/pipelines/start/gmail-trigger-example-1.png?fit=max\&auto=format\&n=ko1lD3nuBSgpmLV4\&q=85\&s=035e890f1904be35ef0c60a38a346e81)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.