{
  "name": "Course Certificate",
  "nodes": [
    {
      "parameters": {
        "formTitle": "New Course Submission",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Participant",
              "requiredField": true
            },
            {
              "fieldLabel": "E-Mail ",
              "fieldType": "email"
            },
            {
              "fieldLabel": "Course",
              "fieldType": "dropdown",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Theatrical and Movie Music Composition"
                  },
                  {
                    "option": "Marketing Automation for Beginners"
                  }
                ]
              }
            },
            {
              "fieldLabel": "Exam Topic",
              "fieldType": "dropdown",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Creating Beautiful Fantasy Movie Scores"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.5,
      "position": [
        -720,
        -528
      ],
      "id": "87b6db5c-3515-47fe-a228-f641aaeaa674",
      "name": "On form submission"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        -272,
        -528
      ],
      "id": "2dc3ca34-4b29-4f01-9e64-66b9ec8226ce",
      "name": "Setup completed"
    },
    {
      "parameters": {
        "content": "This is a test trigger, to add rows to the google sheets document and simulate new course participations entries. \n\nThis can be done via Google Forms, Webhook Automation, etc",
        "height": 96,
        "width": 544,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        -656
      ],
      "typeVersion": 1,
      "id": "d4cacf6d-77b5-4d15-9214-5533065a9611",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://app.stencilpdf.com/api/reports/report-1770067922645-k7c0zf7/generate-pdf",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "variables.participant",
              "value": "={{ $('Input').item.json.Participant }}"
            },
            {
              "name": "variables.date",
              "value": "={{ $('Input').item.json.Date }}"
            },
            {
              "name": "variables.topic",
              "value": "={{ $('Input').item.json.Exam }}"
            },
            {
              "name": "variables.course",
              "value": "={{ $('Input').item.json.Course }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        176,
        -64
      ],
      "id": "3343a90f-b31a-46f7-9712-9d9e68f09a00",
      "name": "Generate report",
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        },
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "name": "=Course_Certificate_{{ $json.Participant }}.pdf",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "folderId": {
          "__rl": true,
          "value": "1rAaDUp6mlGgERfjEiJjY7irrG8eXG2nd",
          "mode": "list",
          "cachedResultName": "Course Certificates",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1rAaDUp6mlGgERfjEiJjY7irrG8eXG2nd"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        400,
        16
      ],
      "id": "51fe6b7a-cedc-46c4-9473-843b56c3201e",
      "name": "Upload file",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "191MQ3HBJW5-WdhPgh1ZMDKl_FRVtcG5XT_4kOnlodq8",
          "mode": "list",
          "cachedResultName": "n8n demos",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/191MQ3HBJW5-WdhPgh1ZMDKl_FRVtcG5XT_4kOnlodq8/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Courses",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/191MQ3HBJW5-WdhPgh1ZMDKl_FRVtcG5XT_4kOnlodq8/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Participant": "={{ $('Input').item.json.Participant }}",
            "File": "={{ $json.webViewLink }}"
          },
          "matchingColumns": [
            "Participant"
          ],
          "schema": [
            {
              "id": "Mail",
              "displayName": "Mail",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Participant",
              "displayName": "Participant",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Course",
              "displayName": "Course",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Exam",
              "displayName": "Exam",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Date",
              "displayName": "Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "File",
              "displayName": "File",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Sent",
              "displayName": "Sent",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "readOnly": true,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        624,
        16
      ],
      "id": "6c67c9cd-4ac9-4ab7-bce0-695e7335ec02",
      "name": "Update row in sheet",
      "alwaysOutputData": true,
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "toRecipients": "={{ $('Input').item.json.Mail }}",
        "subject": "Your certificate is ready",
        "bodyContent": "=Hi {{$('Input').item.json.Participant}},\n\nCongratulations on completing the course {{$('Input').item.json.Course}}!\n\nYour certificate is attached. Thanks for learning with us.\n\nBest,\nYour learning company",
        "additionalFields": {
          "attachments": {
            "attachments": [
              {
                "binaryPropertyName": "data"
              }
            ]
          }
        }
      },
      "type": "n8n-nodes-base.microsoftOutlook",
      "typeVersion": 2,
      "position": [
        1296,
        -64
      ],
      "id": "7781839c-a6a3-4d1d-9915-d397b51b505c",
      "name": "Send a message",
      "credentials": {
        "microsoftOutlookOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "combine",
        "combineBy": "combineByPosition",
        "options": {}
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        848,
        -64
      ],
      "id": "aa0b5983-d019-40c0-a8fc-28d311b2749f",
      "name": "Merge"
    },
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyHour"
            }
          ]
        },
        "documentId": {
          "__rl": true,
          "value": "191MQ3HBJW5-WdhPgh1ZMDKl_FRVtcG5XT_4kOnlodq8",
          "mode": "list",
          "cachedResultName": "n8n demos",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/191MQ3HBJW5-WdhPgh1ZMDKl_FRVtcG5XT_4kOnlodq8/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Courses",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/191MQ3HBJW5-WdhPgh1ZMDKl_FRVtcG5XT_4kOnlodq8/edit#gid=0"
        },
        "event": "rowAdded",
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "typeVersion": 1,
      "position": [
        -720,
        32
      ],
      "id": "d3373c11-524b-4448-8936-2eb248a743c5",
      "name": "New participant",
      "credentials": {
        "googleSheetsTriggerOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "includeOtherFields": true,
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -272,
        -64
      ],
      "id": "d49e1bf3-59ed-4aef-9b2b-f31c71ca71a3",
      "name": "Input"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -720,
        -160
      ],
      "id": "fc021d18-71cf-41f2-8177-3b7b4f1931cc",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "6007d824-f7a6-4a0d-aa0a-abd8aa98b7a6",
              "name": "Mail",
              "value": "test@test.com",
              "type": "string"
            },
            {
              "id": "76bfbd95-8ff3-4d4f-8b6a-672403f91105",
              "name": "Participant",
              "value": "John Doe",
              "type": "string"
            },
            {
              "id": "45a33f1d-3413-42a0-846c-9c3003ac8c6b",
              "name": "Course",
              "value": "Fantasy Course",
              "type": "string"
            },
            {
              "id": "0bcd9027-5ca3-4418-8cda-9b1c5b49e8e6",
              "name": "Exam",
              "value": "Fantasy Exam",
              "type": "string"
            },
            {
              "id": "76ac3c3c-3ecc-4fd0-8c08-804bb942b84f",
              "name": "Date",
              "value": "={{$now.format('yyyy-MM-dd')}}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -496,
        -160
      ],
      "id": "665178b1-8847-40a5-9463-8f6325659b3f",
      "name": "Test Data"
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "191MQ3HBJW5-WdhPgh1ZMDKl_FRVtcG5XT_4kOnlodq8",
          "mode": "list",
          "cachedResultName": "n8n demos",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/191MQ3HBJW5-WdhPgh1ZMDKl_FRVtcG5XT_4kOnlodq8/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Courses",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/191MQ3HBJW5-WdhPgh1ZMDKl_FRVtcG5XT_4kOnlodq8/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Sent": "={{ $now }}",
            "Participant": "={{ $('Input').item.json.Participant }}"
          },
          "matchingColumns": [
            "Participant"
          ],
          "schema": [
            {
              "id": "Mail",
              "displayName": "Mail",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Participant",
              "displayName": "Participant",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Course",
              "displayName": "Course",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Exam",
              "displayName": "Exam",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Date",
              "displayName": "Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "File",
              "displayName": "File",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Sent",
              "displayName": "Sent",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "readOnly": true,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        1520,
        -64
      ],
      "id": "8a52bef6-6279-48f9-b71c-1cce0f63a455",
      "name": "Update row in sheet1",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "content": "The manual trigger allows for test executions.",
        "height": 80,
        "width": 160
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        -272
      ],
      "typeVersion": 1,
      "id": "4883c4ff-a5f7-446d-9fae-9a1e8bf1dc5e",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "content": "Use an empty Set node to allow for multiple sources when referencing input data.",
        "height": 96,
        "width": 262
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        -208
      ],
      "typeVersion": 1,
      "id": "cd555e0e-5fe0-45de-b7f2-170fa71d5d1d",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "content": "The certificate report is created and store to google drive. It is also linked to the participant",
        "height": 96,
        "width": 326
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        -208
      ],
      "typeVersion": 1,
      "id": "5d965834-0629-4550-a2d2-bd98f5122117",
      "name": "Sticky Note3"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        -48,
        -64
      ],
      "id": "840336e5-0794-425b-ad51-3226dbe3cac5",
      "name": "Generate and save report"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1072,
        -64
      ],
      "id": "a0908fbf-6d2f-4b6b-a3c9-082accc0583f",
      "name": "Send to participant"
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "191MQ3HBJW5-WdhPgh1ZMDKl_FRVtcG5XT_4kOnlodq8",
          "mode": "list",
          "cachedResultName": "n8n demos",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/191MQ3HBJW5-WdhPgh1ZMDKl_FRVtcG5XT_4kOnlodq8/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Courses",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/191MQ3HBJW5-WdhPgh1ZMDKl_FRVtcG5XT_4kOnlodq8/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Participant": "={{ $json.Participant }}",
            "Course": "={{ $json.Course }}",
            "Exam": "={{ $json['Exam Topic'] }}",
            "Date": "={{ $now.format('yyyy-MM-dd') }}",
            "Mail": "={{$json['E-Mail ']}}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "Mail",
              "displayName": "Mail",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Participant",
              "displayName": "Participant",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Course",
              "displayName": "Course",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Exam",
              "displayName": "Exam",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Date",
              "displayName": "Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "File",
              "displayName": "File",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Sent",
              "displayName": "Sent",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        -496,
        -528
      ],
      "id": "f8843e77-b0ba-4252-a843-3621ccd93848",
      "name": "Append row in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "e53d2ed5-8f38-4aa0-a87b-ef101afb946e",
              "leftValue": "={{ $json.Sent }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.3,
      "position": [
        -496,
        32
      ],
      "id": "b75e7c32-253f-4a56-b7c9-4b9be56af6aa",
      "name": "E-Mail not sent"
    },
    {
      "parameters": {
        "content": "The certificate is sent to the participant. The Sent field is updated so certificates are not sent twice",
        "height": 112,
        "width": 278
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1520,
        -208
      ],
      "typeVersion": 1,
      "id": "0a33093b-bf3d-4cc5-9962-3c9701a75811",
      "name": "Sticky Note5"
    }
  ],
  "connections": {
    "On form submission": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate report": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          },
          {
            "node": "Upload file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload file": {
      "main": [
        [
          {
            "node": "Update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row in sheet": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Send a message": {
      "main": [
        [
          {
            "node": "Update row in sheet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Send to participant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New participant": {
      "main": [
        [
          {
            "node": "E-Mail not sent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Input": {
      "main": [
        [
          {
            "node": "Generate and save report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Test Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Test Data": {
      "main": [
        [
          {
            "node": "Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate and save report": {
      "main": [
        [
          {
            "node": "Generate report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send to participant": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "Setup completed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "E-Mail not sent": {
      "main": [
        [
          {
            "node": "Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "availableInMCP": false
  },
  "versionId": "74e05345-637c-4ef7-85c8-aa5ebb12efcb",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "5Viam0BvDlFeWyTF2LEbV",
  "tags": []
}