GMAIL Workflow + Webhooks


I have just discovered N8N and this is awesome. I am wondering if this is possible because I see that now it has more workflows like Gmail.

1 - read email GMAIL labelled “ABC”.
2 - extract fields like, from, to, cc, subject, body (plaintext).
3 - crop to 2000 characters from the body field.
4 - visit a URL sending some fields into variables by POST or GET.
5 - mark this email like “done” so it can’t be processed again.

Is this possible? Thank you!

Welcome to the community @Rl0_Tbz!

Yes, just checked. It looks like all functionality that you would require got already implemented. So it should not be a problem.


I am new to n8n and found this tool super cool.
Recently I had a requirement to read gmail data based on labels created by auto filter in gmail. I have successfully connected it and works good.
Now I am bit confused how do I parse the body and the subject line as I could not find a direct documentation for this. Should I use function code or binary to json node.
Did you manage to find a solution to read from, subject and body ?
Any screenshot is very much appreciated


Welcome to the community @Sijohn_Mathew! Great to hear that you enjoy n8n!

Sorry, do not understand what you mean. What do you want to parse from “from/subject/body”? The data should already be there as a string to use.

Hi Jan,

Thanks for the quick reply.
May be this question is a very basic question and I may be missing some fundamentals.
My Question was that, is there a direct way to extract the values of Email Subject line and Message Body data, in the same Gmail Node.
Currently I have created a Function Node as a next node after the Gmail Node and used the Javascript (Eg: items[0].json.snippet) to extract the snippet part from the First Item.
So as a best practice, is this the correct approach and also when it comes to accessing the Subject line and other data in the “payload–>headers–>name=“subject”–>value”. Do you have any code samples in Git to access the complex JSON Structure ?


Really depends on what exactly you want to do with the data. If you for example want to write it into a Google Sheet and so just want to have it on the “main-level” for that, the easiest would be to create a Set-Node. That one you would set to “Keep Only Set” and then create the properties you have in that Sheet. The values of that properties you can then simply set via an Expression and select them via the Expression-Editor.

How can I find out the ID of a label without coding? Is there a way to lookup an ID?

I figured this out. You can do this by adding a Return All Labels node.

1 Like

Welcome to the community @Josh_Fialkoff!

Great to hear that you found it yourself. Have fun!

1 Like

Thanks @jan. This is a great service! I’ve been looking for this for some time.


Thanks! Always great to hear if people enjoy using n8n!