{
  "name": "S2D recipe - google-forms-certificate-pdf",
  "nodes": [
    {
      "id": "a1000000-0000-4000-8000-000000000001",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -320,
        -340
      ],
      "parameters": {
        "width": 560,
        "height": 300,
        "content": "## Google Forms to certificate PDF\nEach new row in the form's response sheet becomes one SourceToDocs run: a certificate from your Google Slides template, saved to Google Drive as a deck and a PDF. Gmail then sends the PDF link to the respondent.\n\n**Set up before you activate**\n- SourceToDocs credential (API token) on the SourceToDocs node\n- Document: your certificate document, and its data set with the columns Name, Course, Date\n- Your sheet: the form's response spreadsheet and tab in the Google Sheets Trigger (columns Full name, Course, Email)\n- Gmail credential\n\nGuide: https://sourcetodocs.com/automations/google-forms-certificate-pdf/"
      }
    },
    {
      "id": "a1000000-0000-4000-8000-000000000002",
      "name": "Google Sheets Trigger",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "typeVersion": 1,
      "position": [
        -260,
        0
      ],
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "event": "rowAdded",
        "options": {}
      }
    },
    {
      "id": "a1000000-0000-4000-8000-000000000003",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        -40,
        0
      ],
      "parameters": {
        "batchSize": 1,
        "options": {}
      }
    },
    {
      "id": "a1000000-0000-4000-8000-000000000004",
      "name": "SourceToDocs",
      "type": "@twovmodules/n8n-nodes-sourcetodocs.sourceToDocs",
      "typeVersion": 1.1,
      "position": [
        200,
        20
      ],
      "parameters": {
        "resource": "document",
        "operation": "generate",
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "rowsFrom": "mapped",
        "mappedDataSetId": "",
        "output": "simplified",
        "options": {},
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Name": "={{ $json['Full name'] }}",
            "Course": "={{ $json['Course'] }}",
            "Date": "={{ $now.toFormat('d LLLL yyyy') }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "Name",
              "displayName": "Name",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": false,
              "display": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "Course",
              "displayName": "Course",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": false,
              "display": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "Date",
              "displayName": "Date",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": false,
              "display": true,
              "type": "string",
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      }
    },
    {
      "id": "a1000000-0000-4000-8000-000000000005",
      "name": "Gmail",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        440,
        20
      ],
      "parameters": {
        "resource": "message",
        "operation": "send",
        "sendTo": "={{ $('Loop Over Items').item.json['Email'] }}",
        "subject": "=Your certificate for {{ $('Loop Over Items').item.json['Course'] }}",
        "emailType": "html",
        "message": "=Your certificate is ready: {{ $json.deliveries[0].result.pdf_url }}",
        "options": {}
      }
    }
  ],
  "connections": {
    "Google Sheets Trigger": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "SourceToDocs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SourceToDocs": {
      "main": [
        [
          {
            "node": "Gmail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}
