{
  "name": "Change Request Workflow Convert",
  "nodes": [
    {
      "parameters": {
        "model": "qwen/qwen3-coder-next",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "typeVersion": 1,
      "position": [
        448,
        528
      ],
      "id": "0c7b334b-db7a-49bc-8699-5ea55e99757f",
      "name": "OpenRouter Chat Model1",
      "credentials": {
        "openRouterApi": {
          "id": "baaHEuVk7u6Z0Liu",
          "name": "OpenRouter account"
        }
      }
    },
    {
      "parameters": {
        "formTitle": "Change Request",
        "formFields": {
          "values": [
            {
              "fieldLabel": "URL",
              "requiredField": true
            },
            {
              "fieldLabel": "Describe the change",
              "fieldType": "textarea",
              "requiredField": true
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.3,
      "position": [
        -32,
        400
      ],
      "id": "70a6833f-1c84-4118-a4d5-1e687750e3d9",
      "name": "On form submission",
      "webhookId": "1dfad330-6b3a-433e-bc1f-b8695d7eff47"
    },
    {
      "parameters": {
        "toolDescription": "Convert tool to create experiences and update variations",
        "method": "POST",
        "url": "=http://192.168.1.204:8009/convert/experiences",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('JSON', ``, 'json') }}",
        "options": {
          "response": {
            "response": {
              "neverError": true,
              "responseFormat": "text"
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.2,
      "position": [
        640,
        1904
      ],
      "id": "7feb3797-1088-4873-b731-232d2aad6bed",
      "name": "Convert Tool",
      "credentials": {
        "httpBearerAuth": {
          "id": "cuom3Yasd5oKN3Ak",
          "name": "MCPO Auth"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{Math.random().toString(36).substr(2, 10);}}"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        496,
        1904
      ],
      "id": "adcab605-60c5-4f25-89f1-c722015aa6b3",
      "name": "Simple Memory4"
    },
    {
      "parameters": {
        "model": "qwen/qwen3-coder-next",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "typeVersion": 1,
      "position": [
        832,
        1024
      ],
      "id": "13699dc8-4dc2-4614-8854-58d7f2d84e6c",
      "name": "OpenRouter Chat Model",
      "credentials": {
        "openRouterApi": {
          "id": "baaHEuVk7u6Z0Liu",
          "name": "OpenRouter account"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "80908"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        880,
        1152
      ],
      "id": "b57faf18-0602-4aa8-862c-26c455b79c6b",
      "name": "Simple Memory5"
    },
    {
      "parameters": {
        "jsonSchemaExample": "{\n  \"js\":\"console.log()\",\n  \"experience_id\":1234,\n  \"variation_ids\":[1341,1231]\n}"
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        976,
        1008
      ],
      "id": "e5fc9cae-6b24-4470-bbf0-51ac4a144bb8",
      "name": "Structured Output Parser2"
    },
    {
      "parameters": {
        "model": "openai/gpt-5-nano",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "typeVersion": 1,
      "position": [
        960,
        560
      ],
      "id": "32dda82d-2b13-4337-8f6f-009075668e5e",
      "name": "OpenRouter Chat Model3",
      "credentials": {
        "openRouterApi": {
          "id": "baaHEuVk7u6Z0Liu",
          "name": "OpenRouter account"
        }
      }
    },
    {
      "parameters": {
        "url": "={{ $json.URL }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        240,
        400
      ],
      "id": "35c8bd33-ac8e-4d7e-8571-f91eca3b9ab7",
      "name": "Fetch HTML"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=You are a developer who specialises in working with client side experimentation tools. Receive HTML of a page, and a change request. Return Javascript to use in browser console to make the change.\n\n%HTML%\n{{ $json.data }}\n\n%CHANGE REQUEST%\n{{ $('On form submission').item.json['Describe the change'] }}\n\n%YOUR JAVASCRIPT OUTPUT%\n",
        "batching": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.7,
      "position": [
        448,
        400
      ],
      "id": "56a063b7-007e-4114-aaca-57f638ea9816",
      "name": "Create Javascript"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "fe0f61ef-49b9-4881-b697-ff50991410f0",
              "name": "body.page_url",
              "value": "={{ $('On form submission').item.json.URL }}",
              "type": "string"
            },
            {
              "id": "0f34ed62-d18b-49f7-972e-0592a6d76675",
              "name": "body.change",
              "value": "={{ $('Create Javascript').item.json.text }}",
              "type": "string"
            },
            {
              "id": "8eef5258-ace1-4c40-81cb-3657feae2b11",
              "name": "account_id",
              "value": 100414230,
              "type": "number"
            },
            {
              "id": "a7edc0a9-2652-4973-8858-7b4ae4720cb7",
              "name": "project_id",
              "value": "100416952",
              "type": "string"
            },
            {
              "id": "4e532731-b5aa-4e1c-ba0a-0d1cea052e6f",
              "name": "experience_name",
              "value": "={{ $json.output.name }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        304,
        784
      ],
      "id": "2bf54eb3-8cd5-4e5d-a455-a60337000554",
      "name": "Set variables"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "http://192.168.1.204:8009/convert/experiences",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"action\": \"create\",\n  \"path\": {\n    \"account_id\": {{ $json.account_id }},\n    \"project_id\": {{ $json.project_id }}\n  },\n  \"body\": {\n    \"name\": \"{{ $json.experience_name }}\",\n    \"type\": \"a/b\",\n    \"url\": \"{{ $json.body.page_url }}\"\n  }\n}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "text"
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        656,
        784
      ],
      "id": "aad13115-0879-4a36-9347-7a74f1c7d790",
      "name": "Create Experience"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Extract only the javascript from the following:\n{{ $('Set variables').item.json.body.change }}\n\nAnd extract the main ID and Variation IDs from the following:\n{{ $json.data }}\n\n",
        "hasOutputParser": true,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        800,
        784
      ],
      "id": "c7d7bdf3-4d1c-4141-ba4b-8a32f7540924",
      "name": "Get IDs for Experience and Variation"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "http://192.168.1.204:8009/convert/experiences",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "Bearer aIVM3zXDMoUpamwWV8Uu2kBo3gJ6ViI1"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"action\": \"update_variation\",\n  \"path\": {\n    \"account_id\": 100414230,\n    \"project_id\": 100416952,\n    \"experience_id\": {{ $json.output.experience_id }},\n    \"variation_id\": {{ $json.output.variation_ids[1] }}\n  },\n  \"body\": {\n    \"changes\": [\n      {\n        \"type\": \"customCode\",\n        \"data\": {\n          \"js\": {{ JSON.stringify($json.output.js)}},\n          \"css\": \"\"\n        }\n      }\n    ]\n  }\n}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "text"
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1072,
        784
      ],
      "id": "0a44bf17-3890-4973-8dc7-d9c817a1641b",
      "name": "Create Variation"
    },
    {
      "parameters": {
        "jsonSchemaExample": "{\n\t\"name\": \"Name of the experiment\"\n}"
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        1104,
        576
      ],
      "id": "170bab24-8b59-4275-9bb6-6f599432fd65",
      "name": "Structured Output Parser1"
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "123124"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        1024,
        640
      ],
      "id": "adcd5b92-9cf1-4056-95c9-230361d4dd31",
      "name": "Simple Memory1"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=%INPUT%\nGive me a simple name for an A/B experiment that does:\n\nRe-order panels on page so the last panel is first\n\n%OUTPUT%\n{\n\"name\": \n\"Last panel first\"\n}\n\n%INPUT%\nGive me a simple name for an A/B experiment that does:\n\nMake the headline text bold to emphasise it.\n\n%OUTPUT%\n{\n\"name\": \n\"Headline text emphasis\"\n}\n\n\n%INPUT%\nGive me a simple name for an A/B experiment that does:\n\nHide the testimonials section of the page completely.\n\n%OUTPUT%\n{\n\"name\": \n\"Hide testimonials\"\n}\n\n\n%INPUT%\nGive me a simple name for an A/B experiment that does:\n\n{{ $('On form submission').item.json['Describe the change'] }}\n%OUTPUT%\n",
        "hasOutputParser": true,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        960,
        400
      ],
      "id": "6f82a671-cd1e-4fc8-a6ae-f9f3aef88735",
      "name": "Name the experiment"
    }
  ],
  "pinData": {
    "Create Experience": [
      {
        "json": {
          "name": "First item",
          "code": 1
        }
      },
      {
        "json": {
          "name": "Second item",
          "code": 2
        }
      }
    ]
  },
  "connections": {
    "OpenRouter Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Create Javascript",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Fetch HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert Tool": {
      "ai_tool": [
        []
      ]
    },
    "Simple Memory4": {
      "ai_memory": [
        []
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Get IDs for Experience and Variation",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory5": {
      "ai_memory": [
        [
          {
            "node": "Get IDs for Experience and Variation",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser2": {
      "ai_outputParser": [
        [
          {
            "node": "Get IDs for Experience and Variation",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model3": {
      "ai_languageModel": [
        [
          {
            "node": "Name the experiment",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Fetch HTML": {
      "main": [
        [
          {
            "node": "Create Javascript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Javascript": {
      "main": [
        [
          {
            "node": "Name the experiment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set variables": {
      "main": [
        [
          {
            "node": "Create Experience",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Experience": {
      "main": [
        [
          {
            "node": "Get IDs for Experience and Variation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get IDs for Experience and Variation": {
      "main": [
        [
          {
            "node": "Create Variation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Variation": {
      "main": [
        []
      ]
    },
    "Name the experiment": {
      "main": [
        [
          {
            "node": "Set variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "Name the experiment",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory1": {
      "ai_memory": [
        [
          {
            "node": "Name the experiment",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "338b60c2-f8a1-495b-9300-859855d26353",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "a7d3c8fee44ed6dfa5d3bf2eca37e2240651cc218f5d2ad518615bd97f803884"
  },
  "id": "qZvi1rMIXG8jw2DU",
  "tags": []
}