{
  "name": "My workflow 7",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.3,
      "position": [
        0,
        0
      ],
      "id": "cf0f669a-70f0-42e3-aeec-d6fe332887de",
      "name": "Schedule Trigger"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -16,
        -208
      ],
      "id": "b7661cc9-d3d2-4f7a-b8b6-b1ec8cbe61e9",
      "name": "When clicking ‘Execute workflow’"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-globals.globalConstants",
      "typeVersion": 1,
      "position": [
        272,
        -80
      ],
      "id": "5fe85c7c-822b-48de-893d-4dda89135a35",
      "name": "Global Constants",
      "credentials": {
        "globalConstantsApi": {
          "id": "yl0uMuUzOwPA6ZfG",
          "name": "Udemy Test Account (ReplyToMessages)"
        }
      }
    },
    {
      "parameters": {
        "url": "https://www.udemy.com/instructor-api/v1/message-threads/",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "status",
              "value": "unreplied"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        480,
        -80
      ],
      "id": "bfcb513b-54a1-405e-90cb-2378134ba304",
      "name": "HTTP Request",
      "credentials": {
        "httpHeaderAuth": {
          "id": "XJXjMoya5rTlt7RT",
          "name": "Udemy Credentials (Nandy Bo | Nandy Cyber Success)"
        }
      }
    },
    {
      "parameters": {
        "fieldToSplitOut": "results",
        "options": {}
      },
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        688,
        -80
      ],
      "id": "6263056d-a586-4e56-b31e-64a01a9c6c02",
      "name": "Split Out"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        928,
        -80
      ],
      "id": "d513b9c0-1e29-4a34-a4af-f2b839383a43",
      "name": "Loop Over Items"
    },
    {
      "parameters": {
        "url": "=https://www.udemy.com/instructor-api/v1/message-threads/{{ $json.id }}/messages/",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "message_thread_id",
              "value": "={{ $json.id }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        1232,
        64
      ],
      "id": "fc88e6c7-c4ea-4b86-bc79-1874e945bdf6",
      "name": "HTTP Request1",
      "credentials": {
        "httpHeaderAuth": {
          "id": "XJXjMoya5rTlt7RT",
          "name": "Udemy Credentials (Nandy Bo | Nandy Cyber Success)"
        }
      }
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "={{ $('Global Constants').first().json.constants.sheetid }}",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "={{ $('Global Constants').first().json.constants.sheet_name }}",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "ID": "={{ $json.results[0].id }}",
            "User": "={{ $json.results[0].user.title }}",
            "DATE": "={{ $json.results[0].created }}",
            "Message Content": "={{ $json.results[0].content.replace(/<[^>]*>/g, '') }}",
            "Responded (Y/N)": "N",
            "STATUS": "={{ $('Global Constants').first().json.constants.status6 }}",
            "Previous Interactions (Aggregated)": "={{ $json.results.slice(1).map((r, i) => `[${i + 1}] ${r.user.name}: ${r.content.replace(/<[^>]*>/g, '')}`).join('\\n\\n') }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "ID",
              "displayName": "ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "STATUS",
              "displayName": "STATUS",
              "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": "User",
              "displayName": "User",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Message Content",
              "displayName": "Message Content",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Previous Interactions (Aggregated)",
              "displayName": "Previous Interactions (Aggregated)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Response",
              "displayName": "Response",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Vetting",
              "displayName": "Vetting",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Pass/Fail",
              "displayName": "Pass/Fail",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Responded (Y/N)",
              "displayName": "Responded (Y/N)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Further Action (Y/N)",
              "displayName": "Further Action (Y/N)",
              "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": [
        1488,
        64
      ],
      "id": "265c629b-d23c-467e-be55-6bf655310939",
      "name": "Append row in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "wZJh4ACm1MD5wdQ9",
          "name": "Google Sheet (Admin Account - Nandy Cyber Success)"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=## Latest Message\n\n{{ $('Append row in sheet').item.json['Message Content'] }}\n\n## Message Context\n\n{{ $('Append row in sheet').item.json['Previous Interactions (Aggregated)'] }}\n\nOutput Format: Wrap your response in HTML. Use <p> tags for paragraphs. Do not use \\n for line breaks and \\n\\n for new paragraphs. Always use <br> for line breaks where needed. Do not use markdown formatting. Output in HTML.",
        "hasOutputParser": true,
        "needsFallback": true,
        "options": {
          "systemMessage": "=You are an AI assistant responding on behalf of a Udemy instructor. Your role is to handle student Q&A messages professionally and efficiently.\n\n## Instructor Information\n- **Name:** {{ $('Global Constants').first().json.constants.instructor_name }}\n- **Bio:** {{ $('Global Constants').first().json.constants.instructor_bio }}\n\n## Your Task\nYou will receive:\n1. The latest student message requiring a response\n2. Previous message context (if available)\n\nYou must decide whether to respond directly OR escalate to the instructor.\n\n## Escalation Rules (Instructor Required ~20% of messages)\n\n### PRIORITY: Sales Opportunities\nALWAYS escalate when you detect a potential sales opportunity, including:\n- Student expresses interest in related topics not covered in the current course\n- Student asks about other courses the instructor offers\n- Student mentions wanting to go deeper or advance their skills\n- Student asks for recommendations on \"what to learn next\"\n- Student praises the course and expresses enthusiasm for more content\n- Student mentions career goals that could align with other offerings\n- Student asks about certifications, career paths, or comprehensive learning plans\n- Any opening where the instructor could naturally recommend their other courses or services\n\nThese are high-value interactions. The instructor's personal touch converts interest into enrollments.\n\n### Other Escalation Triggers\nESCALATE to the instructor when the message:\n- Asks personal questions about the instructor's background, experience, or life beyond the bio\n- Requests private coaching, consulting, or 1-on-1 mentorship\n- Asks about pricing, refunds, or payment issues\n- Requests course content changes, additions, or custom materials\n- Involves complaints or disputes requiring human judgment\n- Asks for contact information, social media, or communication outside Udemy\n- References information about the instructor's other services/offerings you don't have access to\n- Contains sensitive personal disclosures requiring empathetic human response\n- Is genuinely ambiguous AFTER the student has provided details—meaning you cannot determine what they're asking even with full context (note: vague openers like \"I have a question\" are NOT ambiguous; just ask for clarification)\n\n## Auto-Response Rules (AI Handles ~80% of messages)\nRESPOND directly when the message:\n- Asks technical questions related to course content (use Jina Search to verify/supplement)\n- Seeks clarification on concepts taught in the course\n- Is a general greeting, thank you, or positive feedback WITHOUT expressed interest in more content\n- Asks about general best practices in the subject domain\n- Requests resource recommendations for FREE documentation, tools, or further reading\n- Reports minor technical issues with videos/quizzes (provide standard troubleshooting)\n- Asks \"how to\" questions within the course's subject matter\n- Is a simple follow-up to a previous exchange you can contextually address\n\n### Conversation Openers & Incomplete Messages\nRESPOND directly (do not escalate) when the message:\n- Is a greeting with a vague or unspecified question (\"Hi, I had a question about...\")\n- Says they have a question but doesn't actually ask it yet\n- Is an introduction without specific content\n\nFor these, respond warmly and invite them to share their question. Keep it brief and friendly, e.g.:\n\"Hey! Happy to help—what's your question?\"\n\nDo NOT escalate these as \"ambiguous.\" They're just incomplete—prompt for details.\n\n## Response Guidelines\nWhen you respond:\n1. **Length:** 10-100 words. Match complexity to the question—simple questions get concise answers; detailed technical questions get fuller explanations. Never pad responses unnecessarily.\n2. **Tone:** Professional yet warm and approachable. You represent a friendly expert instructor.\n3. **Style Matching:** Mirror the formality level of the student and previous context, but always maintain professionalism. If the student is overly casual or uses slang, elevate slightly while remaining friendly.\n4. **Technical Accuracy:** Use Jina Search to verify technical information. Never guess on technical details.\n5. **No Fluff:** Avoid generic filler phrases like \"Great question!\" or \"I'm happy to help!\" unless the context genuinely calls for warmth.\n6. **Sign-off:** Do not include a sign-off or signature. The platform handles that.\n7. **Output Format:** Wrap your response in HTML. Use <p> tags for paragraphs and <br> for line breaks where needed. Do not use markdown formatting.\n8. **No Bullet Points:** Never use bullet points, numbered lists, or option menus in responses unless the student explicitly asks for a list.\n\n## Tools Available\n- **Jina Search (Research Mode enabled):** For technical queries, documentation lookups, and verifying current information. Research Mode allows for deeper, more comprehensive searches—use it proactively for any technical question to ensure accuracy."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        1904,
        64
      ],
      "id": "f3b24600-e514-496a-9051-1a2c2914b413",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.randomString }}",
        "sessionTTL": 7200,
        "contextWindowLength": 15
      },
      "type": "@n8n/n8n-nodes-langchain.memoryRedisChat",
      "typeVersion": 1.5,
      "position": [
        1968,
        240
      ],
      "id": "1da6129b-fa65-4e51-9daf-d52c934e5ee0",
      "name": "Redis Chat Memory",
      "credentials": {
        "redis": {
          "id": "w1nYJN6Fl7n4lwSC",
          "name": "Redis (EXPIRES)"
        }
      }
    },
    {
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "let characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\nlet result = '';\nlet length = 48; // Desired length of the random string\nfor (let i = 0; i < length; i++) {\n  result += characters.charAt(Math.floor(Math.random() * characters.length));\n}\nreturn { randomString: result };"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1696,
        64
      ],
      "id": "1ec7798d-ff55-4978-98e3-adfc56580bc7",
      "name": "RandomNumberGenerator1"
    },
    {
      "parameters": {
        "model": "mistral-large-latest",
        "options": {
          "temperature": 0.5,
          "topP": 0.9
        }
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatMistralCloud",
      "typeVersion": 1,
      "position": [
        1904,
        -112
      ],
      "id": "417231f4-0a1b-4f0b-9cd1-dde5311daf08",
      "name": "Mistral Cloud Chat Model",
      "credentials": {
        "mistralCloudApi": {
          "id": "feG0p0tu1GwMlA1h",
          "name": "Mistral Cloud Account (Personal)"
        }
      }
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-5-20250929",
          "cachedResultName": "Claude Sonnet 4.5"
        },
        "options": {
          "thinking": true
        }
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1.3,
      "position": [
        1840,
        240
      ],
      "id": "1e66ac77-1019-4295-b2b1-007429f6d192",
      "name": "Anthropic Chat Model",
      "credentials": {
        "anthropicApi": {
          "id": "5pMiFSPZL2r44q7L",
          "name": "Anthropic Account (Personal)"
        }
      }
    },
    {
      "parameters": {
        "resource": "research",
        "researchQuery": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Research_Query', ``, 'string') }}",
        "simplify": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Simplify', ``, 'boolean') }}",
        "options": {
          "maxReturnedSources": 8
        },
        "requestOptions": {}
      },
      "type": "n8n-nodes-base.jinaAiTool",
      "typeVersion": 1,
      "position": [
        2048,
        320
      ],
      "id": "1b7fb1bd-9d57-4c5b-abbe-6f24f8e16c00",
      "name": "Perform deep research in Jina AI",
      "credentials": {
        "jinaAiApi": {
          "id": "d2r6p11EaWTJO2IU",
          "name": "Jina AI account"
        }
      }
    },
    {
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"escalate_to_instructor\": {\n      \"type\": \"boolean\",\n      \"description\": \"True if the message requires instructor attention, false if AI can handle it\"\n    },\n    \"escalation_reason\": {\n      \"type\": \"string\",\n      \"enum\": [\n        \"sales_opportunity\",\n        \"personal_question\",\n        \"coaching_request\",\n        \"payment_or_refund\",\n        \"content_change_request\",\n        \"complaint_or_dispute\",\n        \"contact_request\",\n        \"unknown_instructor_info\",\n        \"sensitive_disclosure\",\n        \"ambiguous_message\",\n        \"not_applicable\"\n      ],\n      \"description\": \"Reason for escalation. Use 'not_applicable' when escalate_to_instructor is false. 'sales_opportunity' takes priority.\"\n    },\n    \"response\": {\n      \"type\": \"string\",\n      \"description\": \"The AI-generated response to send to the student. Empty string if escalated to instructor\"\n    },\n    \"confidence\": {\n      \"type\": \"string\",\n      \"enum\": [\"high\", \"medium\", \"low\"],\n      \"description\": \"Confidence level in the response or escalation decision\"\n    },\n    \"tools_used\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\",\n        \"enum\": [\"jina_search\", \"none\"]\n      },\n      \"description\": \"Which tools were used to formulate the response\"\n    }\n  },\n  \"required\": [\"escalate_to_instructor\", \"escalation_reason\", \"response\", \"confidence\", \"tools_used\"]\n}",
        "autoFix": true
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        2016,
        -112
      ],
      "id": "0e03c458-6c93-42e4-8c13-1ab3ea9b2da4",
      "name": "Structured Output Parser"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        2016,
        -256
      ],
      "id": "9c139243-53b1-4ef6-b384-0359920a01c9",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "OjRKrQXB019XKwdP",
          "name": "OpenAi Account (Personal)"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "0fde09e9-8ed3-404b-b585-bb5ab9e96822",
              "leftValue": "={{ $json.output.escalate_to_instructor }}",
              "rightValue": false,
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        2336,
        64
      ],
      "id": "270abee7-56b9-4130-8d58-deff8aeee1b3",
      "name": "Escalate To Instructor?"
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "={{ $('Global Constants').first().json.constants.sheetid }}",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "={{ $('Global Constants').first().json.constants.sheet_name }}",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "ID": "={{ $('Append row in sheet').item.json.ID }}",
            "STATUS": "={{ $('Global Constants').first().json.constants.status3 }}",
            "Responded (Y/N)": "N",
            "Further Action (Y/N)": "Y"
          },
          "matchingColumns": [
            "ID"
          ],
          "schema": [
            {
              "id": "ID",
              "displayName": "ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "STATUS",
              "displayName": "STATUS",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "DATE",
              "displayName": "DATE",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "User",
              "displayName": "User",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Message Content",
              "displayName": "Message Content",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Previous Interactions (Aggregated)",
              "displayName": "Previous Interactions (Aggregated)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Response",
              "displayName": "Response",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Vetting",
              "displayName": "Vetting",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Pass/Fail",
              "displayName": "Pass/Fail",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Responded (Y/N)",
              "displayName": "Responded (Y/N)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Further Action (Y/N)",
              "displayName": "Further Action (Y/N)",
              "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": [
        2704,
        -240
      ],
      "id": "3b71b238-8ae2-4f00-881e-94389a6f2931",
      "name": "Update row in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "wZJh4ACm1MD5wdQ9",
          "name": "Google Sheet (Admin Account - Nandy Cyber Success)"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "nandy@mssecurityworkshop.com",
        "subject": "Udemy Student Message Requiring Instructor Response",
        "message": "=Hi Nandy\n\nYou have a student message that requires your input on Udemy and the system has deemed as being inappropriate to be answered by an LLM.\n\nMessage\n{{ $('Append row in sheet').item.json['Message Content'] }}\n\nURL\nhttps://www.udemy.com/instructor/communication/messages",
        "options": {
          "ccList": "hesham@betterbrainlab.org",
          "senderName": "Udemy API Messanger by Hesham"
        }
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        2944,
        -240
      ],
      "id": "cef3dfdf-2d52-4b27-85a6-3d028d98eebb",
      "name": "Send a message",
      "webhookId": "aa71c23e-f433-4f54-a7ab-a8e57c7debd3",
      "credentials": {
        "gmailOAuth2": {
          "id": "Vn1zFRIxiwOZxM5S",
          "name": "Admin Gmail Account"
        }
      }
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "={{ $('Global Constants').first().json.constants.sheetid }}",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "={{ $('Global Constants').first().json.constants.sheet_name }}",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "ID": "={{ $('Append row in sheet').item.json.ID }}",
            "STATUS": "={{ $('Global Constants').item.json.constants.status5 }}",
            "Responded (Y/N)": "Y",
            "Further Action (Y/N)": "N",
            "Response": "={{ $json.output.response }}",
            "Vetting": "={{ $json.output.confidence }}"
          },
          "matchingColumns": [
            "ID"
          ],
          "schema": [
            {
              "id": "ID",
              "displayName": "ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "STATUS",
              "displayName": "STATUS",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "DATE",
              "displayName": "DATE",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "User",
              "displayName": "User",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Message Content",
              "displayName": "Message Content",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Previous Interactions (Aggregated)",
              "displayName": "Previous Interactions (Aggregated)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Response",
              "displayName": "Response",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Vetting",
              "displayName": "Vetting",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Pass/Fail",
              "displayName": "Pass/Fail",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Responded (Y/N)",
              "displayName": "Responded (Y/N)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Further Action (Y/N)",
              "displayName": "Further Action (Y/N)",
              "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": [
        2672,
        240
      ],
      "id": "ed5818ba-abf6-42bd-84d8-5b1dc62f94d2",
      "name": "Update row in sheet1",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "wZJh4ACm1MD5wdQ9",
          "name": "Google Sheet (Admin Account - Nandy Cyber Success)"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://www.udemy.com/instructor-api/v1/message-threads/{{ $('Loop Over Items').item.json.id }}/messages/",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "message_thread_id",
              "value": "={{ $json.ID }}"
            },
            {
              "name": "content",
              "value": "={{ $json.Response }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        2912,
        240
      ],
      "id": "65ec9f7d-2156-4e29-8d8f-73ff67e1e826",
      "name": "HTTP Request2",
      "credentials": {
        "httpHeaderAuth": {
          "id": "XJXjMoya5rTlt7RT",
          "name": "Udemy Credentials (Nandy Bo | Nandy Cyber Success)"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Global Constants",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Global Constants",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Global Constants": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request1": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "RandomNumberGenerator1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "RandomNumberGenerator1": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Redis Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Cloud Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 1
          }
        ]
      ]
    },
    "Perform deep research in Jina AI": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Structured Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Escalate To Instructor?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Escalate To Instructor?": {
      "main": [
        [
          {
            "node": "Update row in sheet",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update row in sheet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row in sheet": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row in sheet1": {
      "main": [
        [
          {
            "node": "HTTP Request2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "availableInMCP": false
  },
  "versionId": "38ca4cd4-74bb-441f-b85e-1c832229d91d",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "5ff5a5992c4c72af22abbdcfa574d8cdf93dc14d57eb9f66e3d9ef2a3e2dbb6c"
  },
  "id": "tFgDZR44r9YwloBKgHmMn",
  "tags": []
}