n8n: Chatbot can query data from the CRM and log support requests

n8n: Chatbot can query data from the CRM and log support requests

Chatbots are actually cool, but they are also annoying when they are only generally polite and don't know useful information or aren't meaningful regarding relevant things.

You can change this with Tool Support. In this video, I explain how to connect a chatbot with the Launix system.

Here is the code to copy to n8n:

{
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.3,
      "position": [
        0,
        0
      ],
      "id": "0f882a01-7435-4146-a2e6-ac10188a3a28",
      "name": "When chat message received",
      "webhookId": "5e92851c-6277-4cda-af83-1cf819859ac9"
    },
    {
      "parameters": {
        "options": {
          "systemMessage": "When you extract data from customers and you know a customer ID, you can build a link like [customer name](https://launix.de/fop/crm-neu/Tables/Kunde/view?id=ID)"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        208,
        0
      ],
      "id": "c6286e3b-94bb-4761-b880-c59e8ef741fc",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        80,
        208
      ],
      "id": "a45c8e47-dffa-497e-8e97-301a810ed811",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "bvaEo3Nx6CCGnXwt",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        224,
        208
      ],
      "id": "2e2bc98a-e1d2-4eb9-a6c2-ddbe425ad1b2",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "wenn informationen über kunden geholt werden sollen",
        "table": {
          "__rl": true,
          "value": "Kunde",
          "mode": "list",
          "cachedResultName": "Kunde (kunde)"
        },
        "operation": "list",
        "filterparams": "={{ $fromAI('Filter_and_Sort_Parameters', `json object with the following keys allowing to filter:\n - filter_kunde_name for surnames\n - filter_kunde_vorname for first names\n - limit: 1 to retrieve only one item\n - filter_kunde_firma to filter for company\nempty json object {} to fetch all`, 'string') }}"
      },
      "type": "n8n-nodes-launix.launixNodeTool",
      "typeVersion": 1,
      "position": [
        416,
        208
      ],
      "id": "0398b050-1365-4274-bc14-76bdc1dabd55",
      "name": "Daten abfragen",
      "credentials": {
        "launixCredentialsApi": {
          "id": "Uco1GL0LH7PpNaTY",
          "name": "Launix Credentials account"
        }
      }
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "when something is told that our company should know about the conversation",
        "table": {
          "__rl": true,
          "value": "KundeHistory",
          "mode": "list",
          "cachedResultName": "Kommunikationsereignis (kundeHistory)"
        },
        "operation": "create",
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "notiz": "={{ $fromAI('Notiz__notiz_', `write down important information about what the customer needs`, 'string') }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "date",
              "displayName": "Datum (date)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "readOnly": false,
              "removed": true
            },
            {
              "id": "user",
              "displayName": "Mitarbeiter (user)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "readOnly": false,
              "removed": true
            },
            {
              "id": "parent",
              "displayName": "Kunde (parent)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "readOnly": false,
              "removed": true
            },
            {
              "id": "aktion",
              "displayName": "Aktion (aktion)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "readOnly": false,
              "removed": true
            },
            {
              "id": "notiz",
              "displayName": "Notiz (notiz)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "readOnly": false,
              "removed": false
            },
            {
              "id": "to-campaign",
              "displayName": "Kampagne (to-campaign)",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "readOnly": false,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "n8n-nodes-launix.launixNodeTool",
      "typeVersion": 1,
      "position": [
        576,
        240
      ],
      "id": "110afb33-35d6-459e-b113-10605f6c9374",
      "name": "Notizen anlegen",
      "credentials": {
        "launixCredentialsApi": {
          "id": "Uco1GL0LH7PpNaTY",
          "name": "Launix Credentials account"
        }
      }
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Daten abfragen": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Notizen anlegen": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "5d646b97a6f5b390970161e7d5b6c2999c720df20b57515df0439cbab498ca6c"
  }
}
Категории