/** * Gmail Trigger Node - Version 1 * Fetches emails from Gmail and starts the workflow on specified polling intervals. */ export interface GmailTriggerV1Params { /** * Time at which polling should occur * @default {"item":[{"mode":"everyMinute"}]} */ pollTimes?: { /** Item */ item?: Array<{ /** How often to trigger. * @default everyDay */ mode?: 'everyMinute' | 'everyHour' | 'everyDay' | 'everyWeek' | 'everyMonth' | 'everyX' | 'custom' | Expression; /** The hour of the day to trigger (24h format) * @displayOptions.hide { mode: ["custom", "everyHour", "everyMinute", "everyX"] } * @default 14 */ hour?: number | Expression; /** The minute of the day to trigger * @displayOptions.hide { mode: ["custom", "everyMinute", "everyX"] } * @default 0 */ minute?: number | Expression; /** The day of the month to trigger * @displayOptions.show { mode: ["everyMonth"] } * @default 1 */ dayOfMonth?: number | Expression; /** The weekday to trigger * @displayOptions.show { mode: ["everyWeek"] } * @default 1 */ weekday?: '1' | '2' | '3' | '4' | '5' | '6' | '0' | Expression; /** Use custom cron expression. Values and ranges as follows:<ul><li>Seconds: 0-59</li><li>Minutes: 0 - 59</li><li>Hours: 0 - 23</li><li>Day of Month: 1 - 31</li><li>Months: 0 - 11 (Jan - Dec)</li><li>Day of Week: 0 - 6 (Sun - Sat)</li></ul> * @displayOptions.show { mode: ["custom"] } * @default * * * * * * */ cronExpression?: string | Expression | PlaceholderValue; /** All how many X minutes/hours it should trigger * @displayOptions.show { mode: ["everyX"] } * @default 2 */ value?: number | Expression; /** If it should trigger all X minutes or hours * @displayOptions.show { mode: ["everyX"] } * @default hours */ unit?: 'minutes' | 'hours' | Expression; }>; }; authentication?: 'oAuth2' | 'serviceAccount' | Expression; event?: 'messageReceived' | Expression; /** * Whether to return a simplified version of the response instead of the raw data * @builderHint Set to false when the email body is needed for AI analysis, summarization, or content processing. When true, only returns snippet (preview text). When false, returns full email with {id, threadId, labelIds, headers, html, text, textAsHtml, subject, date, to, from, messageId, replyTo}. * @default true */ simple?: boolean | Expression; filters?: { /** Whether to include messages from SPAM and TRASH in the results * @default false */ includeSpamTrash?: boolean | Expression; /** Whether to include email drafts in the results * @default false */ includeDrafts?: boolean | Expression; /** Only return messages with labels that match all of the specified label IDs. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>. * @default [] */ labelIds?: string[]; /** Only return messages matching the specified query * @hint Use the same format as in the Gmail search box. <a href="https://support.google.com/mail/answer/7190?hl=en">More info</a>. * @builderHint Always set a search query to filter emails. Uses Gmail search syntax, e.g. "from:example@gmail.com", "subject:invoice", "has:attachment", "label:important", "newer_than:1d". Combine with spaces for AND: "from:shop@example.com subject:delivery". Without this filter, ALL incoming emails will trigger the workflow. */ q?: string | Expression | PlaceholderValue; /** Read Status * @hint Filter emails by whether they have been read or not * @default unread */ readStatus?: 'both' | 'unread' | 'read' | Expression; /** Sender name or email to filter by * @hint Enter an email or part of a sender name */ sender?: string | Expression | PlaceholderValue; }; /** * Options * @displayOptions.hide { simple: [true] } * @default {} */ options?: { /** Prefix for name of the binary property to which to write the attachment. An index starting with 0 will be added. So if name is 'attachment_' the first attachment is saved to 'attachment_0'. * @default attachment_ */ dataPropertyAttachmentsPrefixName?: string | Expression | PlaceholderValue; /** Whether the email's attachments will be downloaded * @default false */ downloadAttachments?: boolean | Expression; }; } export interface GmailTriggerV1Credentials { googleApi: CredentialReference; gmailOAuth2: CredentialReference; } interface GmailTriggerV1NodeBase { type: 'n8n-nodes-base.gmailTrigger'; version: 1; credentials?: GmailTriggerV1Credentials; isTrigger: true; } export type GmailTriggerV1ParamsNode = GmailTriggerV1NodeBase & { config: NodeConfig; }; export type GmailTriggerV1Node = GmailTriggerV1ParamsNode;