{
  "name": "Lesson 12 Email and PDF (homework)",
  "nodes": [
    {
      "parameters": {
        "content": "### Если писем слишком много\nТогда PDF-файлы могут много весить и имеет смысл разбить на батчи по 10-50 элементов",
        "height": 123.09884432358935,
        "width": 431.1124405166554
      },
      "id": "1219a2bb-5265-4202-97b6-39e885589fb0",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        300,
        1180
      ]
    },
    {
      "parameters": {
        "resource": "databasePage",
        "operation": "getAll",
        "databaseId": {
          "__rl": true,
          "value": "cc045ddb-d05a-44fd-8880-5682d58dad90",
          "mode": "list",
          "cachedResultName": "(рус) База клиентов для шаблона Google Docs (n8n для бизнеса, рус)",
          "cachedResultUrl": "https://www.notion.so/cc045ddbd05a44fd88805682d58dad90"
        },
        "filterType": "manual",
        "matchType": "allFilters",
        "filters": {
          "conditions": [
            {
              "key": "Send|checkbox",
              "condition": "equals",
              "checkboxValue": true
            }
          ]
        },
        "options": {}
      },
      "id": "1e26528a-4d6d-4e4f-a1c2-e154ae476f79",
      "name": "Notion - получить данные",
      "type": "n8n-nodes-base.notion",
      "typeVersion": 2,
      "position": [
        1060,
        680
      ],
      "credentials": {
        "notionApi": {
          "id": "20",
          "name": "Notion account"
        }
      }
    },
    {
      "parameters": {
        "operation": "copy",
        "fileId": {
          "__rl": true,
          "value": "1_v9S1nggShZUFysUlBFrLGD1yxP-F8lcFdhlV_T2wds",
          "mode": ""
        },
        "options": {
          "parents": [
            "1zy4d3jmRcfSdecx76sY8NXE3fwIryudg"
          ]
        }
      },
      "id": "7f67b577-e740-48c5-a2dd-86fb8a7a30e3",
      "name": "Создать копии шаблонов",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 2,
      "position": [
        1320,
        680
      ],
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "14",
          "name": "Google Drive account"
        }
      }
    },
    {
      "parameters": {
        "authentication": "oAuth2",
        "operation": "share",
        "fileId": "={{$json[\"documentId\"]}}",
        "permissionsUi": {
          "permissionsValues": {
            "role": "reader",
            "type": "anyone"
          }
        },
        "options": {}
      },
      "name": "Поделиться документом",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 1,
      "position": [
        80,
        1020
      ],
      "id": "5529e375-6858-42f5-9268-fa95df956278",
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "14",
          "name": "Google Drive account"
        }
      }
    },
    {
      "parameters": {
        "content": "### Нужно для превращения в PDF",
        "height": 80,
        "width": 196.60095173351465
      },
      "id": "13db04c3-6895-48b7-9877-eb5d2b8c950f",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        60,
        1200
      ]
    },
    {
      "parameters": {
        "operation": "download",
        "fileId": {
          "__rl": true,
          "value": "={{ $json[\"id\"] }}",
          "mode": "id"
        },
        "options": {
          "fileName": "={{ $json[\"name\"] }}"
        }
      },
      "id": "8e29d46b-251e-43a1-88ac-ee7d632cd707",
      "name": "Скачать в n8n с именем",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 2,
      "position": [
        1040,
        1020
      ],
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "14",
          "name": "Google Drive account"
        }
      }
    },
    {
      "parameters": {
        "operation": "delete",
        "fileId": {
          "__rl": true,
          "value": "={{ $('Создать копии шаблонов').item.json.id }}",
          "mode": "id"
        }
      },
      "id": "e46aa283-76de-4398-affa-2dd67221ef86",
      "name": "Удалить заполненные шаблоны",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 2,
      "position": [
        1540,
        1020
      ],
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "14",
          "name": "Google Drive account"
        }
      }
    },
    {
      "parameters": {
        "resource": "databasePage",
        "operation": "update",
        "pageId": {
          "__rl": true,
          "value": "={{ $node[\"Notion - получить данные\"].json[\"id\"] }}",
          "mode": "id",
          "__regex": "^([0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12})"
        },
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Send|checkbox"
            }
          ]
        },
        "options": {}
      },
      "id": "2bd48ce1-b30e-4094-b8a4-942515ca334c",
      "name": "Notion - снять галочки",
      "type": "n8n-nodes-base.notion",
      "typeVersion": 2,
      "position": [
        1760,
        1020
      ],
      "credentials": {
        "notionApi": {
          "id": "20",
          "name": "Notion account"
        }
      }
    },
    {
      "parameters": {},
      "id": "4f2e6c61-82ce-4807-8114-00967f5584e5",
      "name": "When clicking \"Execute Workflow\"",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        120,
        680
      ]
    },
    {
      "parameters": {
        "outputFieldName": "дата",
        "options": {}
      },
      "id": "da45f9c3-aab3-4ad4-8996-271d2a18e766",
      "name": "Date & Time - текущая дата",
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 2,
      "position": [
        340,
        680
      ]
    },
    {
      "parameters": {
        "operation": "formatDate",
        "date": "={{ $json.дата }}",
        "format": "yyyy-MM-dd",
        "outputFieldName": "дата",
        "options": {
          "timezone": false
        }
      },
      "id": "7777b316-0ca4-43f9-bee4-29d9487b160f",
      "name": "Date & Time - формат",
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 2,
      "position": [
        580,
        680
      ]
    },
    {
      "parameters": {
        "operation": "formatDate",
        "date": "={{ $json.дата }}",
        "format": "custom",
        "customFormat": "LLLL d, yyyy",
        "outputFieldName": "дата",
        "options": {
          "timezone": false
        }
      },
      "id": "96b61917-0912-41b8-a5f0-dd91eed5c958",
      "name": "Date & Time - формат1",
      "type": "n8n-nodes-base.dateTime",
      "typeVersion": 2,
      "position": [
        580,
        520
      ]
    },
    {
      "parameters": {
        "content": "### Измените дату с помощью ChatGPT\n\nПриведите пример нужного формата",
        "height": 120.2539006453764
      },
      "id": "ade1ad19-717d-4aa2-b938-a7c9c2dbef2d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        760,
        680
      ]
    },
    {
      "parameters": {
        "content": "### Переименуйте документы\n\nФормат: имя - письмо",
        "height": 120.2539006453764
      },
      "id": "7c84ce7c-532d-4d08-8f81-7fb75a2930a2",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1520,
        660
      ]
    },
    {
      "parameters": {
        "content": "### Вставьте данные в плейсхолдеры\n\nНапример, замените {{Дата}} на актуальную дату",
        "height": 120.2539006453764
      },
      "id": "37920e7f-a697-4d88-a5ec-5faf1e1e2735",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1800,
        660
      ]
    },
    {
      "parameters": {
        "content": "### Получите PDF-версию документа\n\nОтправьте запрос на этот адрес, заменив DOCUMENT_ID на ID:\n\nhttps://docs.google.com/feeds/download/documents/export/Export?DOCUMENT_ID&exportFormat=pdf",
        "height": 180.97710799271795,
        "width": 290.7866825086856
      },
      "id": "75737f55-97e5-4be9-a38d-59a10bc0b5f9",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        320,
        980
      ]
    },
    {
      "parameters": {
        "content": "### Сохраните PDF на диск\n\nИмя получите, например, из узла Переименуйте копии шаблонов\". Добавьте к имени PDF",
        "height": 180.97710799271795,
        "width": 290.7866825086856
      },
      "id": "39a12cd6-24ca-4eb4-9706-41790d61e70b",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        700,
        980
      ]
    },
    {
      "parameters": {
        "content": "### Совершите рассылку из узла GMail\n\nЗаголовок: <Имя>, приглашаем на благотворительный концерт!\n\nТекст: Письмо находится во вложении",
        "height": 199.74609935462348,
        "width": 248.83246652324956
      },
      "id": "410a434f-f2bb-4ac6-a2d7-786841578516",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1220,
        960
      ]
    }
  ],
  "pinData": {},
  "connections": {
    "Notion - получить данные": {
      "main": [
        [
          {
            "node": "Создать копии шаблонов",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Создать копии шаблонов": {
      "main": [
        []
      ]
    },
    "Поделиться документом": {
      "main": [
        []
      ]
    },
    "Скачать в n8n с именем": {
      "main": [
        []
      ]
    },
    "Удалить заполненные шаблоны": {
      "main": [
        [
          {
            "node": "Notion - снять галочки",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \"Execute Workflow\"": {
      "main": [
        [
          {
            "node": "Date & Time - текущая дата",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Date & Time - текущая дата": {
      "main": [
        [
          {
            "node": "Date & Time - формат",
            "type": "main",
            "index": 0
          },
          {
            "node": "Date & Time - формат1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Date & Time - формат": {
      "main": [
        []
      ]
    }
  },
  "active": false,
  "settings": {},
  "versionId": "c16758fd-47cb-4f22-8202-7824207fb720",
  "id": "ZJX9Wsoz2XnkWeVe",
  "meta": {
    "instanceId": "62148517c718afe88189b4557f5264eca24fb302b44a11226f98636805acbeef"
  },
  "tags": [
    {
      "id": "2",
      "createdAt": "2023-06-22T04:56:17.812Z",
      "updatedAt": "2023-06-22T04:56:17.812Z",
      "name": "n8n business course"
    }
  ]
}