Hey Team,
Im trying to download a attachment from an email and use the pdf to analyse it as a base64 string. unfortunattely after getting the pdf I can´t read it as a binary.
Here is my workflow
{
“nodes”: [
{
“parameters”: {
“pollTimes”: {
“item”: [
{
“mode”: “everyMinute”
}
]
},
“output”: “fields”,
“fields”: [
“body”,
“hasAttachments”,
“createdDateTime”,
“subject”
],
“filters”: {
“hasAttachments”: false,
“foldersToInclude”: [
“AQMkADRkYzY0MTM4LTgzOWQtNDdmNC05NTcyLTRmYzNmYTBlODc3AGEALgAAA8VACATxebhNgsJdCN11HF0BAIGDLUm2YwpHpQtAyafxE20AAAIBDAAAAA==”
]
},
“options”: {
“downloadAttachments”: false
}
},
“type”: “n8n-nodes-base.microsoftOutlookTrigger”,
“typeVersion”: 1,
“position”: [
-80,
-180
],
“id”: “e2d554b3-a15b-4866-a6a6-731c3a916b7a”,
“name”: “Microsoft Outlook Trigger”,
“credentials”: {
“microsoftOutlookOAuth2Api”: {
“id”: “Io6qzKUIWnvvFQ5C”,
“name”: “DTITestuser”
}
}
},
{
“parameters”: {
“resource”: “messageAttachment”,
“operation”: “getAll”,
“messageId”: {
“__rl”: true,
“value”: “={{ $json.id }}”,
“mode”: “id”
},
“returnAll”: true,
“options”: {}
},
“type”: “n8n-nodes-base.microsoftOutlook”,
“typeVersion”: 2,
“position”: [
160,
-180
],
“id”: “4ac01d68-bbc9-42e3-b7d4-3146e98a94d0”,
“name”: “Get all Email Attachments”,
“credentials”: {
“microsoftOutlookOAuth2Api”: {
“id”: “Io6qzKUIWnvvFQ5C”,
“name”: “DTITestuser”
}
}
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “ad8f6505-240d-48c7-a613-a55a5dd8609d”,
“name”: “fileContent”,
“value”: “={{ $("Download Attachment").item.binary.data.data }}”,
“type”: “string”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
820,
-180
],
“id”: “f0050dc1-b602-4932-8581-249e859c2301”,
“name”: “Edit Fields”
},
{
“parameters”: {
“resource”: “messageAttachment”,
“operation”: “download”,
“messageId”: {
“__rl”: true,
“value”: “={{ $(‘Microsoft Outlook Trigger’).item.json.id }}”,
“mode”: “id”
},
“attachmentId”: {
“__rl”: true,
“value”: “={{ $json.id }}”,
“mode”: “id”
}
},
“type”: “n8n-nodes-base.microsoftOutlook”,
“typeVersion”: 2,
“position”: [
360,
-180
],
“id”: “744e7279-b879-4ae5-9e79-82715fa543ab”,
“name”: “Download Attachment”,
“credentials”: {
“microsoftOutlookOAuth2Api”: {
“id”: “Io6qzKUIWnvvFQ5C”,
“name”: “DTITestuser”
}
}
},
{
“parameters”: {
“method”: “POST”,
“url”: “https://idp-dev.cognaio.com/extraction/api/token”,
“authentication”: “genericCredentialType”,
“genericAuthType”: “httpCustomAuth”,
“options”: {}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
600,
-180
],
“id”: “7bae14c8-99a0-4c1d-8f16-0bda6684e1c4”,
“name”: “GetAccessToken2”,
“credentials”: {
“httpCustomAuth”: {
“id”: “CrdzPcqu9guVZkWY”,
“name”: “Custom Auth GetToken”
}
}
},
{
“parameters”: {
“operation”: “toBinary”,
“sourceProperty”: “={{ $json.fileContent.data.b}}”,
“options”: {}
},
“type”: “n8n-nodes-base.convertToFile”,
“typeVersion”: 1.1,
“position”: [
1080,
-180
],
“id”: “e11040fc-b35d-408a-867f-ac2bbcc4ad15”,
“name”: “Convert to File1”
}
],
“connections”: {
“Microsoft Outlook Trigger”: {
“main”: [
[
{
“node”: “Get all Email Attachments”,
“type”: “main”,
“index”: 0
}
]
]
},
“Get all Email Attachments”: {
“main”: [
[
{
“node”: “Download Attachment”,
“type”: “main”,
“index”: 0
}
]
]
},
“Edit Fields”: {
“main”: [
[
{
“node”: “Convert to File1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Download Attachment”: {
“main”: [
[
{
“node”: “GetAccessToken2”,
“type”: “main”,
“index”: 0
}
]
]
},
“GetAccessToken2”: {
“main”: [
[
{
“node”: “Edit Fields”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “f441e9b010b4010be90de8d3b694d2e1d27438693a6b72d1f5989014a254e7af”
}
}
Thanks for any hint to use the pdf in the next node.
- n8n version:
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- **Running n8n via (Docker, npm, n8n cloud, desktop app):n8n cloud
- Operating system: windows 11
