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.
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
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.