{
  "name": "Build a multichannel customer support AI assistant with Chatwoot & OpenRouter",
  "nodes": [
    {
      "id": "your-id",
      "name": "Chatwoot Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        48,
        -48
      ]
    },
    {
      "id": "2aed8dcb-506a-4ede-a708-06b8c3087461",
      "name": "Squize Webhook Data",
      "type": "n8n-nodes-base.set",
      "position": [
        272,
        -48
      ]
    },
    {
      "id": "c8691100-44a3-47b1-9724-662da1875ad2",
      "name": "Check If Incoming Message",
      "type": "n8n-nodes-base.if",
      "position": [
        496,
        -48
      ]
    },
    {
      "id": "04d24443-a918-42a3-b96b-ae0cf9d93082",
      "name": "Load Chatwoot Conversation History",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1024,
        -208
      ]
    },
    {
      "id": "3d5acbb7-88ee-4758-9130-378986cc6713",
      "name": "Process Loaded History",
      "type": "n8n-nodes-base.code",
      "position": [
        1248,
        -208
      ]
    },
    {
      "id": "f8992fc5-23c5-41f7-9e42-66a6a24dd07e",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        1904,
        96
      ]
    },
    {
      "id": "0ba89367-f064-4a1d-9442-debb80b00228",
      "name": "Chatwoot Assistant",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1952,
        -48
      ]
    },
    {
      "id": "7fe05d5a-b8ac-4bab-84b7-cae0dee8c9f1",
      "name": "Send Message",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2576,
        -48
      ]
    },
    {
      "id": "e60f34f5-e688-44b6-8d96-b323cfdb0bf2",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -560
      ],
      "parameters": {
        "width": 476,
        "height": 1344,
        "content": "## Multichannel AI Assistant Demo for Chatwoot\n\n### This simple n8n template demonstrates a Chatwoot integration that can:\n\n* Receive new messages via a webhook.\n* Retrieve conversation history.\n* Pro"
      }
    },
    {
      "id": "679990cb-6239-4f4f-87fc-b94f0535f334",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -288
      ],
      "parameters": {
        "width": 648,
        "height": 476,
        "content": "## Receiving and Preparing Data\n\nThis part of the workflow **receives data** from the webhook trigger. This data is immediately filtered to remove irrelevant fields and keep only the necessary informa"
      }
    },
    {
      "id": "48c75b75-beaa-43c8-b758-72b0f614641c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        -528
      ],
      "parameters": {
        "width": 536,
        "height": 508,
        "content": "## Load and Process Conversation History\n\nThis part of the workflow **retrieves the full conversation history** from the API using an `HTTP Request` node. A `Code` node then extracts the `payload` arr"
      }
    },
    {
      "id": "c8752288-6a02-41a1-9443-b07f5bb4044c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1824,
        -432
      ],
      "parameters": {
        "width": 440,
        "height": 684,
        "content": "## Simple AI Assistant\n\nThis demo provides a basic example of how to structure `system` and `user` messages in `Basic LLM Node`. This method ensures the AI's response stays within the context of a pro"
      }
    },
    {
      "id": "dd325687-7207-44f2-be87-3c88d3499f09",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2464,
        -384
      ],
      "parameters": {
        "width": 312,
        "height": 492,
        "content": "## Send AI Response to Chatwoot\n\nThis final `HTTP Request` node **sends the AI-generated response** back to the correct conversation in Chatwoot.\n\nTo do this, it uses the `account_id` and `conv_id` va"
      }
    }
  ],
  "connections": {
    "Chatwoot Webhook": {
      "main": [
        [
          {
            "node": "Squize Webhook Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Chatwoot Assistant": {
      "main": [
        [
          {
            "node": "Send Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Squize Webhook Data": {
      "main": [
        [
          {
            "node": "Check If Incoming Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Chatwoot Assistant",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Process Loaded History": {
      "main": [
        [
          {
            "node": "Chatwoot Assistant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check If Incoming Message": {
      "main": [
        [
          {
            "node": "Load Chatwoot Conversation History",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Load Chatwoot Conversation History": {
      "main": [
        [
          {
            "node": "Process Loaded History",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}