Email Arrival

📖 Definition


The Email Arrival trigger automatically starts a flow when a new email arrives in a connected Gmail account. It’s ideal for automating tasks based on incoming emails—like routing support tickets, saving attachments, or sending auto-replies.

Key capabilities include:

  • Real-time automation when new emails are received
  • Support for Gmail delegates and multiple inboxes
  • Access to detailed email data, including subject, sender, body, attachments, headers, and more
  • Useful for creating email-based workflows like request handling, notification systems, or document processing

This trigger enables seamless integration between Gmail and your automated processes, allowing actions to occur instantly based on the contents or metadata of received emails.



Example Use Cases


1. Invoice Processing

Automatically start a flow when an email with the subject line containing "Invoice" arrives — extract the attachment and send it for approval or upload to an accounting system.


2. Customer Support Routing

Trigger a flow when a customer support email comes in, then check the sender or subject line to route it to the appropriate team or system like Zendesk or Salesforce.


3. Newsletter Archiving

Use the trigger to capture and archive incoming newsletters or updates from a specific sender for documentation or compliance purposes.


4. Conditional Run: Skip Internal Notifications

Run the flow except when the sender is from your own company domain, helping reduce unnecessary automation from internal notification emails.


5. Conditional Run: Only on Weekdays

Only process incoming emails if the received date (output: Date) falls on a weekday — use Conditional Run to skip weekend emails.


6. Attachment-Based Processing

Trigger a flow when an email arrives with specific attachments (based on filename, size, or content type), then save those files or process their contents further.



Configuration

The configuration for the Email Arrival trigger is divided into two main parts: Settings and Conditional Run.


Settings

These define where the trigger listens for incoming emails:

1. Gmail Connection

This field connects your Zenphi flow to a Gmail account. You’ll need to authenticate with your Gmail account to allow Zenphi to monitor it for incoming emails. This is a one-time setup per connection and enables Zenphi to read the content of the received emails securely.

Only accounts you've given Zenphi access to will appear here.

2. Select Email Address

Once connected, this dropdown allows you to choose which email address (and its delegates, if any) to monitor for incoming emails. This can be:

  • Your primary Gmail address
  • Any delegated Gmail inbox (for example, shared inboxes or teams)

This ensures flexibility in managing flows across different inboxes within the same workspace.


Conditional Run

The Conditional Run feature allows you to control whether a flow should proceed based on the details of the incoming email. This is especially useful when you want flows to run only under specific conditions — for example, if the email comes from a certain sender, includes attachments, or matches a particular subject line.

If the email does not meet the defined conditions, the flow will be skipped.


How Conditional Run Works

When enabled, Conditional Run allows you to define one or more conditions using AND / OR logic. Each condition includes four elements:

1. Condition Type

  • When: The flow will run only if the condition is true.
  • Except When: The flow will not run if the condition is true.

2. Value to Evaluate

Choose the field from the incoming email that you want to evaluate. This can include:

  • Trigger Outputs – data extracted from the incoming email (e.g., From, Subject, To, Date, Text Body, Has Attachment, etc.)
  • Vaults – secure, static values such as expected sender addresses or specific keywords

Vaults are securely managed under Settings → Vaults in your workspace. Their values are hidden and cannot be altered inside a flow, only referenced securely at runtime.

3. Operator

Define how the comparison will be made. Options include:

  • Equals / Not Equals
  • Contains / Does Not Contain
  • Is Null / Is Not Null
  • Starts With / Ends With

4. Comparison Value

Set the value to compare against. This can be:

  • A fixed text (e.g., "[email protected]")
  • A Vault variable
  • A field from the trigger outputs

Example Conditions

  • Run the flow when the sender’s email equals "[email protected]"
  • Skip the flow except when the email contains an attachment
  • Run the flow when the subject line contains "Invoice"
  • Run the flow when the received date is not null
  • Combine rules like: From = [email protected] AND Subject contains "Invoice" AND Attachments is not null


Outputs


When an email is received and the Email Arrival trigger is activated, it captures a rich set of information about the email. These outputs can be used:

  • In subsequent actions throughout the flow via the Token Picker
  • In Conditional Run, to define conditions based on the email's content or properties

Here’s a breakdown of the available outputs for easier understanding:


1. Id

A unique identifier for the received email. Useful for referencing the message in API calls or logs.

2. Label Ids

A list of label IDs that are applied to the message in Gmail. Helps you determine how the email was categorized (e.g., “Important”, “Promotions”).

3. Thread Id

The ID of the email thread this message belongs to. Great for tracking conversations or grouping related replies.

4. Snippet

A short preview of the message body (plain text). Useful for quick summaries or notifications.

5. Estimated Size

An approximate size of the email in bytes. Can be used to skip processing overly large emails.


6. Delivered To

The email address to which the message was delivered. Useful when working with aliases or multiple recipients.

7. Return Path

The address used to return undeliverable mail. Helpful for diagnosing delivery issues or spam checks.

8. From

The sender’s email address. Essential for filtering emails based on sender identity.

9. Subject

The subject line of the email. Often used for categorization, filtering, or routing decisions.


10. Html Body

The email body in HTML format. Use this if you're sending formatted messages or extracting styled content.

11. Text Body

The plain-text version of the message body. Ideal for parsing or extracting keywords from unformatted content.


12. To / Cc

The primary and copied recipients of the email. Useful for workflows that vary based on who the email was sent to.

13. Date

The date and time when the email was received. Helpful for time-sensitive processing or comparisons in Conditional Run.


14. Message Id

The unique value from the "Message-ID" header. Used for advanced tracking or deduplication.

15. References / In-Reply-To

Metadata that links replies to earlier messages in the thread. Great for identifying ongoing conversations or determining if the email is a reply.

16. Reply-To Address

If present, this is where replies to the email should be directed (can differ from the “From” address).


17. Attachments

A list of files attached to the email. Each includes:

  • Id: Unique ID of the attachment
  • MIME Type: File type (e.g., image/png, application/pdf)
  • File Name
  • Size: File size in bytes
  • Content Id / X-Attachment-Id: Internal Gmail identifiers
  • File Contents: The actual file data (used for saving or processing)


📌 Example: Auto-Save Invoices from a Specific Vendor


ScenarioYour finance team receives monthly invoices via email from a specific vendor (e.g., [email protected]). To eliminate manual effort and ensure consistency, you want to automate the process of saving invoice attachments to a designated Google Drive folder, organized by month.


How the Flow Works

  1. Trigger:The flow starts when an email arrives in a connected Gmail account.

  2. Conditional Run (optional):You can add conditions to ensure the flow only runs if:

    • The sender's email address is [email protected]
    • The subject contains the word “Invoice”
    • There is at least one attachment
  3. Steps in the Flow:

    • Extract the PDF attachment(s)
    • Create or identify a Google Drive folder using the current month as the folder name
    • Save the attachment(s) in the designated folder
    • (Optional) Send a notification to the finance team that the invoice has been archived

Why It’s UsefulThis automation eliminates repetitive manual tasks, reduces the chance of missed or misplaced invoices, and maintains a clean, date-organized archive for audit or recordkeeping.