n8n-nodes-base
Version:
Base nodes of n8n
126 lines (120 loc) • 5.29 kB
text/typescript
/**
* Gmail Trigger Node - Version 1.3
* Fetches emails from Gmail and starts the workflow on specified polling intervals.
*/
export interface GmailTriggerV13Params {
/**
* 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<string>;
/** The hour of the day to trigger (24h format)
* @displayOptions.hide { mode: ["custom", "everyHour", "everyMinute", "everyX"] }
* @default 14
*/
hour?: number | Expression<number>;
/** The minute of the day to trigger
* @displayOptions.hide { mode: ["custom", "everyMinute", "everyX"] }
* @default 0
*/
minute?: number | Expression<number>;
/** The day of the month to trigger
* @displayOptions.show { mode: ["everyMonth"] }
* @default 1
*/
dayOfMonth?: number | Expression<number>;
/** The weekday to trigger
* @displayOptions.show { mode: ["everyWeek"] }
* @default 1
*/
weekday?: '1' | '2' | '3' | '4' | '5' | '6' | '0' | Expression<string>;
/** 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<string> | PlaceholderValue;
/** All how many X minutes/hours it should trigger
* @displayOptions.show { mode: ["everyX"] }
* @default 2
*/
value?: number | Expression<number>;
/** If it should trigger all X minutes or hours
* @displayOptions.show { mode: ["everyX"] }
* @default hours
*/
unit?: 'minutes' | 'hours' | Expression<string>;
}>;
};
authentication?: 'oAuth2' | 'serviceAccount' | Expression<string>;
event?: 'messageReceived' | Expression<string>;
/**
* 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<boolean>;
filters?: {
/** Whether to include messages from SPAM and TRASH in the results
* @default false
*/
includeSpamTrash?: boolean | Expression<boolean>;
/** Whether to include email drafts in the results
* @default false
*/
includeDrafts?: boolean | Expression<boolean>;
/** 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<string> | PlaceholderValue;
/** Read Status
* @hint Filter emails by whether they have been read or not
* @default unread
*/
readStatus?: 'both' | 'unread' | 'read' | Expression<string>;
/** Sender name or email to filter by
* @hint Enter an email or part of a sender name
*/
sender?: string | Expression<string> | 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<string> | PlaceholderValue;
/** Whether the email's attachments will be downloaded
* @default false
*/
downloadAttachments?: boolean | Expression<boolean>;
};
}
export interface GmailTriggerV13Credentials {
googleApi: CredentialReference;
gmailOAuth2: CredentialReference;
}
interface GmailTriggerV13NodeBase {
type: 'n8n-nodes-base.gmailTrigger';
version: 1.3;
credentials?: GmailTriggerV13Credentials;
isTrigger: true;
}
export type GmailTriggerV13ParamsNode = GmailTriggerV13NodeBase & {
config: NodeConfig<GmailTriggerV13Params>;
};
export type GmailTriggerV13Node = GmailTriggerV13ParamsNode;