Verschreibung von Medikamenten an Patienten per E-Mail und WhatsApp
Dies ist ein Miscellaneous, Multimodal AI-Bereich Automatisierungsworkflow mit 8 Nodes. Hauptsächlich werden Code, Filter, WhatsApp, EmailSend, GoogleSheets und andere Nodes verwendet. Automatisierung des Versands von Rezepten per E-Mail und WhatsApp durch Google Sheets
- •Google Sheets API-Anmeldedaten
Verwendete Nodes (8)
Kategorie
{
"id": "RiKOVQcW472o1Hfu",
"meta": {
"instanceId": "dd69efaf8212c74ad206700d104739d3329588a6f3f8381a46a481f34c9cc281",
"templateCredsSetupCompleted": true
},
"name": "Send Prescription to Patients via Email & WhatsApp",
"tags": [],
"nodes": [
{
"id": "368d24da-9d79-4bf5-9c56-1f70bf74ab1e",
"name": "Neue Rezepte filtern",
"type": "n8n-nodes-base.filter",
"position": [
-1240,
-120
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "1",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.prescription_status }}",
"rightValue": "new"
},
{
"id": "2",
"operator": {
"type": "string",
"operation": "isNotEmpty"
},
"leftValue": "={{ $json.patient_email }}",
"rightValue": ""
},
{
"id": "3",
"operator": {
"type": "string",
"operation": "isNotEmpty"
},
"leftValue": "={{ $json.patient_phone }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2
},
{
"id": "7ca917ec-330c-4f53-90ae-3fa7b7178200",
"name": "Rezeptdaten formatieren",
"type": "n8n-nodes-base.code",
"position": [
-1020,
-120
],
"parameters": {
"jsCode": "// Format prescription data for email and WhatsApp\nconst items = $input.all();\n\nreturn items.map(item => {\n const data = item.json;\n \n // Format prescription text\n const prescriptionText = `\n🏥 PRESCRIPTION\n\nPatient: ${data.patient_name}\nDoctor: ${data.doctor_name}\nDate: ${data.prescription_date}\n\nPrescription Details:\n${data.prescription_details}\n\nDosage Instructions:\n${data.dosage_instructions}\n\nFollow-up Date: ${data.followup_date || 'Not specified'}\n\n⚠️ Important: Take medications as prescribed. Contact your doctor if you have any questions.\n `;\n \n // Format email HTML\n const emailHTML = `\n <div style=\"font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto;\">\n <div style=\"background-color: #f8f9fa; padding: 20px; border-radius: 8px;\">\n <h2 style=\"color: #2c3e50; text-align: center;\">📋 Medical Prescription</h2>\n \n <div style=\"background-color: white; padding: 20px; border-radius: 6px; margin: 20px 0;\">\n <h3 style=\"color: #3498db; margin-top: 0;\">Patient Information</h3>\n <p><strong>Name:</strong> ${data.patient_name}</p>\n <p><strong>Doctor:</strong> ${data.doctor_name}</p>\n <p><strong>Date:</strong> ${data.prescription_date}</p>\n </div>\n \n <div style=\"background-color: white; padding: 20px; border-radius: 6px; margin: 20px 0;\">\n <h3 style=\"color: #27ae60; margin-top: 0;\">Prescription Details</h3>\n <p style=\"white-space: pre-line;\">${data.prescription_details}</p>\n </div>\n \n <div style=\"background-color: white; padding: 20px; border-radius: 6px; margin: 20px 0;\">\n <h3 style=\"color: #e74c3c; margin-top: 0;\">Dosage Instructions</h3>\n <p style=\"white-space: pre-line;\">${data.dosage_instructions}</p>\n </div>\n \n ${data.followup_date ? `\n <div style=\"background-color: white; padding: 20px; border-radius: 6px; margin: 20px 0;\">\n <h3 style=\"color: #f39c12; margin-top: 0;\">Follow-up</h3>\n <p><strong>Next Appointment:</strong> ${data.followup_date}</p>\n </div>\n ` : ''}\n \n <div style=\"background-color: #fff3cd; border: 1px solid #ffeaa7; padding: 15px; border-radius: 6px; margin: 20px 0;\">\n <p style=\"margin: 0; color: #856404;\">⚠️ <strong>Important:</strong> Take medications exactly as prescribed. Contact your doctor if you experience any side effects or have questions.</p>\n </div>\n \n <div style=\"text-align: center; margin-top: 30px; padding-top: 20px; border-top: 1px solid #ddd;\">\n <p style=\"color: #7f8c8d; font-size: 12px;\">This prescription was sent automatically from our medical system.</p>\n </div>\n </div>\n </div>\n `;\n \n return {\n json: {\n ...data,\n prescriptionText,\n emailHTML,\n whatsappMessage: prescriptionText.replace(/🏥|📋|⚠️/g, ''), // Remove emojis for WhatsApp compatibility\n timestamp: new Date().toISOString()\n }\n };\n});"
},
"typeVersion": 2
},
{
"id": "73c4304b-ac16-4deb-aaae-d40c94c29de9",
"name": "Send WhatsApp",
"type": "n8n-nodes-base.whatsApp",
"position": [
-800,
-20
],
"webhookId": "2ff35c14-14d6-485c-bf0f-8a460769b4dd",
"parameters": {
"textBody": "Hello [Patient Name], 👋 Your prescription from Dr. [Doctor Name] dated [Date] is ready. Please check the attached file for your medication details. 📞 For queries, contact us at [Contact Number]. [Clinic/Hospital Name]",
"operation": "send",
"phoneNumberId": "=+919988888888",
"additionalFields": {},
"recipientPhoneNumber": "=+91999999999999"
},
"credentials": {
"whatsAppApi": {
"id": "b0PxTDPdWzznWnfG",
"name": "WhatsApp-test "
}
},
"typeVersion": 1
},
{
"id": "cc159a2b-d6c2-414d-b3bc-05f4d0a16b29",
"name": "Benachrichtigung protokollieren",
"type": "n8n-nodes-base.googleSheets",
"position": [
-580,
-120
],
"parameters": {
"columns": {
"value": {
"timestamp": "={{ $json.timestamp }}",
"doctor_name": "={{ $json.doctor_name }}",
"email_status": "={{ $('Send email').item.json.success ? 'sent' : 'failed' }}",
"patient_name": "={{ $json.patient_name }}",
"patient_email": "={{ $json.patient_email }}",
"patient_phone": "={{ $json.patient_phone }}",
"prescription_id": "={{ $json.prescription_id }}",
"whatsapp_status": "={{ $('Send WhatsApp').item.json.success ? 'sent' : 'failed' }}",
"notification_type": "prescription_sent"
},
"schema": [
{
"id": "timestamp",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "timestamp",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "patient_name",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "patient_name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "patient_email",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "patient_email",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "patient_phone",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "patient_phone",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "doctor_name",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "doctor_name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "prescription_id",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "prescription_id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "email_status",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "email_status",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "whatsapp_status",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "whatsapp_status",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "notification_type",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "notification_type",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"patient_name"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "appendOrUpdate",
"sheetName": "Notification_Log",
"documentId": {
"__rl": true,
"mode": "url",
"value": "=YOUR_GOOGLE_SHEET"
},
"authentication": "serviceAccount"
},
"credentials": {
"googleApi": {
"id": "ScSS2KxGQULuPtdy",
"name": "Google Sheets- test"
}
},
"typeVersion": 4
},
{
"id": "0c9e09cb-1d80-4f09-abfd-4d3d712833ef",
"name": "Rezeptstatus aktualisieren",
"type": "n8n-nodes-base.googleSheets",
"position": [
-360,
-120
],
"parameters": {
"columns": {
"value": {
"prescription_status": "sent"
},
"schema": [
{
"id": "prescription_id",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "prescription_id",
"defaultMatch": true,
"canBeUsedToMatch": true
},
{
"id": "prescription_status",
"type": "string",
"display": true,
"removed": false,
"readOnly": false,
"required": false,
"displayName": "prescription_status",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"prescription_id"
]
},
"options": {},
"operation": "update",
"sheetName": "Prescriptions",
"documentId": {
"__rl": true,
"mode": "url",
"value": "=YOUR_GOOGLE_SHEET"
},
"authentication": "serviceAccount"
},
"credentials": {
"googleApi": {
"id": "ScSS2KxGQULuPtdy",
"name": "Google Sheets- test"
}
},
"typeVersion": 4
},
{
"id": "5c2bf898-b7a2-43c9-a90d-e852fecf829e",
"name": "Google Tabellen Trigger",
"type": "n8n-nodes-base.googleSheetsTrigger",
"position": [
-1460,
-120
],
"parameters": {
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"sheetName": {
"__rl": true,
"mode": "id",
"value": "=cfrt5tgbhu8iujnjio90"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "=ojnbgt56ybb"
}
},
"credentials": {
"googleSheetsTriggerOAuth2Api": {
"id": "BoDTTv5L67GVL3Fi",
"name": "Google Sheets - test"
}
},
"typeVersion": 1
},
{
"id": "530efe83-c80e-4b1e-8121-c508907cecd1",
"name": "E-Mail senden",
"type": "n8n-nodes-base.emailSend",
"position": [
-800,
-220
],
"webhookId": "4316a3ab-1861-43cb-9b7a-446b0938186e",
"parameters": {
"text": "Dear [Patient Name],\n\nPlease find attached your prescription from Dr. [Doctor Name] dated [Date].\nIf you have any questions about your medication, kindly contact our clinic.\n\nAttachment: Prescription PDF/Image\n\nBest regards,\n[Clinic/Hospital Name]\n[Contact Number] | [Email Address]",
"options": {
"appendAttribution": false,
"allowUnauthorizedCerts": false
},
"subject": "Your Prescription from [Doctor/Hospital Name]",
"toEmail": "={{ $json.patient_email }}",
"fromEmail": "noreply@yourhospital.com"
},
"credentials": {
"smtp": {
"id": "G1kyF8cSWTZ4vouN",
"name": "SMTP -test"
}
},
"typeVersion": 2
},
{
"id": "41b633a7-3641-4816-8b13-eb26a3d37686",
"name": "Haftnotiz",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1580,
-480
],
"parameters": {
"color": 3,
"width": 660,
"height": 260,
"content": "## 🌟 Features Included\n\n- **Automated Trigger**: Monitors Google Sheet for new prescriptions\n- **Smart Filtering**: Only processes prescriptions with status \"new\"\n- **Rich Email Format**: Professional HTML email with prescription details\n- **WhatsApp Integration**: Sends formatted prescription text\n- **Comprehensive Logging**: Tracks all sent notifications\n- **Status Updates**: Marks prescriptions as \"sent\" after processing\n- **Error Handling**: Logs success/failure status for both channels"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "62ea4e96-2323-44a0-8a1c-9726039672be",
"connections": {
"530efe83-c80e-4b1e-8121-c508907cecd1": {
"main": [
[
{
"node": "cc159a2b-d6c2-414d-b3bc-05f4d0a16b29",
"type": "main",
"index": 0
}
]
]
},
"73c4304b-ac16-4deb-aaae-d40c94c29de9": {
"main": [
[
{
"node": "cc159a2b-d6c2-414d-b3bc-05f4d0a16b29",
"type": "main",
"index": 0
}
]
]
},
"cc159a2b-d6c2-414d-b3bc-05f4d0a16b29": {
"main": [
[
{
"node": "0c9e09cb-1d80-4f09-abfd-4d3d712833ef",
"type": "main",
"index": 0
}
]
]
},
"Google Sheets Trigger": {
"main": [
[
{
"node": "368d24da-9d79-4bf5-9c56-1f70bf74ab1e",
"type": "main",
"index": 0
}
]
]
},
"368d24da-9d79-4bf5-9c56-1f70bf74ab1e": {
"main": [
[
{
"node": "7ca917ec-330c-4f53-90ae-3fa7b7178200",
"type": "main",
"index": 0
}
]
]
},
"7ca917ec-330c-4f53-90ae-3fa7b7178200": {
"main": [
[
{
"node": "530efe83-c80e-4b1e-8121-c508907cecd1",
"type": "main",
"index": 0
},
{
"node": "73c4304b-ac16-4deb-aaae-d40c94c29de9",
"type": "main",
"index": 0
}
]
]
}
}
}Wie verwende ich diesen Workflow?
Kopieren Sie den obigen JSON-Code, erstellen Sie einen neuen Workflow in Ihrer n8n-Instanz und wählen Sie "Aus JSON importieren". Fügen Sie die Konfiguration ein und passen Sie die Anmeldedaten nach Bedarf an.
Für welche Szenarien ist dieser Workflow geeignet?
Fortgeschritten - Verschiedenes, Multimodales KI
Ist es kostenpflichtig?
Dieser Workflow ist völlig kostenlos. Beachten Sie jedoch, dass Drittanbieterdienste (wie OpenAI API), die im Workflow verwendet werden, möglicherweise kostenpflichtig sind.
Verwandte Workflows
Oneclick AI Squad
@oneclick-aiThe AI Squad Initiative is a pioneering effort to build, automate and scale AI-powered workflows using n8n.io. Our mission is to help individuals and businesses integrate AI agents seamlessly into their daily operations from automating tasks and enhancing productivity to creating innovative, intelligent solutions. We design modular, reusable AI workflow templates that empower creators, developers and teams to supercharge their automation with minimal effort and maximum impact.
Diesen Workflow teilen