EmailConnect Trigger icon

EmailConnect Trigger

Starts the workflow when EmailConnect receives an email

Overview

This node acts as a trigger that starts an n8n workflow when specific email-related events occur in the EmailConnect service. It listens for incoming webhook notifications about emails being received, processed successfully, or failing to process. This is useful for automating workflows based on email activity, such as logging incoming emails, triggering alerts on failures, or processing emails further once they are confirmed as processed.

Practical examples include:

  • Automatically saving attachments from received emails to cloud storage.
  • Sending notifications when an email fails to process.
  • Starting a customer support workflow when a new email arrives.

Properties

Name Meaning
Events The email events to listen for. Options: "Email Received", "Email Processed", "Email Failed".
Domain Filter Name or ID Selects a domain to filter incoming emails for the webhook. If an alias filter is set, this is ignored. You can choose from a list or specify an ID via expression.
Alias Filter Name or ID Selects a specific email alias to filter incoming emails for the webhook. Takes priority over domain filter. Choose from a list or specify an ID via expression.

Output

The node outputs JSON data representing the email event payload received from EmailConnect. The structure includes:

  • id: Unique identifier of the email event.
  • domainId: Identifier of the domain related to the email.
  • receivedAt: Timestamp when the email was received.
  • sender: Email address of the sender.
  • recipient: Email address of the recipient.
  • subject: Subject line of the email.
  • status: Status of the email event (e.g., "email.received", "email.processed", "email.failed").
  • payload: Raw payload object containing detailed email data.
  • errorMessage: Error message if processing failed.
  • headers: Email headers extracted from the payload.
  • textContent: Plain text content of the email.
  • htmlContent: HTML content of the email.
  • attachments: Array of attachments included in the email.
  • envelope: Envelope information from the email payload.

No binary data output is indicated by the code.

Dependencies

  • Requires an API key credential for authenticating with the EmailConnect API.
  • Depends on the EmailConnect service's webhook infrastructure.
  • Uses internal API endpoints to manage webhooks, domains, and aliases.
  • Requires proper configuration of domain or alias filters to assign the webhook correctly.

Troubleshooting

  • Webhook verification failure: If the webhook verification token is not received within 10 seconds during setup, the node throws a "Webhook verification failed" error. Ensure the EmailConnect service is reachable and configured properly.
  • Missing domain or alias filter: When creating the webhook, if neither domain nor alias filter is specified, the node will throw an error indicating one must be set.
  • Invalid webhook payload: If the webhook receives a payload that is not an object, it throws an "Invalid webhook payload received" error.
  • Event filtering: If the incoming event status does not match any selected events, or if the domain/alias filters do not match the email recipient, the webhook response is suppressed (noWebhookResponse), meaning the workflow will not be triggered.
  • API request failures: Errors during API calls to EmailConnect (e.g., fetching domains, aliases, or managing webhooks) will result in node operation errors with descriptive messages.

Links and References

Discussion