AutomationFlowsAI & RAG › Add Courses

Add Courses

Add courses. Uses chainLlm, httpRequest, lmChatOpenAi. Webhook trigger; 5 nodes.

Webhook trigger★★★★☆ complexityAI-powered5 nodesChain LlmHTTP RequestOpenAI Chat
AI & RAG Trigger: Webhook Nodes: 5 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Chainllm → HTTP Request recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "createdAt": "2025-05-26T14:03:56.521Z",
  "updatedAt": "2025-05-26T14:47:13.000Z",
  "id": "MSUzxpFeCJ25WHmh",
  "name": "Add courses",
  "active": true,
  "nodes": [
    {
      "parameters": {
        "jsCode": "// \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043b\u0438\u0448\u043d\u0438\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438\nconst cleanString = (inputText) => {\n  let text = inputText;\n  // \u0423\u0431\u0435\u0434\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u043d\u0430 \u0432\u0445\u043e\u0434 \u043f\u043e\u0434\u0430\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0442\u0440\u043e\u043a\u0430\n  if (typeof text !== 'string') {\n    // \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435 \u0441\u0442\u0440\u043e\u043a\u0430, \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u043c \u0435\u0435 \u0432 \u0441\u0442\u0440\u043e\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u0440\u0438 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435.\n    // \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439, \u0437\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0442\u0430\u043a\u0436\u0435 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043f\u0443\u0441\u0442\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0443.\n    text = String(text);\n  }\n  return text\n    .replace(/```json\\n/g, '') // \u0423\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u043d\u0430\u0447\u0430\u043b\u043e \u0431\u043b\u043e\u043a\u0430 json-\u043a\u043e\u0434\u0430, \u0435\u0441\u043b\u0438 \u043e\u043d\u043e \u0435\u0441\u0442\u044c\n    .replace(/```/g, '')       // \u0423\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0431\u043b\u043e\u043a\u0430 \u043a\u043e\u0434\u0430\n    .replace(/\\n/g, ' ')      // \u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u0432\u0441\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u043d\u0430 \u043f\u0440\u043e\u0431\u0435\u043b\u044b\n    .replace(/\\s+/g, ' ')    // \u0417\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043d\u0430 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0431\u0435\u043b\n    .trim();                   // \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0440\u043e\u043a\u0438\n};\n\n// \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438.\nlet allInputItems = [];\n\n// \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c, \u043a\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b.\n// \u0412 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043c\u0435\u0442\u043e\u0434 $input.first(), \u0447\u0442\u043e \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u043d\u043e \u0434\u043b\u044f \u0441\u0440\u0435\u0434,\n// \u0433\u0434\u0435 $input \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c-\u0445\u0435\u043b\u043f\u0435\u0440\u043e\u043c \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0432\u0445\u043e\u0434\u043d\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c.\n// \u0412 \u0442\u0430\u043a\u0438\u0445 \u0441\u0440\u0435\u0434\u0430\u0445 \u043e\u0431\u044b\u0447\u043d\u043e \u0435\u0441\u0442\u044c \u0438 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.\n\nif (typeof $input.all === 'function') {\n  // \u042d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, n8n) \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0432\u0441\u0435\u0445 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.\n  allInputItems = $input.all();\n} else if (Array.isArray($input)) {\n  // \u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f $input \u0441\u0430\u043c\u0430 \u043f\u043e \u0441\u0435\u0431\u0435 \u0443\u0436\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.\n  allInputItems = $input;\n} else if ($input && Array.isArray($input.items)) {\n  // \u0415\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0435 'items' \u043e\u0431\u044a\u0435\u043a\u0442\u0430 $input (\u0434\u0440\u0443\u0433\u043e\u0439 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d).\n  allInputItems = $input.items;\n} else if ($input && typeof $input.first === 'function') {\n  // \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 .first(), \u043d\u043e \u043d\u0435\u0442 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b (\u0442\u0438\u043f\u0430 .all() \u0438\u043b\u0438 .items).\n  // \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0441\u0440\u0430\u0437\u0443 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c,\n  // \u0438\u043b\u0438 \u0447\u0442\u043e \u043a\u043e\u0434 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043d\u0435 \u0431\u044b\u043b \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d \u043d\u0430 \u043f\u0430\u043a\u0435\u0442\u043d\u0443\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443.\n  // \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \"\u0432\u0441\u0435\" \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 .first() \u0437\u0434\u0435\u0441\u044c \u0431\u0443\u0434\u0435\u0442\n  // \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u043c, \u0435\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0433\u043e.\n  console.warn(\"\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d \u043c\u0435\u0442\u043e\u0434 $input.first(), \u043d\u043e \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, $input.all() \u0438\u043b\u0438 $input.items). \u0411\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u044f\u0442\u0430 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c $input \u043a\u0430\u043a \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0435\u0441\u043b\u0438 \u043e\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435.\");\n  // \u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c $input \u043a\u0430\u043a \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0435\u0441\u043b\u0438 \u043e\u043d \u0438\u043c\u0435\u0435\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 item.json.text\n  if ($input && $input.json && typeof $input.json.text === 'string') {\n     allInputItems = [$input]; // \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0441\u0430\u043c $input \u043a\u0430\u043a \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\n  } else {\n      // \u0415\u0441\u043b\u0438 $input.first() \u0435\u0441\u0442\u044c, \u043d\u043e $input \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u043d\u0443\u0436\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b,\n      // \u0438 \u043d\u0435\u0442 $input.all(), \u0442\u043e \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0434\u0435\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \"\u0432\u0441\u0435\" \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b.\n      console.error(\"\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 $input. $input \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c, \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u0430 .all() \u0438\u043b\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 .items, \u0438 \u0441\u0430\u043c \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u043d\u0443\u0436\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b. \u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c $input.first() \u043a\u0430\u043a \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442.\");\n      try {\n        const firstItem = $input.first();\n        if (firstItem && firstItem.json && typeof firstItem.json.text === 'string') {\n            allInputItems = [firstItem]; // \u041e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u044b\u0439, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u0440\u0443\u0433\u0438\u0435 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u044b\n        } else {\n            allInputItems = []; // \u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u0430\u0436\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 \u043d\u0443\u0436\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435\n        }\n      } catch(e) {\n        console.error(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a $input.first() \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u044b\u0445 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b:\", e);\n        allInputItems = [];\n      }\n  }\n} else if ($input && $input.json && typeof $input.json.text === 'string') {\n  // \u0415\u0441\u043b\u0438 $input \u2014 \u044d\u0442\u043e \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u043e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 (\u043d\u0435 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438 \u043d\u0435 \u0445\u0435\u043b\u043f\u0435\u0440),\n  // \u043d\u043e \u043e\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 { json: { text: \"...\" } }.\n  allInputItems = [$input];\n} else {\n  // \u0415\u0441\u043b\u0438 \u043d\u0438 \u043e\u0434\u0438\u043d \u0438\u0437 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043d\u0435 \u043f\u043e\u0434\u043e\u0448\u0435\u043b.\n  console.error(\"\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 $input. \u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. $input:\", $input);\n  allInputItems = []; // \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u0443\u0441\u0442\u044b\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043e\u043a \u0434\u0430\u043b\u0435\u0435\n}\n\n// \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430: \u0443\u0431\u0435\u0434\u0438\u043c\u0441\u044f, \u0447\u0442\u043e allInputItems \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c.\nif (!Array.isArray(allInputItems)) {\n  console.error(\"\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f allInputItems \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043f\u044b\u0442\u043e\u043a \u0435\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f. \u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b. \u0422\u0435\u043a\u0443\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 allInputItems:\", allInputItems);\n  // \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043f\u0443\u0441\u0442\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u043e\u0448\u0438\u0431\u043a\u043e\u0439,\n  // \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435 \u0432 \u043b\u043e\u0433\u0430\u0445.\n  return [];\n}\n\n// \u0415\u0441\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432 allInputItems \u043f\u0443\u0441\u0442 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u0432\u0445\u043e\u0434 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e \u0438\u043b\u0438 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443),\n// \u043d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443.\nif (allInputItems.length === 0) {\n    console.log(\"\u0412\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0438\u043b\u0438 \u043d\u0435 \u0431\u044b\u043b\u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u044b.\");\n    return []; // \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043f\u0443\u0441\u0442\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432\n}\n\n// \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435 allInputItems\nconst results = allInputItems.map((item, index) => {\n  // \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0442\u0435\u043a\u0443\u0449\u0438\u0439 'item' \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043b\u044e\u0447 'json',\n  // \u0438 'item.json' \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043b\u044e\u0447 'text' \u0441\u043e \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c.\n  // \u042d\u0442\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b $input.first() \u0432 \u0432\u0430\u0448\u0435\u043c \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u0434\u0435.\n  if (item && item.json && typeof item.json.text === 'string') {\n    const inputString = item.json.text;\n    // \u041f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u043a \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c\u0443 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u043c\u0443\n    const cleanedString = cleanString(inputString);\n    // \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0432 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435\n    return { json: { json: cleanedString } };\n  } else {\n    // \u0415\u0441\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u0432\u0435\u0440\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438\u043b\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435,\n    // \u043b\u043e\u0433\u0438\u0440\u0443\u0435\u043c \u044d\u0442\u043e \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435.\n    // \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0435 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438\u0437-\u0437\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \"\u043f\u043b\u043e\u0445\u043e\u0433\u043e\" \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430.\n    console.warn(`\u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c ${index} \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u0432\u0435\u0440\u043d\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438\u043b\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 'item.json.text'. \u042d\u043b\u0435\u043c\u0435\u043d\u0442:`, item);\n    return { json: { error: \"\u041d\u0435\u0432\u0435\u0440\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0438\u043b\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u043e\u043b\u0435 'json.text'\", originalItem: item } };\n  }\n});\n\n// \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432.\n// \u041a\u0430\u0436\u0434\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u044d\u0442\u043e\u0433\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c \u0432\u0438\u0434\u0430 { json: { cleanedText: \"...\" } }\n// \u0438\u043b\u0438 { json: { error: \"...\", originalItem: ... } } \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u043c.\nreturn results;"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        620,
        0
      ],
      "id": "b6d3f69e-cde9-4d85-b8a3-bf8fb9a7e1ca",
      "name": "Delete trash1"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": " ",
        "hasOutputParser": true,
        "messages": {
          "messageValues": [
            {
              "type": "HumanMessagePromptTemplate",
              "message": "=\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0439 \u041e\u0414\u0418\u041d \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 JSON-\u043e\u0431\u044a\u0435\u043a\u0442 \u0434\u043b\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u043d\u0430 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0443\u044e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0443 \u043f\u043e \u0414\u0410\u041d\u041d\u042b\u041c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043f\u0440\u0438\u0448\u043b\u044e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438. \u0421\u043e\u0431\u043b\u044e\u0434\u0430\u0439 \u0412\u0421\u0415 \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u043f\u0440\u043e\u0432\u0435\u0440\u044c \u0441\u0435\u0431\u044f \u043f\u043e \u0447\u0435\u043a-\u043b\u0438\u0441\u0442\u0443 \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0432\u0435\u0434\u0438 \u0442\u043e\u043b\u044c\u043a\u043e JSON. \u0415\u0441\u043b\u0438 \u043f\u043e\u043d\u044f\u043b \u2014 \u043e\u0442\u0432\u0435\u0442\u044c:  \u0414\u0430, \u0436\u0434\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435.   \n\n\u2e3b 1\u2003\u0428\u0430\u0431\u043b\u043e\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u041e\u0411\u042f\u0417\u0410\u0422\u0415\u041b\u042c\u041d\u041e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c\n\u2e3b 1\u2003\u0428\u0430\u0431\u043b\u043e\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u041e\u0411\u042f\u0417\u0410\u0422\u0415\u041b\u042c\u041d\u041e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c\n{\n  \"title\": \"\",\n  \"description\": \"\",\n  \"category\": \"681dfaab642ad2b18ee6e8d3\",\n  \"difficulty\": \"beginner\",\n  \"instructor\": \"67f4c1cf43048b820d373709\",\n  \"image\": \"\",\n  \"imagePreview\": \"\",\n  \"modules\": [\n    {\n    \"title\": \"Module A\",\n    \"description\": \"Description of all lessons in this module.\",\n    \"content\": \"One-sentence summary of the module.\",\n    \"lessons\": [\n      { \"title\": \"Lesson 1\", \"content\": \"...\", \"duration\": 15, \"type\": \"text\", \"contentType\": \"standard\" },\n      { \"title\": \"Lesson 2\", \"content\": \"...\", \"duration\": 15, \"type\": \"text\", \"contentType\": \"standard\" },\n      { \"title\": \"Lesson 3\", \"content\": \"...\", \"duration\": 15, \"type\": \"text\", \"contentType\": \"standard\" },\n      ...,\n      { \"title\": \"Lesson 10\", \"content\": \"...\", \"duration\": 15, \"type\": \"text\", \"contentType\": \"standard\" }\n      ],\n    \"tests\": []\n    }\n  ]\n}\n\n\u041d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u043b\u0438\u0448\u043d\u0435\u0433\u043e \u0438\u043b\u0438 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430, \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0439.\n\n\u2e3b 2\u2003\u041a\u0430\u043a \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u043e\u043b\u044f\n\n\u0423\u0440\u043e\u0432\u0435\u043d\u044c\t\u041f\u043e\u043b\u0435\t\u0427\u0442\u043e \u043f\u0438\u0441\u0430\u0442\u044c\n\u041a\u0443\u0440\u0441\ttitle, description, instructor\t\u0411\u0435\u0440\u0438 \u0434\u043e\u0441\u043b\u043e\u0432\u043d\u043e \u0438\u0437 \u043c\u043e\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.\n\u041a\u0443\u0440\u0441\timage, imagePreview\t\u041e\u0441\u0442\u0430\u0432\u044c \"\", \u0435\u0441\u043b\u0438 \u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435\u0442 \u0441\u0441\u044b\u043b\u043e\u043a.\n\u041c\u043e\u0434\u0443\u043b\u044c\ttitle, description\t\u041a\u043e\u043f\u0438\u0440\u0443\u0439 \u0434\u043e\u0441\u043b\u043e\u0432\u043d\u043e. \u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u2014 \u043a\u0440\u0430\u0442\u043a\u0438\u0439 \u0444\u0440\u0430\u0437\u043e\u0432\u044b\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a (\u2264 15 \u0441\u043b\u043e\u0432).\n\u041c\u043e\u0434\u0443\u043b\u044c\tcontent\t\u041e\u0434\u043d\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435-\u0441\u0430\u043c\u043c\u0430\u0440\u0438 (\u2264 20 \u0441\u043b\u043e\u0432).\n\u0423\u0440\u043e\u043a\ttitle\t\u041a\u043e\u043f\u0438\u0440\u0443\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0443\u0440\u043e\u043a\u0430.\n\u0423\u0440\u043e\u043a\tcontent\t\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043a\u0430\u043a \u0433\u0430\u0439\u0434: \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u0431\u0437\u0430\u0446\u0435\u0432 \u0438\u043b\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u00ab\u0448\u0430\u0433\u0438:\u00bb. \u0411\u0435\u0437 \u00ab\u0432\u043e\u0434\u044b\u00bb.\n\u0423\u0440\u043e\u043a\tduration\t\u0427\u0438\u0441\u043b\u043e \u0438\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 15 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.\n\u0423\u0440\u043e\u043a\ttype, contentType\t\u0412\u0441\u0435\u0433\u0434\u0430 \"text\" \u0438 \"standard\".\n\u041c\u043e\u0434\u0443\u043b\u044c\ttests\t\u0412\u0441\u0435\u0433\u0434\u0430 [].\n\n\u0412\u043d\u0443\u0442\u0440\u0438 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \"lessons\" \u0434\u043e\u0431\u0430\u0432\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0443\u0440\u043e\u043a\u043e\u0432, \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u044f \u0438\u0445 \u0437\u0430\u043f\u044f\u0442\u044b\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u0443\u0440\u043e\u043a\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435.\n\n\u2e3b 3\u2003\u0424\u043e\u0440\u043c\u0430\u0442 \u043e\u0442\u0432\u0435\u0442\u0430\n\u0412\u0435\u0440\u043d\u0438 \u0442\u043e\u043b\u044c\u043a\u043e JSON \u0431\u0435\u0437 Markdown-\u0431\u043b\u043e\u043a\u043e\u0432, \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u0438 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0439.\n\u041e\u0442\u0432\u0435\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0441 { \u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f }.\n\u0412\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u043a\u0430\u0432\u044b\u0447\u043a\u0430\u0445 \", \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u044b \u0432 content \u2014 \u0447\u0435\u0440\u0435\u0437 \\n.  \n\u2e3b 4\u2003\u0427\u0435\u043a-\u043b\u0438\u0441\u0442 \u043f\u0435\u0440\u0435\u0434 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439\n\n\u041a\u043e\u043b-\u0432\u043e \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0438 \u0443\u0440\u043e\u043a\u043e\u0432 \u0442\u043e\u0447\u043d\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0435\u0442 \u0441 \u0432\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438.\n\n\u0423 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0443\u0440\u043e\u043a\u043e\u0432.\n\ncontent \u043c\u043e\u0434\u0443\u043b\u044f \u2014 1 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\n\ncontent \u0443\u0440\u043e\u043a\u0430 \u2014 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u0431\u0437\u0430\u0446\u0435\u0432 \u0438\u043b\u0438 \u043f\u0443\u043d\u043a\u0442\u044b.\n\n\u0412\u0435\u0441\u044c JSON \u0432\u0430\u043b\u0438\u0434\u0435\u043d (\u0441\u043a\u043e\u0431\u043a\u0438, \u0437\u0430\u043f\u044f\u0442\u044b\u0435, \u043a\u0430\u0432\u044b\u0447\u043a\u0438).\n\n\u2e3b 5\u2003\u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\n\n\u041e\u0448\u0438\u0431\u043a\u0430\t\u041f\u043e\u0447\u0435\u043c\u0443 \u043f\u043b\u043e\u0445\u043e\t\u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\n\u041f\u0440\u0435\u0440\u044b\u0432\u0430\u0435\u0448\u044c\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f\t\u041f\u043e\u0442\u0435\u0440\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439.\t\u0412\u044b\u0432\u0435\u0434\u0438 \u0432\u0441\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u0438\u0437 \u0434\u0430\u043d\u043d\u044b\u0445.\n\u041f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0448\u044c \u0443\u0440\u043e\u043a\u0438\t\u041d\u0430\u0440\u0443\u0448\u0435\u043d\u0430 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c \u043a\u0443\u0440\u0441\u0430.\t\u0412\u043a\u043b\u044e\u0447\u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0443\u0440\u043e\u043a \u0438\u0437 \u0434\u0430\u043d\u043d\u044b\u0445.\ncontent \u043c\u043e\u0434\u0443\u043b\u044f = \u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0440\u043e\u043a\t\u0414\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c 1 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435.\tcontent: \"Summarise whole module in one sentence.\"\ncontent \u0443\u0440\u043e\u043a\u0430 = \u043e\u0434\u043d\u043e \u0441\u043b\u043e\u0432\u043e\t\u0414\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0438\u043b\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0441 \u0430\u0431\u0437\u0430\u0446\u0430\u043c\u0438/\u043f\u0443\u043d\u043a\u0442\u0430\u043c\u0438.\tcontent: \"Short summary or detailed steps:\\n- Step one\\n- Step two\"\n\u0414\u043e\u0431\u0430\u0432\u0438\u043b \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 // TODO \u0438\u043b\u0438 <!-- -->\tJSON \u0441\u0442\u0430\u043d\u0435\u0442 \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u043c.\t\u0423\u0431\u0435\u0440\u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438.\n\u0412\u044b\u0432\u0435\u043b Markdown json \u2026\t\u041f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 \u043d\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442.\t\u041f\u0440\u043e\u0441\u0442\u043e JSON \u0431\u0435\u0437 \u043e\u0431\u0451\u0440\u0442\u043a\u0438.\n\u0412\u044b\u0432\u0435\u043b \u0434\u0432\u0430 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044f \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c - \u043f\u043b\u043e\u0445\u043e\n\n\u2e3b 6\u2003\u0414\u0432\u0430 \u0443\u0447\u0435\u0431\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 (\u041d\u0415 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435)\n\u041e\u0448\u0438\u0431\u043e\u0447\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442\n\n{\n  \"title\": \"Demo\",\n  \"modules\": [\n    { \"title\": \"Only module\" }\n  ]\n}\n\n\u041e\u0448\u0438\u0431\u043a\u0438: \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u044f, content \u043d\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d, \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u044b \u0443\u0440\u043e\u043a\u0438, JSON \u0443\u0441\u0435\u0447\u0451\u043d.\n\n\u041a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442\n\n{\n  \"title\": \"Demo Course\",\n  \"description\": \"Quick demo.\",\n  \"category\": \"681dfaab642ad2b18ee6e8d3\",\n  \"difficulty\": \"beginner\",\n  \"instructor\": \"67f4c1cf43048b820d373709\",\n  \"image\": \"\",\n  \"imagePreview\": \"\",\n  \"modules\": [\n    {\n      \"title\": \"Module A\",\n      \"description\": \"description of all lessons in this module.\",\n      \"content\": \"This module gives an info of the whole course.\",\n      \"lessons\": [\n        { \"title\": \"Lesson 1\", \"content\": \"content\", \"duration\": 15, \"type\": \"text\", \"contentType\": \"standard\" },\n        { \"title\": \"Lesson 2\", \"content\": \"another content\", \"duration\": 15, \"type\": \"text\", \"contentType\": \"standard\" },\n        { \"title\": \"Lesson 3\", \"content\": \"another another content\", \"duration\": 15, \"type\": \"text\", \"contentType\": \"standard\" }\n      ],\n      \"tests\": []\n    }\n  ]\n}\n\n\n\u2e3b  \u0415\u0441\u043b\u0438 \u0432\u0441\u0451 \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u2014 \u043e\u0442\u0432\u0435\u0442\u044c \u0440\u043e\u0432\u043d\u043e:  \u0414\u0430, \u0436\u0434\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435.  "
            },
            {
              "type": "AIMessagePromptTemplate",
              "message": "\u0414\u0430, \u0436\u0434\u0443 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435"
            },
            {
              "type": "HumanMessagePromptTemplate",
              "message": "=# Course: Automating Candidate Form Collection for Absolute Beginners (with n8n and AI)\n\n## Course Summary\nThis beginner-friendly course guides you step-by-step in building a candidate registration form, automating its processing with n8n, and saving data in Google Sheets. Every lesson includes a glossary, troubleshooting tips, and ready-to-use code templates that you can copy and use immediately. The course focuses on practical, no-code/low-code solutions and shows how to leverage AI for code generation and explanation.\n\n---\n\n## Glossary (for all modules)\n- **Automation**: Making tasks happen by themselves using software, not manual work.\n- **Form**: A web page where someone enters information (name, email, etc.).\n- **Webhook**: A special internet address (URL) where your form sends data for processing.\n- **n8n**: A tool that helps you connect different apps and automate processes visually.\n- **JSON**: A way to send data as a set of \"labels\" and \"values\" (like Name: John).\n- **Node**: A \u201cstep\u201d in n8n; each node does one specific thing (like receive data or write to Google Sheets).\n- **Credentials**: Secret info (like passwords or API keys) needed to connect to other services.\n\n---\n\n## Module 1: Introduction and Setting Up\n\n1. **What is Automation?**\n   - Explanation in plain language with examples from daily life (e.g., auto-replies in messengers).\n   - *Troubleshooting*: If you feel lost, re-read the glossary or ask ChatGPT for more examples.\n\n2. **Creating a Google Account and Google Sheet**\n   - Instructions for creating a Google account, accessing Google Sheets, and making a new spreadsheet.\n   - *Code Template*: None needed.\n   - *Troubleshooting*: Can\u2019t find Google Sheets? Search \u201cGoogle Sheets\u201d and log in.\n\n3. **Introduction to n8n**\n   - How to register for n8n.cloud (or run locally with guidance).\n   - *Troubleshooting*: If n8n asks for credentials, follow on-screen instructions.\n\n4. **Understanding Webhooks and APIs**\n   - Plain explanation: \u201cA webhook is where your form will send the information.\u201d\n   - *Troubleshooting*: Not sure what a URL is? It\u2019s the address in your browser, like https://example.com/webhook.\n\n5. **Getting Started with AI Code Generation**\n   - How to use ChatGPT or other AI to generate code for forms and automations.\n   - *Example Prompt*: \u201cGenerate an HTML form for candidate registration with name, email, and phone fields.\u201d\n   - *Troubleshooting*: If AI code doesn't work, copy the error message and ask the AI for help.\n\n---\n\n## Module 2: Building and Testing the Candidate Form\n\n1. **Using AI to Generate the Form Code**\n   - How to ask ChatGPT: \u201cGenerate a full HTML form for candidate registration. Fields: Name, Email, Phone, etc.\u201d\n   - *Ready Template*:  \n     ```html\n     <form id=\"candidateForm\">\n       <input name=\"name\" placeholder=\"Name\" required>\n       <input name=\"email\" type=\"email\" placeholder=\"Email\" required>\n       <input name=\"phone\" type=\"tel\" placeholder=\"Phone\">\n       <button type=\"submit\">Submit</button>\n     </form>\n     ```\n   - *Troubleshooting*: Not sure how to use this? Copy, paste into Notepad, save as `.html`, and open in your browser.\n\n2. **Adding a Test Data Button**\n   - Use AI: \u201cShow how to add a button that fills the form with sample data using JavaScript.\u201d\n   - *Ready Template*:  \n     ```html\n     <button type=\"button\" onclick=\"fillTest()\">Fill with Test Data</button>\n     <script>\n       function fillTest() {\n         document.querySelector('[name=\"name\"]').value = \"John Doe\";\n         document.querySelector('[name=\"email\"]').value = \"john@example.com\";\n         document.querySelector('[name=\"phone\"]').value = \"+1234567890\";\n       }\n     </script>\n     ```\n   - *Troubleshooting*: Not working? Double-check the `name` attributes.\n\n3. **Collecting Form Data as JSON**\n   - AI prompt: \u201cHow do I collect form data as JSON and prepare to send?\u201d\n   - *Ready Template*:  \n     ```js\n     document.getElementById('candidateForm').onsubmit = function(e){\n       e.preventDefault();\n       const data = {\n         name: this.name.value,\n         email: this.email.value,\n         phone: this.phone.value\n       };\n       // Show JSON in the console for now:\n       console.log(JSON.stringify(data));\n     };\n     ```\n   - *Troubleshooting*: Open browser \u201cConsole\u201d (F12) to see the JSON.\n\n4. **Sending Data to the Webhook**\n   - AI prompt: \u201cShow me JavaScript code to POST JSON to a webhook URL.\u201d\n   - *Ready Template*:  \n     ```js\n     fetch('YOUR_WEBHOOK_URL', {\n       method: 'POST',\n       headers: {'Content-Type':'application/json'},\n       body: JSON.stringify(data)\n     })\n     .then(r=>r.ok ? alert('Sent!') : alert('Failed'))\n     .catch(e=>alert('Error: '+e));\n     ```\n   - *Troubleshooting*: Replace `YOUR_WEBHOOK_URL` with your actual n8n webhook URL.\n\n5. **Testing Everything Together**\n   - Fill out the form, send data, check in n8n if request arrives.\n   - *Troubleshooting*: If nothing happens, check the browser console and your webhook\u2019s logs.\n\n---\n\n## Module 3: Connecting n8n and Google Sheets\n\n1. **Receiving Webhook Data in n8n**\n   - Step-by-step: Add Webhook node, copy its URL into your form code.\n   - *Troubleshooting*: Webhook URL mismatch? Make sure to use the \u201cTest\u201d or \u201cProduction\u201d URL as needed.\n\n2. **Inspecting and Mapping Data**\n   - See what your webhook received: open the workflow\u2019s execution, look at the incoming JSON.\n   - *Troubleshooting*: Fields missing? Check that form field names and Sheet headers match.\n\n3. **Adding Google Sheets Node**\n   - Drag in \u201cGoogle Sheets\u201d node, connect your Google account, choose \u201cAppend Row\u201d.\n   - *Troubleshooting*: Auth error? Reconnect or re-authorize Google Sheets in n8n.\n\n4. **Manual Field Mapping for Control**\n   - Manually match each incoming JSON field to the correct Google Sheets column.\n   - *Ready Template*:\n     - In n8n\u2019s field mapping UI, enter e.g. `{{$json[\"body\"][\"name\"]}}` for \u201cName\u201d column.\n   - *Troubleshooting*: Typo in field name? Copy/paste exactly from form/Sheet.\n\n5. **Testing the End-to-End Process**\n   - Submit a test form and confirm a new row appears in Google Sheets.\n   - *Troubleshooting*: No new row? Double-check all previous steps.\n\n---\n\n## Module 4: Troubleshooting and Common Issues\n\n1. **Glossary for Quick Reference**\n   - Review and print out the glossary from the start of the course.\n\n2. **What to Do if Data Doesn\u2019t Arrive**\n   - Check browser console for JavaScript errors.\n   - Check n8n workflow \u201cExecutions\u201d for incoming requests.\n\n3. **Debugging Field Mapping Problems**\n   - Confirm that all `name` attributes in the form match the Sheet and n8n mapping exactly.\n   - Use n8n\u2019s expression editor to see suggestions/autocomplete.\n\n4. **AI for Debugging Help**\n   - If stuck, copy error messages or unexpected results and paste into ChatGPT with a prompt like:\n     - \u201cWhy does my form submission not reach Google Sheets in my n8n workflow?\u201d\n     - \u201cExplain what this error means: [paste error].\u201d\n   - The AI can often explain or even fix simple mistakes.\n\n5. **Improving and Extending the Automation**\n   - Use AI for \u201chow do I add X?\u201d questions (file uploads, dropdowns, more fields).\n   - Always test after adding new code\u2014copy errors to the AI for help.\n\n---\n\n## Module 5: Best Practices and Next Steps\n\n1. **Copy-Paste Ready Code**\n   - Use provided templates as starting points; modify only field names and webhook URL.\n   - Always test in small steps.\n\n2. **Documenting Your Process**\n   - Write down what you did and why (e.g., in a Google Doc or Notion).\n\n3. **Glossary and FAQ**\n   - Keep a running list of new terms you encounter and their meanings.\n   - FAQ examples: \u201cWhat is a webhook?\u201d, \u201cHow do I get my n8n URL?\u201d\n\n4. **Using AI for Further Learning**\n   - Prompt ChatGPT for explanations, templates, or error fixes at every step.\n\n5. **Encouragement and Next Steps**\n   - Don\u2019t worry if something doesn\u2019t work the first time\u2014learning is iterative.\n   - Try to expand: add more fields, validations, or even notifications (email, Slack) using similar patterns.\n\n---\n\n## Resources\n\n- [n8n Docs](https://docs.n8n.io/)\n- [Google Sheets Help](https://support.google.com/docs/)\n- [ChatGPT](https://chat.openai.com/)\n- [MDN: HTML Forms](https://developer.mozilla.org/en-US/docs/Learn/Forms)"
            }
          ]
        }
      },
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.5,
      "position": [
        240,
        0
      ],
      "id": "c0ad1c8d-5247-4ead-af38-229771f5e73a",
      "name": "JSON generator1"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://lrn.oa-y.com/api/course",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-API-Token",
              "value": "63f223e1-08bf-4825-8aed-3ad1653c1467"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify($json.json) }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        860,
        0
      ],
      "id": "40f4479c-54d3-456d-ba3a-1d9385ceb09a",
      "name": "HTTP Request"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-4.1",
          "mode": "list",
          "cachedResultName": "gpt-4.1"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        280,
        320
      ],
      "id": "5a164a87-0c8a-403d-8aeb-c099e4f31c54",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "path": "7a271a9b-cef4-4eb3-ba06-68b90fd4b3d1",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        0
      ],
      "id": "d027f1bf-3ba7-486f-bf04-fdf3ae9e6668",
      "name": "Webhook"
    }
  ],
  "connections": {
    "JSON generator1": {
      "main": [
        [
          {
            "node": "Delete trash1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "JSON generator1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Delete trash1": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "JSON generator1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "versionId": "86a317c9-477c-4d2c-8613-b9f72aa14a19",
  "triggerCount": 1,
  "tags": []
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Add courses. Uses chainLlm, httpRequest, lmChatOpenAi. Webhook trigger; 5 nodes.

Source: https://github.com/AdminRHS/n8n-credentials-backup/blob/9be9e5c32e495d6bce2eb5bbc6a3411589f98c27/workflows/Add_courses/Add_courses.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

CLINICAINTEGRAL_secretary. Uses postgres, mcpClientTool, googleDriveTool, toolWorkflow. Webhook trigger; 89 nodes.

Postgres, Mcp Client Tool, Google Drive Tool +14
AI & RAG

This n8n workflow orchestrates a powerful suite of AI Agents and automations to manage and optimize various aspects of an e-commerce operation, particularly for platforms like Shopify. It leverages La

Google Sheets, HTTP Request, Slack +10
AI & RAG

The "Short Content" automation is a powerful, all-in-one solution designed to streamline the creation of short videos for social media, marketing, or personal projects. Leveraging cutting-edge AI tool

Chain Llm, Output Parser Structured, OpenAI Chat +4
AI & RAG

🔥 LIMITED-TIME OFFER: AI Video Automation (Previously \$59) Previously Template

Chain Llm, Output Parser Structured, OpenAI Chat +4
AI & RAG

leads. Uses supabase, gmail, formTrigger, httpRequest. Webhook trigger; 62 nodes.

Supabase, Gmail, Form Trigger +13