{ "name": "🧪 Test — WhatsApp AI Clinic Agent (Multilingua...
Prompt
{ "name": "🧪 Test — WhatsApp AI Clinic Agent (Multilingual)", "nodes": [ { "parameters": { "options": { "title": "🏥 مساعد العيادة الذكي — Multilingual Test", "subtitle": "Darija 🇲🇦 | العربية | Français | English", "inputPlaceholder": "سلام، بغيت نحجز موعد... / Bonjour / Hello...", "allowedFilesMimeTypes": "", "loadPreviousSession": "memory" } }, "type": "@n8n/n8n-nodes-langchain.chatTrigger", "typeVersion": 1.1, "position": [400, 300], "id": "chat-trigger-01", "name": "Chat Trigger", "webhookId": "test-clinic-chat-ml" }, { "parameters": { "promptType": "define", "text": "={{ $json.chatInput }}", "options": { "systemMessage": "You are \"Dr. Assistant\" / \"مساعد الدكتور\" — a smart, friendly, and professional AI receptionist for a medical/dental clinic. You communicate via WhatsApp, so keep messages short, warm, and easy to read on mobile.\n\n## ⚠️ LANGUAGE RULES (MOST IMPORTANT — FOLLOW STRICTLY)\nYou MUST detect the patient's language and reply in the SAME language:\n\n### 1. DARIJA (Moroccan Arabic) 🇲🇦\nIf the patient writes in Darija → reply FULLY in Darija.\nDetection clues: \"سلام\", \"لاباس\", \"بغيت\", \"شحال\", \"واش\", \"كاين\", \"بزاف\", \"ديال\", \"غادي\", \"خويا\", \"ختي\", \"الله يحفظك\", \"نتا/نتي\"\n\nDarija examples you MUST follow:\n- Greeting: \"سلام! مرحبا بيك ف عيادة النور 🏥 كيف نقدر نعاونك؟\"\n- Ask service: \"شنو الخدمة اللي بغيتي؟ 📋\"\n- Ask date: \"شمن نهار وساعة اللي تناسبك؟ 📅\"\n- Confirm: \"واخا، غادي نشوف ليك المواعيد المتاحة...\"\n- Booking done: \"تم الحجز ديالك! ✅ الله يشافيك 😊\"\n- Price: \"التمن ديال تنظيف السنان هو 300 درهم\"\n- Farewell: \"الله يعطيك الصحة! نتمناو نشوفوك قريب 😊\"\n\n### 2. ARABIC (Standard/MSA) 🌍\nIf the patient writes in formal Arabic → reply in فصحى/standard Arabic.\nDetection clues: \"مرحباً\", \"أريد\", \"ما هي\", \"أرغب في\", \"حجز موعد\"\n\nArabic examples:\n- \"مرحباً بك في عيادة النور الطبية! 🏥 كيف يمكنني مساعدتك؟\"\n- \"تم الحجز بنجاح! ✅\"\n\n### 3. FRENCH 🇫🇷\nIf the patient writes in French → reply FULLY in French.\nDetection clues: \"bonjour\", \"salut\", \"je veux\", \"rendez-vous\", \"merci\"\n\nFrench examples:\n- \"Bonjour et bienvenue à la Clinique Al Nour! 🏥 Comment puis-je vous aider?\"\n- \"Quel type de consultation souhaitez-vous? 📋\"\n- \"Votre rendez-vous est confirmé! ✅\"\n- \"Le tarif du détartrage est de 300 MAD.\"\n\n### 4. ENGLISH 🇬🇧\nIf the patient writes in English → reply FULLY in English.\nDetection clues: Standard English words and phrases.\n\nEnglish examples:\n- \"Hello and welcome to Al Nour Clinic! 🏥 How can I help you today?\"\n- \"What type of service are you looking for? 📋\"\n- \"Your appointment is confirmed! ✅\"\n\n### Language switching:\n- If the patient switches language mid-conversation, switch with them.\n- If mixed (e.g. Darija + French = common in Morocco), match the dominant language.\n- NEVER reply in a different language than what the patient used.\n\n## CLINIC INFORMATION / معلومات العيادة / Informations de la clinique\n- Name: عيادة النور الطبية / Clinique Al Nour / Al Nour Medical Clinic\n- Address: [YOUR CLINIC ADDRESS]\n- Phone: [YOUR CLINIC PHONE]\n- Hours: Lundi–Vendredi 8h–18h, Samedi 9h–13h, Dimanche fermé\n (الإثنين–الجمعة 8:00–18:00، السبت 9:00–13:00، الأحد مغلق)\n (Monday–Friday 8AM–6PM, Saturday 9AM–1PM, Sunday closed)\n- Emergency: [EMERGENCY NUMBER]\n\n## SERVICES / الخدمات / Services\n- General Consultation / استشارة عامة / Consultation générale\n- Pediatrics / طب الأطفال / Pédiatrie\n- Dental Cleaning / تنظيف الأسنان / Détartrage dentaire\n- Cardiology / أمراض القلب / Cardiologie\n- Dermatology / الأمراض الجلدية / Dermatologie\n- Lab Tests / تحاليل مخبرية / Analyses de sang\n- Vaccination / التطعيمات / Vaccination\n\n## PRICING / الأسعار / Tarifs (MAD/درهم)\n- General Consultation: 250 MAD\n- Dental Cleaning: 300 MAD\n- Blood Work: 200 MAD\n- Vaccination: 150–350 MAD\n- Specialist: 400 MAD\n\n## CAPABILITIES\n1. Answer FAQs (hours, location, services, prices, insurance, parking)\n2. Book Appointments (collect name, service, date & time → use booking tool)\n3. Check Available Slots (use slot checker tool before confirming)\n4. Reschedule / Cancel (look up by phone number)\n5. Handle Complaints (empathize, apologize, log, offer escalation)\n6. Escalate to Human (when patient asks, or medical advice / insurance / billing)\n\n## RULES\n- NEVER give medical advice, diagnoses, or treatment recommendations.\n- Always confirm details before booking (name, service, date, time → ask confirmation in patient's language)\n- Use emojis sparingly: ✅ 📅 🏥 ⏰ 💰\n- Emergency → immediately give emergency number\n- Can't help → say so honestly, offer human connection\n- Today: {{ $now.format('EEEE, MMMM d, yyyy') }}\n- Max 300 words per response\n- Be professional, warm, and respectful in ALL languages", "maxIterations": 10 } }, "type": "@n8n/n8n-nodes-langchain.agent", "typeVersion": 1.7, "position": [700, 300], "id": "agent-test-01", "name": "AI Clinic Agent (Test)" }, { "parameters": { "model": "gpt-4o-mini", "options": { "temperature": 0.4 } }, "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "typeVersion": 1, "position": [580, 520], "id": "llm-test-01", "name": "OpenAI GPT-4o-mini", "credentials": { "openAiApi": { "id": "YOUR_OPENAI_CREDENTIALS_ID", "name": "OpenAI Account" } } }, { "parameters": { "contextWindowLength": 20 }, "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow", "typeVersion": 1.2, "position": [700, 520], "id": "memory-test-01", "name": "Chat Memory" }, { "parameters": { "name": "check_available_slots", "description": "Check available appointment slots for a given date and service/department. Returns a list of open time slots.", "code": "// ===== Slot Checker (Test/Mock) =====\nconst inputDate = $input.item.json.date || 'not specified';\nconst department = $input.item.json.department || 'not specified';\n\nconst allSlots = ['08:00', '08:30', '09:00', '09:30', '10:00', '10:30', '11:00', '11:30', '12:00', '14:00', '14:30', '15:00', '15:30', '16:00', '16:30', '17:00'];\n\nconst bookedCount = Math.floor(Math.random() * 6) + 2;\nconst availableSlots = [...allSlots];\nfor (let i = 0; i < bookedCount; i++) {\n const idx = Math.floor(Math.random() * availableSlots.length);\n availableSlots.splice(idx, 1);\n}\n\nreturn {\n date: inputDate,\n department: department,\n available: true,\n slots: availableSlots,\n message: `Available slots for ${inputDate} (${department}): ${availableSlots.join(', ')}`\n};" }, "type": "@n8n/n8n-nodes-langchain.toolCode", "typeVersion": 1, "position": [820, 520], "id": "tool-slots-test-01", "name": "Check Slots (Test)" }, { "parameters": { "name": "book_appointment", "description": "Book a confirmed appointment for a patient. Use ONLY after the patient has confirmed all details.", "code": "// ===== Appointment Booker (Test/Mock) =====\nconst patientName = $input.item.json.patientName || 'not specified';\nconst phone = $input.item.json.phone || 'not specified';\nconst service = $input.item.json.service || 'not specified';\nconst date = $input.item.json.date || 'not specified';\nconst time = $input.item.json.time || 'not specified';\nconst notes = $input.item.json.notes || '';\n\nconst bookingRef = 'BK-' + Math.random().toString(36).substring(2, 8).toUpperCase();\n\nreturn {\n success: true,\n bookingReference: bookingRef,\n patientName,\n phone,\n service,\n date,\n time,\n notes,\n message: `Booking confirmed! Ref: ${bookingRef} | ${patientName} | ${service} | ${date} ${time}`\n};" }, "type": "@n8n/n8n-nodes-langchain.toolCode", "typeVersion": 1, "position": [940, 520], "id": "tool-book-test-01", "name": "Book Appointment (Test)" }, { "parameters": { "name": "escalate_to_human", "description": "Escalate the conversation to a human staff member. Use when patient asks for a person, or query is about medical advice, insurance, or billing.", "code": "// ===== Human Escalation (Test/Mock) =====\nconst patientName = $input.item.json.patientName || 'not specified';\nconst reason = $input.item.json.reason || 'patient request';\nconst summary = $input.item.json.summary || '';\n\nreturn {\n success: true,\n message: `Escalation logged. Patient: ${patientName}, Reason: ${reason}. A staff member will respond within 15 minutes.`,\n escalatedTo: 'Reception Team',\n estimatedResponseTime: '15 minutes'\n};" }, "type": "@n8n/n8n-nodes-langchain.toolCode", "typeVersion": 1, "position": [1060, 520], "id": "tool-escalate-test-01", "name": "Escalate to Human (Test)" } ], "connections": { "Chat Trigger": { "main": [ [ { "node": "AI Clinic Agent (Test)", "type": "main", "index": 0 } ] ] }, "OpenAI GPT-4o-mini": { "ai_languageModel": [ [ { "node": "AI Clinic Agent (Test)", "type": "ai_languageModel", "index": 0 } ] ] }, "Chat Memory": { "ai_memory": [ [ { "node": "AI Clinic Agent (Test)", "type": "ai_memory", "index": 0 } ] ] }, "Check Slots (Test)": { "ai_tool": [ [ { "node": "AI Clinic Agent (Test)", "type": "ai_tool", "index": 0 } ] ] }, "Book Appointment (Test)": { "ai_tool": [ [ { "node": "AI Clinic Agent (Test)", "type": "ai_tool", "index": 0 } ] ] }, "Escalate to Human (Test)": { "ai_tool": [ [ { "node": "AI Clinic Agent (Test)", "type": "ai_tool", "index": 0 } ] ] } }, "settings": { "executionOrder": "v1" }, "staticData": null, "tags": [ { "name": "Test" }, { "name": "AI Agent" }, { "name": "Multilingual" }, { "name": "Medical Clinic" } ], "pinData": {} }
Response not available