AutomationFlowsAI & RAG › CRM — Ia a La Demande (generate Reply)

CRM — Ia a La Demande (generate Reply)

CRM — IA a la demande (generate reply). Uses httpRequest, chainLlm, lmChatMistralCloud. Webhook trigger; 7 nodes.

Webhook trigger★★★★☆ complexityAI-powered7 nodesHTTP RequestChain LlmLm Chat Mistral Cloud
AI & RAG Trigger: Webhook Nodes: 7 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Chainllm → HTTP Request recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "CRM \u2014 IA a la demande (generate reply)",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "generate-reply",
        "options": {
          "responseMode": "responseNode"
        }
      },
      "id": "webhook",
      "name": "Webhook generate-reply",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "method": "GET",
        "url": "={{ $vars.CRM_BASE_URL }}/api/n8n/emails/{{ $json.body.emailId }}/context",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-n8n-secret",
              "value": "={{ $vars.CRM_N8N_SECRET }}"
            }
          ]
        },
        "options": {
          "timeout": 10000
        }
      },
      "id": "get-context",
      "name": "Charger contexte email",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        240,
        0
      ]
    },
    {
      "parameters": {
        "jsCode": "const ctx = $input.first().json;\nconst webhook = $('Webhook generate-reply').first().json.body;\nconst email = ctx.email || {};\nconst client = ctx.client;\nconst recentEmails = ctx.recentEmails || [];\nconst openTasks = ctx.openTasks || [];\nconst instructions = webhook.instructions || '';\n\nconst parts = [\n  'Tu es assistant du cabinet GargarineV1, courtier en assurances.',\n  'Redige une reponse professionnelle a cet email.',\n  '',\n  'EMAIL RECU :',\n  'De: ' + (email.expediteur || 'inconnu'),\n  'Objet: ' + (email.sujet || 'Sans objet'),\n  '---',\n  email.extrait || '(pas de contenu)',\n];\n\nif (client) {\n  parts.push('', 'CONTEXTE CLIENT :', 'Nom: ' + client.raisonSociale, 'Statut: ' + client.statut);\n  if (client.contrats?.length) parts.push('Contrats: ' + client.contrats.map(c => c.typeProduit + ' (' + c.statut + ')').join(', '));\n  if (client.deals?.length) parts.push('Deals: ' + client.deals.map(d => d.titre).join(', '));\n}\n\nif (recentEmails.length > 0) {\n  parts.push('', 'HISTORIQUE RECENT DU FIL :');\n  recentEmails.forEach(e => parts.push('[' + e.direction + '] ' + e.sujet + ' \\u2014 ' + (e.extrait || '').substring(0, 100)));\n}\n\nif (openTasks.length > 0) {\n  parts.push('', 'TACHES EN COURS :');\n  openTasks.forEach(t => parts.push('- ' + t.titre + ' (' + t.type + ', echeance: ' + t.dateEcheance + ')'));\n}\n\nif (instructions) {\n  parts.push('', 'INSTRUCTIONS SPECIFIQUES :', instructions);\n}\n\nparts.push('', 'Redige une reponse concise et professionnelle.');\nparts.push('Commence par Bonjour [nom], et termine par Cordialement, GargarineV1 \\u2014 Courtage en assurances.');\n\nreturn [{ json: { prompt: parts.join('\\n') } }];"
      },
      "id": "build-prompt",
      "name": "Construire prompt",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        480,
        0
      ]
    },
    {
      "parameters": {
        "prompt": "={{ $json.prompt }}"
      },
      "id": "analyse-ia",
      "name": "Generer reponse IA",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.4,
      "position": [
        720,
        0
      ]
    },
    {
      "parameters": {
        "model": "mistral-small-latest",
        "options": {
          "temperature": 0.3
        }
      },
      "id": "mistral-cloud",
      "name": "Mistral Cloud",
      "type": "@n8n/n8n-nodes-langchain.lmChatMistralCloud",
      "typeVersion": 1,
      "position": [
        720,
        200
      ],
      "credentials": {
        "mistralCloudApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "const res = $input.first().json;\nconst rawText = res.response || res.text || res.output || '';\nreturn [{ json: { draftReply: rawText.trim(), model: 'mistral-small-latest' } }];"
      },
      "id": "format-reply",
      "name": "Formater reponse",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        960,
        0
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ draftReply: $json.draftReply, model: $json.model }) }}"
      },
      "id": "respond",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        1200,
        0
      ]
    }
  ],
  "connections": {
    "Webhook generate-reply": {
      "main": [
        [
          {
            "node": "Charger contexte email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Charger contexte email": {
      "main": [
        [
          {
            "node": "Construire prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Construire prompt": {
      "main": [
        [
          {
            "node": "Generer reponse IA",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generer reponse IA": {
      "main": [
        [
          {
            "node": "Formater reponse",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Cloud": {
      "ai_languageModel": [
        [
          {
            "node": "Generer reponse IA",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Formater reponse": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "tags": [
    {
      "name": "CRM Courtage"
    }
  ]
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

CRM — IA a la demande (generate reply). Uses httpRequest, chainLlm, lmChatMistralCloud. Webhook trigger; 7 nodes.

Source: https://github.com/florianmaireentreprise-spec/crm-courtage/blob/3626f550541848c243fb71c6387c05b34c85e87c/n8n-workflows/09-generate-reply.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Planning Assistant 2. Uses httpRequest, chainLlm, lmChatMistralCloud, outputParserStructured. Webhook trigger; 5 nodes.

HTTP Request, Chain Llm, Lm Chat Mistral Cloud +1
AI & RAG

Episode 11: AI shorts factory app. Uses httpRequest, googleSheets, lmChatOpenAi, lmChatOllama. Event-driven trigger; 96 nodes.

HTTP Request, Google Sheets, OpenAI Chat +15
AI & RAG

ANIS_HUB 1. Uses gmail, googleDrive, googleSheets, httpRequest. Webhook trigger; 89 nodes.

Gmail, Google Drive, Google Sheets +3
AI & RAG

CLINICAINTEGRAL_secretary. Uses postgres, mcpClientTool, googleDriveTool, toolWorkflow. Webhook trigger; 89 nodes.

Postgres, Mcp Client Tool, Google Drive Tool +14
AI & RAG

This n8n workflow orchestrates a powerful suite of AI Agents and automations to manage and optimize various aspects of an e-commerce operation, particularly for platforms like Shopify. It leverages La

Google Sheets, HTTP Request, Slack +10