{
  "id": "YyMOJKUM7DmZpySf",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "OctoPrint Manager",
  "tags": [],
  "nodes": [
    {
      "id": "17588807-7232-48f2-9746-9e5ebfb4370f",
      "name": "When clicking \u2018Test workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -360,
        100
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "338329b4-f691-4fac-bdab-ea5cd74add80",
      "name": "Stage OctoPrint Job",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -80,
        100
      ],
      "parameters": {
        "url": "http://OctoPrint-IP/api/job",
        "method": "POST",
        "options": {},
        "jsonBody": "{\n  \"command\": \"start\"\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "Content-Type: application/json"
            },
            {
              "name": "X-Api-Key",
              "value": "OctoPrint-API-Key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "c909da95-6a3e-4647-9da7-fcc375bcc517",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        372,
        460
      ],
      "parameters": {
        "options": {}
      },
      "retryOnFail": true,
      "typeVersion": 1.9
    },
    {
      "id": "9579f327-f2ec-456f-96aa-72693a0b2619",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -140,
        680
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "6ce7ede9-b95e-4e6a-ae54-84336956fc53",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -20,
        680
      ],
      "parameters": {
        "sessionKey": "Test",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "9cd904a0-90c7-42b6-be12-38d5be921881",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -360,
        460
      ],
      "parameters": {
        "public": true,
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "99e83e4f-5528-4fa4-9680-3f3126da6d26",
      "name": "List OctoPrint Jobs",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        100,
        740
      ],
      "parameters": {
        "url": "http://OctoPrint-IP/api/files",
        "options": {},
        "sendHeaders": true,
        "toolDescription": "Makes an HTTP request and returns the list of OctoPrint jobs available for print",
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Api-Key",
              "value": "OctoPrint-API-Key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "fc7e5787-2045-4fed-888b-9abed6705706",
      "name": "Get OctoPrint Printer Status",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        220,
        680
      ],
      "parameters": {
        "url": "http://OctoPrint-IP/api/printer",
        "options": {},
        "sendHeaders": true,
        "toolDescription": "Makes an HTTP request and returns the OctoPrint Printer Status",
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Api-Key",
              "value": "OctoPrint-API-Key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f113838d-08db-4f2c-a9da-03abf6274db0",
      "name": "Pause OctoPrint Job",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        340,
        740
      ],
      "parameters": {
        "url": "http://OctoPrint-IP/api/job",
        "method": "POST",
        "options": {},
        "jsonBody": "{ \"command\": \"pause\", \"action\": \"pause\" }",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "toolDescription": "Makes an HTTP request and pauses the current print job",
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Api-Key",
              "value": "OctoPrint-API-Key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "63ffabe8-85df-45a7-a643-8ee73515805c",
      "name": "Cancel OctoPrint Job",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        460,
        680
      ],
      "parameters": {
        "url": "http://OctoPrint-IP/api/job",
        "method": "POST",
        "options": {},
        "jsonBody": "{ \"command\": \"cancel\" }",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "toolDescription": "Makes an HTTP request and cancel the current print job",
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Api-Key",
              "value": "OctoPrint-API-Key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "7b9c3760-a078-4215-88be-83f66d262aaa",
      "name": "Resume OctoPrint Job",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        580,
        740
      ],
      "parameters": {
        "url": "http://OctoPrint-IP/api/job",
        "method": "POST",
        "options": {},
        "jsonBody": "{ \"command\": \"pause\", \"action\": \"resume\" }",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "toolDescription": "Makes an HTTP request and resume the current print job",
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Api-Key",
              "value": "OctoPrint-API-Key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "a78d26d9-dd3c-4282-9c2b-e09abbbe2a3a",
      "name": "Connect OctoPrint to Printer",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        700,
        680
      ],
      "parameters": {
        "url": "http://OctoPrint-IP/api/connection",
        "method": "POST",
        "options": {},
        "jsonBody": "{\n  \"command\": \"connect\",\n  \"port\": \"/dev/ttyUSB0\",\n  \"baudrate\": 115200,\n  \"printerProfile\": \"_default\"\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "toolDescription": "Makes an HTTP request and returns the OctoPrint Printer Status",
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Api-Key",
              "value": "OctoPrint-API-Key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "b998d0d3-1263-4ddd-929d-e2c22df66b0e",
      "name": "Get OctoPrint Printer Connection Status",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        820,
        760
      ],
      "parameters": {
        "url": "http://OctoPrint-IP/api/connection",
        "options": {},
        "sendHeaders": true,
        "toolDescription": "Makes an HTTP request and returns the OctoPrint Printer Status",
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Api-Key",
              "value": "OctoPrint-API-Key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "26d5c411-efeb-484a-a81a-3139d8d44f54",
      "name": "Start OctoPrint Job",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        940,
        680
      ],
      "parameters": {
        "url": "http://OctoPrint-IP/api/job",
        "method": "POST",
        "options": {},
        "jsonBody": "{\n  \"command\": \"start\"\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "toolDescription": "Makes an HTTP request and start the next print job.",
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Api-Key",
              "value": "OctoPrint-API-Key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "22aa2ad2-0401-45a5-b718-c33c86825d6a",
      "name": "Get Current Print Job Details",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        200,
        880
      ],
      "parameters": {
        "url": "http://OctoPrint-IP/api/job",
        "options": {},
        "sendHeaders": true,
        "toolDescription": "Makes an HTTP request and returns the current job details from the 3d printer",
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Api-Key",
              "value": "OctoPrint-API-Key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d207658e-eef2-4b17-b886-e80e5d81620f",
      "name": "Discord",
      "type": "n8n-nodes-base.discord",
      "position": [
        840,
        380
      ],
      "parameters": {
        "content": "={{ $json.output }}",
        "options": {},
        "authentication": "webhook"
      },
      "credentials": {
        "discordWebhookApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "520b7a27-8a5a-4df1-b21d-f0e8bb36b1fc",
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Discord",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "List OctoPrint Jobs": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Pause OctoPrint Job": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Start OctoPrint Job": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Cancel OctoPrint Job": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Resume OctoPrint Job": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Connect OctoPrint to Printer": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get OctoPrint Printer Status": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get Current Print Job Details": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Test workflow\u2019": {
      "main": [
        [
          {
            "node": "Stage OctoPrint Job",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get OctoPrint Printer Connection Status": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}