n8n-io / n8n

Free and source-available fair-code licensed workflow automation tool. Easily automate tasks across different services.
https://n8n.io
Other
47.89k stars 7.33k forks source link

Gmail node triggering for new created draft messages #11469

Closed Imperol3 closed 1 hour ago

Imperol3 commented 1 hour ago

Bug Description

TI have an email summariser workflow that listens for new emails in my inbox.It is instead triggering for new draft emails and running the wotkflows as if it were a new received email image

To Reproduce

Set this workflow up tp repeoduce `

{ "meta": { "instanceId": "f27863db183395c9db70556df4a1e27194b8f231febaea2616d676cf6c2a071c" }, "nodes": [ { "parameters": { "pollTimes": { "item": [ { "mode": "everyMinute" } ] }, "simple": false, "filters": {}, "options": {} }, "id": "2439a867-6da6-4748-bc61-642c8350fb61", "name": "Gmail Trigger", "type": "n8n-nodes-base.gmailTrigger", "typeVersion": 1.1, "position": [ 420, 300 ], "credentials": { "gmailOAuth2": { "id": "iklb3Z6rdooBGiAK", "name": "Gmail account" } } }, { "parameters": { "assignments": { "assignments": [ { "id": "39055a5c-5b65-49c1-978c-2e89d71b3627", "name": "textAsHtml", "value": "={{ $json.textAsHtml }}", "type": "string" }, { "id": "21416b75-834f-4d50-99dd-bb8181537957", "name": "subject", "value": "={{ $json.subject }}", "type": "string" }, { "id": "b2085eed-2b6c-49a1-a291-b7e3f912237e", "name": "from", "value": "={{ $json.headers.from }}", "type": "string" }, { "id": "e88cf71d-7219-44d8-8fb8-852a73ccf0df", "name": "to", "value": "={{ $json.headers.to }}", "type": "string" }, { "id": "1e5d5062-8ace-4bfa-9aa5-bfd3f7ddce47", "name": "link", "value": "=https://mail.google.com/mail/#all/{{ $json.threadId }}\n\n", "type": "string" } ] }, "options": {} }, "id": "781d5bb3-82c5-4f09-8d0e-b98272ea19eb", "name": "Edit Fields", "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ 620, 440 ] }, { "parameters": { "select": "channel", "channelId": { "__rl": true, "value": "C07L4PAQJH2", "mode": "list", "cachedResultName": "email-summaries" }, "text": "={{ $json.text }}", "otherOptions": { "includeLinkToWorkflow": false } }, "id": "afc17bd7-4951-425d-a6da-4aaef992d057", "name": "Slack", "type": "n8n-nodes-base.slack", "typeVersion": 2.2, "position": [ 1160, 440 ], "webhookId": "c5d470c0-4987-410e-b4c9-c75bb8d1551e", "credentials": { "slackApi": { "id": "dXwvtb0Hu4FM6mLW", "name": "BOT" } } }, { "parameters": { "promptType": "define", "text": "=You are an expert Virtual Assistant specializing in providing concise yet comprehensive ONE SENTENSE summaries of incoming emails. Your task is to take each email and summarize it into a short, clear, and fully understandable format. The summary should be concise but informative, highlighting the main points without including unnecessary details.\n\nThese summaries will be sent to a Slack channel, so they should be brief and easy to grasp.\n\nThe email content is: {{ $json.textAsHtml }}\nThe sender is: {{ $json.from }}\nThe recipient is: Me\nEmail link : {{ $json.link }}\n\nSummarize the email with key details, and include a link to the original email in the format:\n\"Open email: Link\"\n\nDont start with summary or other intoructory text, but rather just provide the summarized content\n\nYou should reported a reported third person approach. \nDo not include the details of the emails\nThe response MUST be a one liner summary\nThe output should be plain text with no extra formating styles etc\n\nExample \n\nAllEvents invites you to register for a free 2-hour seminar on December 11, 2024, hosted by NAMI Mid-Hudson, Inc., focusing on supporting loved ones with mental health conditions.\nOpen email :https://mail.google.com/mail/#all/1924aef57333aa2f" }, "id": "16cc2b05-ea52-499e-91dd-c0a3bbeccd3d", "name": "Basic LLM Chain", "type": "@n8n/n8n-nodes-langchain.chainLlm", "typeVersion": 1.4, "position": [ 820, 440 ] }, { "parameters": { "options": {} }, "id": "a4c766f2-ff29-4788-8537-1ff109263dcd", "name": "Google Gemini Chat Model", "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini", "typeVersion": 1, "position": [ 720, 700 ], "credentials": { "googlePalmApi": { "id": "pwRAetOSb38E5EfX", "name": "Google Gemini(PaLM) Api account" } } }, { "parameters": { "content": "## Email summarizer\n\nThis workflow summarizes email copies sent to your inbox into short one liners that you can easily digest", "height": 98, "width": 740 }, "id": "7c992ae9-0ba8-4c89-99f6-520cb5c59261", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ 620, 320 ] }, { "parameters": { "pollTimes": { "item": [ { "mode": "everyMinute" } ] }, "simple": false, "filters": {}, "options": {} }, "id": "6a3a5b5b-79d3-4dd2-92a0-f0aa339483f7", "name": "Gmail Trigger1", "type": "n8n-nodes-base.gmailTrigger", "typeVersion": 1.1, "position": [ 400, 520 ], "credentials": { "gmailOAuth2": { "id": "3uJDOdklRoEPWCUI", "name": "phoenix" } } } ], "connections": { "Gmail Trigger": { "main": [ [ { "node": "Edit Fields", "type": "main", "index": 0 } ] ] }, "Edit Fields": { "main": [ [ { "node": "Basic LLM Chain", "type": "main", "index": 0 } ] ] }, "Basic LLM Chain": { "main": [ [ { "node": "Slack", "type": "main", "index": 0 } ] ] }, "Google Gemini Chat Model": { "ai_languageModel": [ [ { "node": "Basic LLM Chain", "type": "ai_languageModel", "index": 0 } ] ] }, "Gmail Trigger1": { "main": [ [ { "node": "Edit Fields", "type": "main", "index": 0 } ] ] } }, "pinData": {} }

`

Expected behavior

On creating a new draft, the workflow will run

Operating System

linux ubuntu server

n8n Version

1.64.3

Node.js Version

18

Database

PostgreSQL

Execution mode

main (default)

Joffcom commented 1 hour ago

Hey @Imperol3,

We have created an internal ticket to look into this which we will be tracking as "GHC-360"

Joffcom commented 1 hour ago

Hey @Imperol3,

This is currently intentional but the good news is a PR for adding a new feature around this was opened yesterday which can be found here: https://github.com/n8n-io/n8n/pull/11441

As this was by design and an option to disable this will be added in a future release I am going to mark this as closed, Let me know if you have any questions on this.

Imperol3 commented 1 hour ago

I agree it was intentional, but its getting wrong stuff done

Imagine login in 10 drafts and all are logged in as new mailboxes and next steps dine?

It would be better to disable This in production n8n versions. Its bringing chaos to an otherwise straight forward functionality

Trigger on new email received, for thd drafg have that under draft trigger

Kind regards Zacharia

On Wed, 30 Oct 2024, 11:52 Jon, @.***> wrote:

Hey @Imperol3 https://github.com/Imperol3,

This is currently intentional but the good news is a PR for adding a new feature around this was opened yesterday which can be found here: #11441 https://github.com/n8n-io/n8n/pull/11441

As this was by design and an option to disable this will be added in a future release I am going to mark this as closed, Let me know if you have any questions on this.

— Reply to this email directly, view it on GitHub https://github.com/n8n-io/n8n/issues/11469#issuecomment-2446220458, or unsubscribe https://github.com/notifications/unsubscribe-auth/A727ZCD42V4JB4JMF3QDWVTZ6CM47AVCNFSM6AAAAABQ3Q3K3OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBWGIZDANBVHA . You are receiving this because you were mentioned.Message ID: @.***>

Joffcom commented 1 hour ago

Hey @Imperol3,

The PR adds the option to disable the functionality for existing users and for new users / workflows it will be disabled by default this allows any users who do want to use it for drafts to continue doing that.

Imperol3 commented 1 hour ago

Ok, thanks for the clarification Jon

On Wed, 30 Oct 2024, 12:08 Jon, @.***> wrote:

Hey @Imperol3 https://github.com/Imperol3,

The PR adds the option to disable the functionality for existing users and for new users / workflows it will be disabled by default this allows any users who do want to use it for drafts to continue doing that.

— Reply to this email directly, view it on GitHub https://github.com/n8n-io/n8n/issues/11469#issuecomment-2446260488, or unsubscribe https://github.com/notifications/unsubscribe-auth/A727ZCGIVT6MWU2D7Y2KG43Z6COZFAVCNFSM6AAAAABQ3Q3K3OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBWGI3DANBYHA . You are receiving this because you were mentioned.Message ID: @.***>