Hi,
Objectif : catch gmails with label " correction". texte to a file.txt and attachment to Gdrive. Focusing on the gmail attachment to … somewhere.
Once in a while (manuel for now)
node Gmail :
get all ( limit 2 for now) Gmail with label “correction”
A- full → payload json/table
B- Raw → huge 4.8M, and very raw
C- Resolved → Nice ! Can be viewed or dl !
Sems ok.
But next node ( tried GDrive then simplified to only Write Binary File) says
A-if all the node “raw” :
{{$node[“Gmail”].binary.attachment_0}}
ERROR: The binary property “[object Object]” does not exist. So no file can be written!
B-only filename :
ERROR: The binary property “IMG_20220906_185019.jpg” does not exist. So no file can be written!
I tried with full
A-{{$node[“Gmail”].json[“payload”][“parts”][0][“body”][“data”]}}
B-{{$node[“Gmail”].json[“payload”][“parts”][1][“body”][“attachmentId”]}}
…
ERROR: No binary data set. So file can not be written!
and with raw
{{$node[“Gmail”].json[“raw”]}} which neither n8n nor me did like apparently.
a ghinary ? ghost binary file ?
need another node?
I feel like there is a lot missing here but as a test can you add the google drive node after the gmail node and for the binary property just put in attachment_0 and see if that works.
Hi Jon,
Please define " feel’ and “lot”… if you mean the script is missing some nodes, yes, it is, as writen.
As past tests, it’s not working with the gmail ( hence the just plain idiot “write binary file”) but, being a ggod boy, I tried again ( actually, copied 3 times Gmail-raw, Gmail-resolved, gmail-full and binded each to a different gdrive node.in order to understand firstly where owuld be “attachment_0”. seems to be gmail-resolved.
1- If I run one of the three, the others will “unscript” even if 3 separate entities.
2- if you were meaning gmail resolved, as it seems after testing,( but I ran the others as well with the same success) it is a " ERROR: No binary data property “[object Object]” does not exists on item!"
{
“nodes”: [
{
“parameters”: {
“authentication”: “oAuth2”,
“binaryData”: true,
“binaryPropertyName”: “={{$node["Gmail-resolved"].binary.attachment_0}}”,
“name”: “=sd”,
“resolveData”: true,
“options”: {}
},
“name”: “Google Drive”,
“type”: “n8n-nodes-base.googleDrive”,
“typeVersion”: 1,
“position”: [
100,
420
],
“credentials”: {
“googleDriveOAuth2Api”: {
“id”: “11”,
“name”: “Google Drive account”
}
}
}
],
“connections”: {}
}
as for the version, it is 0.182.0
btw, I have my previous script ( from older version) which are still visible in the open panel, but can’t be accessed…
Can you try the workflow below, I have given it a test here and it works. When it comes to using binary data to upload sometimes using an expression doesn’t work so you have to just type in the incoming property name which in this case is attachment_0.
HO, that works !! Thanks.
and thanks for the explanation, wasn’t logic to me ( exception in grammar, as a french, should be used to it)
I’ll write it down on my own n8nDoc.
My first thought is maybe there are multiple emails and some of them don’t have any attachments. I would double check that there is binary data in all of the messages.
It looks like this is not an option that is included with the v1 node so assuming you are on a recent version of n8n you can add the GMail node again and as long as you are not using the simplify option you will be able to get the attachments.
We didn’t add it to the v1 node as any user that adds the node to a workflow will only be able to get v2, Because of this I am not sure there is a need to add it to the v1 node as well so I think we can close the PR unless there is anything else I missed.
@Jon you are right… I was using 0.214.0 on Saturday, but I copied the above example(), which was using GmailV1. Also, the workflow on which I was learning from public templates - was also V1.
So this is an idea request: can you improve the UI of the nodes, adding information that the Gmail node is deprecated if someone is using V1? Until I checked the code, I didn’t know there were V1 and V2…