Workflow n8n

Automatisation Chatbot avec n8n : réponses instantanées AI

  • Ce workflow n8n est conçu pour automatiser les interactions avec un chatbot, permettant ainsi d'offrir des réponses instantanées et pertinentes aux utilisateurs. Dans un contexte où les entreprises cherchent à améliorer leur service client, ce type d'automatisation n8n est essentiel pour gérer les demandes en temps réel, réduire les temps d'attente et offrir une expérience utilisateur fluide. Les cas d'usage incluent les services d'assistance, les plateformes de e-commerce et toute entreprise souhaitant intégrer un support client automatisé.
  • Le workflow commence par un déclencheur de type Webhook, qui reçoit les messages des utilisateurs via la plateforme de messagerie choisie. Ensuite, il utilise le nœud 'AI Agent' pour traiter le texte et générer une réponse appropriée. Pour cela, il fait appel au modèle de chat Azure OpenAI, qui permet d'obtenir des réponses basées sur l'intelligence artificielle. Si le message reçu est un texte, le flux continue avec le nœud 'Format Reply' pour structurer la réponse avant de l'envoyer via le nœud 'Line Chatbot'. En parallèle, des nœuds de type 'Sticky Note' sont utilisés pour visualiser et suivre le processus d'automatisation.
  • Les bénéfices business de ce workflow incluent une réduction significative des coûts opérationnels liés au support client, une augmentation de la satisfaction client grâce à des réponses rapides et précises, et une meilleure gestion des flux de communication. En intégrant cette automatisation n8n, les entreprises peuvent se concentrer sur des tâches à plus forte valeur ajoutée tout en maintenant un service client de qualité.
Tags clés :automatisationchatbotn8nsupport clientIA
Catégorie: Webhook · Tags: automatisation, chatbot, n8n, support client, IA0

Workflow n8n chatbot, support client : vue d'ensemble

Schéma des nœuds et connexions de ce workflow n8n, généré à partir du JSON n8n.

Workflow n8n chatbot, support client : détail des nœuds

  • Loading Animation

    Ce noeud effectue une requête HTTP pour charger une animation.

  • ReplyMessage - Not supported

    Ce noeud envoie une requête HTTP pour répondre à un message non supporté.

  • AI Agent

    Ce noeud utilise un agent d'IA pour traiter le texte fourni.

  • Azure OpenAI Chat Model

    Ce noeud interroge le modèle de chat Azure OpenAI pour générer des réponses.

  • ReplyMessage - Line

    Ce noeud envoie une requête HTTP pour répondre à un message via Line.

  • Sticky Note

    Ce noeud crée une note autocollante avec les paramètres spécifiés.

  • Sticky Note1

    Ce noeud crée une deuxième note autocollante avec des caractéristiques définies.

  • Sticky Note2

    Ce noeud génère une troisième note autocollante avec des paramètres personnalisés.

  • Line Chatbot

    Ce noeud configure un webhook pour recevoir des messages de Line.

  • Sticky Note3

    Ce noeud crée une quatrième note autocollante avec des spécifications données.

  • Check Message Type IsText?

    Ce noeud vérifie si le type de message reçu est du texte.

  • Sticky Note4

    Ce noeud génère une cinquième note autocollante avec les paramètres fournis.

  • Sticky Note5

    Ce noeud crée une sixième note autocollante avec des caractéristiques définies.

  • Format Reply

    Ce noeud formate la réponse en fonction des affectations spécifiées.

Inscris-toi pour voir l'intégralité du workflow

Inscription gratuite

S'inscrire gratuitementBesoin d'aide ?
{
  "id": "ghfbOYrOSiQVAbl5",
  "meta": {
    "instanceId": "558d88703fb65b2d0e44613bc35916258b0f0bf983c5d4730c00c424b77ca36a"
  },
  "name": "Chatbot AI",
  "tags": [],
  "nodes": [
    {
      "id": "6eec6665-eea6-4aaa-8ae5-2fc7bf0c4746",
      "name": "Loading Animation",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -520,
        340
      ],
      "parameters": {
        "url": "https://api.line.me/v2/bot/chat/loading/start",
        "body": "={\n    \"chatId\": \"{{ $json.body.events[0].source.userId }}\",\n    \"loadingSeconds\": 60\n}",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "raw",
        "authentication": "genericCredentialType",
        "rawContentType": "application/json",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "PQI3F0ibV3txKWfv",
          "name": "Talking Therapy Line@"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "72ff06e5-e1d8-47e7-be15-888ec9171c72",
      "name": "ReplyMessage - Not supported",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        100,
        760
      ],
      "parameters": {
        "url": "https://api.line.me/v2/bot/message/reply",
        "body": "={\n    \"replyToken\":\"{{ $('Line Chatbot').item.json.body.events[0].replyToken }}\",\n    \"messages\":[\n        {\n            \"type\":\"text\",\n            \"text\":\"Currently, the input of image or other type are not supported.\"\n        }\n    ]\n}",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "raw",
        "sendHeaders": true,
        "rawContentType": "application/json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer /lQWKI4dp71pOMWZu2q18mL8P+zwf9iIOBzUDQOPMqLGMMIg88J6jPcFGfZ2ntsFfaiwCKTEcAsMjliZYXrV5E4lsjioJmv2hS7XYbh8lxmuyz1vXegKwAT66hTIBjQ1zf4l6yKugYNsUmwSYfCSQgdB04t89/1O/w1cDnyilFU="
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3a4eb71f-033d-4aff-a4fd-2ed14ea80c6c",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        40,
        80
      ],
      "parameters": {
        "text": "={{ $('Line Chatbot').item.json.body.events[0].message.text }}",
        "options": {
          "systemMessage": "You're CBT therapist. You'll help the user find the answer to their problems using CBT. but you will not tell them that you're using CBT\n\nCBT is a talking therapy. Talking therapies are also known as psychotherapies. You can find out more about these on our information page on psychotherapies and psychological treatments.\n\nCBT helps you to learn more helpful ways of thinking and reacting in everyday situations. Changing the way you think, and what you do, can help you to feel better.\n\nUnlike some other talking therapies, CBT focuses on your current challenges rather than on your past experiences. It aims to improve your state of mind by teaching you to spot the links between your thoughts, actions and feelings.\n\nC stands for ‘cognitive’ (what you think) – In CBT, you learn to notice when you are thinking negatively. You work to challenge negative or unhelpful thoughts, for example:\n-‘I’m useless’ or\n-‘It’s all going to go wrong’.\nInstead, you work to develop more useful, realistic thoughts, for example:\n-‘What’s the evidence this is true?’\n-‘What’s another way to think about this?’ or\n-‘What advice would I give a friend in my situation?’\n\nB stands for ‘behaviour’ (what you do) – Your behaviour is what you do and how you act. CBT can help you to deal with things you have been avoiding or have fears around. When doing CBT, you might keep a daily diary of activities, and set goals to try things that you are afraid of doing. Writing down your goals and actions can give you a sense of achievement and help you to mark your progress.\n\nT stands for ‘therapy’ (what you learn) – Through CBT you learn new skills that you can then practise as ‘homework’. After you have finished receiving CBT you can continue to practise these skills, which can give you the tools to stay well in the future.\n\n\nCBT can help you to make sense of overwhelming problems by breaking them down into smaller parts. This makes it easier to see how they are connected and how they affect you. These parts are:\n\nA situation – for example, an activity, or something that happens to you that you find difficult\nFrom this can follow:\n-Thoughts\n-Emotions\n-Physical feelings\n-Actions\n\nTypes of CBT \n- Cognitive therapy : Spot unhelpful thoughts and beliefs. Keep a record and try out more useful and realistic ways of thinking and reacting.\n- Behaviour therapy (e.g., graded exposure) : Change unhelpful behaviours, like avoiding, checking, or getting reassurance. Gradually face situations, thoughts, or memories you’ve been avoiding.\n- Behavioural activation: Get more active and involved in life by doing things that give a sense of pleasure or achievement. Keep a diary and schedule in positive activities.\n- Problem-solving therapy: Identify the problem, come up with ways of solving it, pick one solution, and put it into practice.\n- Motivational interviewing: Look at the pros and cons of a habit. Set goals for change.\n- Mindfulness : Pay attention to your thoughts and surroundings in the here and now without reacting to them.\n- Compassionate mind therapy : Be kinder and less critical of yourself and others, helping you to feel safer and more content.\n- Acceptance and commitment therapy (ACT, pronounced ‘act’) : Accept unpleasant thoughts and feelings rather than fight them or get upset.\n- Dialectical behaviour therapy (DBT) :Manage strong feelings and sudden mood changes to overcome relationship difficulties. Combines one-to-one CBT with group therapy.\n- Cognitive analytic therapy : Understand past causes for current difficulties and find new ways of coping. Combines CBT with analytic therapy.\n\nReference: https://www.rcpsych.ac.uk/mental-health/treatments-and-wellbeing/cognitive-behavioural-therapy-(cbt)?spm=5aebb161.59ab0a80.0.0.3380c921WQnNWN\n\nYou'll keep the character limit under 500"
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "7a92aeaf-3496-410f-a6fd-4be5172b650e",
      "name": "Azure OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        80,
        200
      ],
      "parameters": {
        "model": "4o",
        "options": {}
      },
      "credentials": {
        "azureOpenAiApi": {
          "id": "5AjoWhww5SQi2VXd",
          "name": "Azure Open AI account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "36df34d5-4232-40c8-b0ca-de7e30807adc",
      "name": "ReplyMessage - Line",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        920,
        80
      ],
      "parameters": {
        "url": "https://api.line.me/v2/bot/message/reply",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"replyToken\": \"{{ $('Line Chatbot').item.json.body.events[0].replyToken }}\",\n  \"messages\": [\n    {\n      \"type\": \"text\",\n      \"text\": \"{{ $json.output }}\"\n    }\n  ]} ",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "PQI3F0ibV3txKWfv",
          "name": "Talking Therapy Line@"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "c3e227dd-3306-4259-ad7a-c1911c3c5176",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        680
      ],
      "parameters": {
        "color": 4,
        "width": 320,
        "height": 260,
        "content": "For non-text, we do not process and just provide user that it's not supported right now"
      },
      "typeVersion": 1
    },
    {
      "id": "fba0b833-896e-4332-97e5-fa09a3838191",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1000,
        280
      ],
      "parameters": {
        "color": 4,
        "width": 340,
        "height": 560,
        "content": "**Webhook from Line**\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nYou need to set-up this webhook at Line Manager or Line Developer Console\n\nYou'll need to copy Webhook URL from this node to put in Line Console\n\nAlso, don't forget to remove 'test' part when going for production\n\nhttps://developers.line.biz/en/docs/messaging-api/receiving-messages/\n"
      },
      "typeVersion": 1
    },
    {
      "id": "f58d7af5-70c4-412a-a8f6-6cfceaf65ade",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        280
      ],
      "parameters": {
        "color": 4,
        "width": 340,
        "height": 560,
        "content": "**Line Loading Animation**\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nThis node is to only give ... loading animation back in Line.\n\nIt seems stupid but it actually tells user that the workflow is running and you are not left waiting without hope\n\nTo authorize, use header authorization \n\nhttps://developers.line.biz/en/docs/messaging-api/use-loading-indicator/"
      },
      "typeVersion": 1
    },
    {
      "id": "7c67d79d-e2b8-453c-8adc-cb66e6ef290c",
      "name": "Line Chatbot",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -900,
        340
      ],
      "webhookId": "c69b940a-5a44-45e3-b9b4-04abda6462b2",
      "parameters": {
        "path": "AIChatbot",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2
    },
    {
      "id": "a44319cf-d985-4bbf-be99-ac479406c369",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        820,
        0
      ],
      "parameters": {
        "color": 4,
        "width": 320,
        "height": 600,
        "content": "**Reply Message**\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nYou can send anything with reply-token without using your broadcast quota.\n\nTo use header auth: \n- select generic > header auth\n- add new \n- name = Authorization\n- value = Bearer <your token>\n- you can rename this credential on top\n\nhttps://developers.line.biz/en/docs/messaging-api/sending-messages/"
      },
      "typeVersion": 1
    },
    {
      "id": "1cfa159b-57c6-424a-a9e2-4b237a0bcbb5",
      "name": "Check Message Type IsText?",
      "type": "n8n-nodes-base.if",
      "position": [
        -220,
        340
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e44288a5-18de-48b3-9bb1-0e18f6491043",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $('Line Chatbot').item.json.body.events[0].message.type }}",
              "rightValue": "text"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "48363222-487e-4d4a-a424-4406aacc7f74",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        0
      ],
      "parameters": {
        "color": 2,
        "width": 320,
        "height": 320,
        "content": "The output from AI-Agent is not properly formatted for JSON to send via reply. So you need to edit it a bit\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d7b7d3ca-c685-4a02-8b73-a5b24aa663d4",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "color": 5,
        "width": 320,
        "height": 620,
        "content": "**Chat Model (LLM)**\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nTo use chat LLM, you need to have AI Agent or LLM Chain. Then you can connect the model to the node.\n- edit system prompt on the mother node. \n- edit model parameters eg. temperature at the AI node (closer to 1 = more creative)\n\nAzure OpenAI Ref : https://davoy.tech/how-to-use-azure-openai-2/\n\nOr you can choose different models"
      },
      "typeVersion": 1
    },
    {
      "id": "8cb1b56a-15dd-4936-b343-c2350b2a6a48",
      "name": "Format Reply",
      "type": "n8n-nodes-base.set",
      "position": [
        500,
        80
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "15bd9ebd-ba6b-4ee5-9f4b-185260e51b0a",
              "name": "output",
              "type": "string",
              "value": "={{ $json.output.replaceAll(\"\\n\",\"\\\\n\").replaceAll(\"\\n\",\"\").removeMarkdown().removeTags().replaceAll('\"',\"\") }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "cca20e40-0b31-4e64-9953-610dc6b569d7",
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Format Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Reply": {
      "main": [
        [
          {
            "node": "ReplyMessage - Line",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Line Chatbot": {
      "main": [
        [
          {
            "node": "Loading Animation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loading Animation": {
      "main": [
        [
          {
            "node": "Check Message Type IsText?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Azure OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Check Message Type IsText?": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "ReplyMessage - Not supported",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Workflow n8n chatbot, support client : pour qui est ce workflow ?

Ce workflow s'adresse aux entreprises de toutes tailles souhaitant améliorer leur service client à travers des solutions automatisées. Il est particulièrement pertinent pour les équipes de support client, les développeurs de chatbot et les entreprises technologiques ayant une connaissance de base des outils d'automatisation.

Workflow n8n chatbot, support client : problème résolu

Ce workflow résout le problème de la lenteur des réponses aux demandes des clients, souvent source de frustration. En automatisant les réponses via un chatbot alimenté par l'IA, les entreprises peuvent réduire le temps d'attente pour les utilisateurs et améliorer leur satisfaction. De plus, cela permet de diminuer la charge de travail des équipes de support, leur permettant de se concentrer sur des cas plus complexes.

Workflow n8n chatbot, support client : étapes du workflow

Étape 1 : Le flux est déclenché par un message reçu via le nœud 'Line Chatbot'.

  • Étape 1 : Le message est analysé par le nœud 'Check Message Type IsText?' pour vérifier s'il s'agit d'un texte.
  • Étape 2 : Si c'est le cas, le message est envoyé au nœud 'AI Agent' pour générer une réponse.
  • Étape 3 : La réponse est ensuite traitée par le nœud 'Format Reply' pour être correctement structurée.
  • Étape 4 : Enfin, la réponse formatée est renvoyée à l'utilisateur via le nœud 'Line Chatbot'.

Workflow n8n chatbot, support client : guide de personnalisation

Pour personnaliser ce workflow, vous pouvez modifier l'URL du webhook dans le nœud 'Line Chatbot' pour l'adapter à votre plateforme de messagerie. Vous pouvez également ajuster les paramètres du modèle Azure OpenAI dans le nœud 'Azure OpenAI Chat Model' pour affiner les réponses générées. Pensez à personnaliser les messages dans le nœud 'Format Reply' pour qu'ils correspondent à votre ton de communication. Enfin, vous pouvez ajouter des nœuds supplémentaires pour intégrer d'autres services ou outils selon vos besoins spécifiques.