Edit pdf and send via gmail

For start, I’m no developer so I reserve for wrong nomenclature🤣

Describe the problem/error/question

I have dynamic content in JSON format coming from an ai agent that I want to insert to a PDF temple and send away via gmail.

I have a template saved in google drive as PDF. I’m thinking about downloading the template via google drive node and then edit with the JSON dynamic content, how can I do this?

workflow

</>
{
“nodes”: [
{
“parameters”: {},
“type”: “n8n-nodes-base.executeWorkflowTrigger”,
“typeVersion”: 1,
“position”: [
-580,
-80
],
“id”: “8d8a731f-a1c4-4cc4-90dc-fc7221e70c0b”,
“name”: “Execute Workflow Trigger”
},
{
“parameters”: {
“modelId”: {
“__rl”: true,
“value”: “gpt-4o”,
“mode”: “list”,
“cachedResultName”: “GPT-4O”
},
“messages”: {
“values”: [
{
“content”: “=Parse the information you receive from the input data and always output your answers in this format\n\n-Företag\n-Namn\n-Email \n\nHere is the inout data: {{ $json.query }}”
}
]
},
“jsonOutput”: true,
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.openAi”,
“typeVersion”: 1.8,
“position”: [
-320,
-80
],
“id”: “e4faf40d-f7e6-4fa1-85a9-7d979c142832”,
“name”: “OpenAI”,
“credentials”: {
“openAiApi”: {
“id”: “JhN7jMl8GaAijFCR”,
“name”: “OpenAi account”
}
}
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “9d583d2c-69b0-4d76-a093-0fa53bbb7915”,
“name”: “företag”,
“value”: “={{ $json.message.content[‘Företag’] }}”,
“type”: “string”
},
{
“id”: “e90c6240-997c-44f6-9035-68867435b30e”,
“name”: “namn”,
“value”: “={{ $json.message.content.Namn }}”,
“type”: “string”
},
{
“id”: “ecea91c4-47e3-4f1e-a285-522ec3135f4e”,
“name”: “email”,
“value”: “={{ $json.message.content.Email }}”,
“type”: “string”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
40,
-80
],
“id”: “9daea739-5bac-4bf4-a7a2-0e36233664c1”,
“name”: “Edit Fields”
},
{
“parameters”: {
“sendTo”: “={{ $json.email }}”,
“subject”: “={{ $json.namn }}”,
“emailType”: “text”,
“message”: “={{ $json[‘företag’] }}\n{{ $json.namn }}\n{{ $json.email }}”,
“options”: {}
},
“type”: “n8n-nodes-base.gmail”,
“typeVersion”: 2.1,
“position”: [
380,
-80
],
“id”: “a475095e-185b-4dbf-a946-bedaa510684f”,
“name”: “Gmail”,
“webhookId”: “e5856023-9820-4421-9641-d2dd4576e236”,
“credentials”: {
“gmailOAuth2”: {
“id”: “zYrVPytrdugRH46o”,
“name”: “Gmail account”
}
}
},
{
“parameters”: {
“operation”: “download”,
“fileId”: {
“__rl”: true,
“value”: “1EzcHPjtzz49vQMfKYQb6iVQt_zZ7qQ9E”,
“mode”: “list”,
“cachedResultName”: “Offertmall1 .pdf”,
“cachedResultUrl”: “https://drive.google.com/file/d/1EzcHPjtzz49vQMfKYQb6iVQt_zZ7qQ9E/view?usp=drivesdk
},
“options”: {}
},
“type”: “n8n-nodes-base.googleDrive”,
“typeVersion”: 3,
“position”: [
40,
-300
],
“id”: “4445503e-a892-451d-8c66-7199de4bbd5b”,
“name”: “Google Drive”,
“credentials”: {
“googleDriveOAuth2Api”: {
“id”: “5cjqDiBskB7ZviBo”,
“name”: “Google Drive account”
}
}
}
],
“connections”: {
“Execute Workflow Trigger”: {
“main”: [
[
{
“node”: “OpenAI”,
“type”: “main”,
“index”: 0
}
]
]
},
“OpenAI”: {
“main”: [
[
{
“node”: “Edit Fields”,
“type”: “main”,
“index”: 0
}
]
]
},
“Edit Fields”: {
“main”: [

]
},
“Google Drive”: {
“main”: [

]
}
},
“pinData”: {
“Execute Workflow Trigger”: [
{
“query”: “Företag: Jonas Snickeri AB, Namn: Jonas, Email: [email protected]
}
],
“OpenAI”: [
{
“index”: 0,
“message”: {
“role”: “assistant”,
“content”: {
“Företag”: “Jonas Snickeri AB”,
“Namn”: “Jonas”,
“Email”: “[email protected]
},
“refusal”: null
},
“logprobs”: null,
“finish_reason”: “stop”
}
],
“Edit Fields”: [
{
“företag”: “Jonas Snickeri AB”,
“namn”: “Jonas”,
“email”: “[email protected]
}
]
},
“meta”: {
“instanceId”: “959304e8b7a802ab0100d7a5a137cef0bd903d68c342c33a00c78f40a2f232b1”
}
}

Information on n8n setup

  • n8n version: 1.74.1
  • Database (default: SQLite)
  • n8n EXECUTIONS_PROCESS setting default: own
  • Running n8n via Docker
  • Operating system: windows 10

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.