Setting Up an Email Trigger
Configure your workflow to start when a new email arrives in a monitored inbox.
Overview
An email trigger watches a Gmail or Outlook mailbox and starts your workflow whenever a new message arrives that matches your filters. Spojit polls the inbox on a configured interval, hands the message contents to the workflow, and optionally takes a follow-up action on the email (mark as read, move to a folder) so it is not processed twice.
Email triggers are useful for inbound work that lands as a message: support tickets emailed in by customers, automated reports from third-party systems, supplier invoices, order confirmations, anything where the inbox is the system of record for the event.
Before You Start
- You need an OAuth connection to the mailbox provider (Gmail or Outlook). Create one in Connections if you do not have it yet.
- Decide upfront how processed emails should be marked so they do not re-trigger the workflow.
Configuration
- Click the Trigger node on your canvas.
- Set the trigger type to Email.
- Pick the email connection (Gmail or Outlook).
- Set the polling interval - how often Spojit checks for new messages.
- Optionally add filters (from address, subject pattern, folder or label).
- Choose a post-processing action (mark as read, move, or leave alone).
- Save the workflow and make sure it is enabled.
Filters
- From address - Only trigger on emails from a specific sender (for example
billing@vendor.com). - Subject pattern - Only trigger on emails whose subject matches the pattern.
- Folder / Label - Watch a specific folder (Outlook) or label (Gmail) instead of the entire inbox.
Post-Processing
- Mark as read - Prevents the same message triggering the workflow again. Recommended default.
- Move to folder / label - Move processed messages out of the watched folder so the inbox stays clean.
- No action - Leave the message exactly as it arrived. Only use this if your filters are tight enough that re-processing is impossible.
Available Data
The message is exposed downstream as {{ input }} with these fields:
{{ input.from }}- Sender address.{{ input.subject }}- Subject line.{{ input.body.text }}- Plain-text body.{{ input.body.html }}- HTML body.{{ input.attachments }}- Array of attachments (filename, content type, content).{{ input.receivedAt }}- Timestamp.
Example: Customer Support Intake
Watch a shared support@ mailbox, filter on subject prefix [ticket], mark processed messages as read, and pipe {{ input.from }} and {{ input.body.text }} into a Connector node that creates a ticket in your helpdesk.
Tips
- Use folders or labels rather than the inbox root. It is much easier to reason about which messages will trigger the workflow.
- Always pick a post-processing action other than No action unless you have a very narrow filter. Otherwise the same message fires the workflow on every poll.
- For high-volume inboxes, shorten the polling interval. For low-volume, lengthen it to reduce API quota usage on the email provider.
- Test with a real email forwarded from a colleague before going live. Real messages reveal encoding and attachment quirks that synthetic tests miss.
Common Pitfalls
- OAuth token expired - If the email connection's token lapses, polling stops silently. Spojit will surface this on the connection card; reconnect to restore the trigger.
- Reprocessing loop - Choosing No action with a broad filter fires the workflow for the same message every poll cycle.
- Wrong folder - If you point at a folder that the provider does not actually create messages in (for example trying to watch Outlook's
Junk), you will see no triggers. - Polling delay - Email is not instant. Expect up to one polling interval of latency between arrival and trigger.
Related Articles
- Setting Up an OAuth Connection
- Setting Up a Manual Trigger
- Setting Up a Schedule Trigger
- Setting Up a Webhook Trigger
- Using Send Email Nodes