Skip to content

Commit

Permalink
n8n-4124-overhaul-gmail-node-trigger (#3844)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-radency authored Aug 25, 2022
1 parent e953455 commit 6ecc0df
Show file tree
Hide file tree
Showing 4 changed files with 417 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/nodes-base/nodes/Google/Gmail/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
ICredentialDataDecryptedObject,
IDataObject,
INodeExecutionData,
IPollFunctions,
NodeApiError,
NodeOperationError,
} from 'n8n-workflow';
Expand Down Expand Up @@ -43,7 +44,7 @@ export interface IAttachments {
const mailComposer = require('nodemailer/lib/mail-composer');

export async function googleApiRequest(
this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions | IPollFunctions,
method: string,
endpoint: string,
body: IDataObject = {},
Expand Down Expand Up @@ -135,7 +136,7 @@ export async function googleApiRequest(
}

export async function parseRawEmail(
this: IExecuteFunctions,
this: IExecuteFunctions | IPollFunctions,
// tslint:disable-next-line:no-any
messageData: any,
dataPropertyNameDownload: string,
Expand Down Expand Up @@ -242,7 +243,7 @@ export async function encodeEmail(email: IEmail) {
}

export async function googleApiRequestAllItems(
this: IExecuteFunctions | ILoadOptionsFunctions,
this: IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions,
propertyName: string,
method: string,
endpoint: string,
Expand Down Expand Up @@ -274,7 +275,7 @@ export function extractEmail(s: string) {
}

function getAccessToken(
this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions | IPollFunctions,
credentials: ICredentialDataDecryptedObject,
): Promise<IDataObject> {
//https://developers.google.com/identity/protocols/oauth2/service-account#httprest
Expand Down Expand Up @@ -331,7 +332,7 @@ function getAccessToken(
}

export function prepareQuery(
this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions | IPollFunctions,
fields: IDataObject,
) {
const qs: IDataObject = { ...fields };
Expand Down
55 changes: 55 additions & 0 deletions packages/nodes-base/nodes/Google/Gmail/GmailTrigger.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"node": "n8n-nodes-base.gmailTrigger",
"nodeVersion": "1.0",
"codexVersion": "1.0",
"categories": ["Communication"],
"resources": {
"credentialDocumentation": [
{
"url": "https://docs.n8n.io/credentials/google"
}
],
"primaryDocumentation": [
{
"url": "https://docs.n8n.io/nodes/n8n-nodes-base.gmailTrigger/"
}
],
"generic": [
{
"label": "Why business process automation with n8n can change your daily life",
"icon": "🧬",
"url": "https://n8n.io/blog/why-business-process-automation-with-n8n-can-change-your-daily-life/"
},
{
"label": "Supercharging your conference registration process with n8n",
"icon": "🎫",
"url": "https://n8n.io/blog/supercharging-your-conference-registration-process-with-n8n/"
},
{
"label": "6 e-commerce workflows to power up your Shopify s",
"icon": "store",
"url": "https://n8n.io/blog/no-code-ecommerce-workflow-automations/"
},
{
"label": "How to get started with CRM automation (with 3 no-code workflow ideas",
"icon": "👥",
"url": "https://n8n.io/blog/how-to-get-started-with-crm-automation-and-no-code-workflow-ideas/"
},
{
"label": "15 Google apps you can combine and automate to increase productivity",
"icon": "💡",
"url": "https://n8n.io/blog/automate-google-apps-for-productivity/"
},
{
"label": "Hey founders! Your business doesn't need you to operate",
"icon": " 🖥️",
"url": "https://n8n.io/blog/your-business-doesnt-need-you-to-operate/"
},
{
"label": "Using Automation to Boost Productivity in the Workplace",
"icon": "💪",
"url": "https://n8n.io/blog/using-automation-to-boost-productivity-in-the-workplace/"
}
]
}
}
Loading

0 comments on commit 6ecc0df

Please sign in to comment.