患者へ電子メールと WhatsApp で処方せんを送信

中級

これはMiscellaneous, Multimodal AI分野の自動化ワークフローで、8個のノードを含みます。主にCode, Filter, WhatsApp, EmailSend, GoogleSheetsなどのノードを使用。 Google Sheetsを使った処方箋の自動送信(メールとWhatsApp)

前提条件
  • Google Sheets API認証情報
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "id": "RiKOVQcW472o1Hfu",
  "meta": {
    "instanceId": "dd69efaf8212c74ad206700d104739d3329588a6f3f8381a46a481f34c9cc281",
    "templateCredsSetupCompleted": true
  },
  "name": "Send Prescription to Patients via Email & WhatsApp",
  "tags": [],
  "nodes": [
    {
      "id": "368d24da-9d79-4bf5-9c56-1f70bf74ab1e",
      "name": "新規処方箋のフィルタリング",
      "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": "処方箋データのフォーマット",
      "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": "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": "通知ログ記録",
      "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": "処方箋ステータスの更新",
      "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 Sheetsトリガー",
      "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メール送信",
      "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": "付箋メモ",
      "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
          }
        ]
      ]
    },
    "5c2bf898-b7a2-43c9-a90d-e852fecf829e": {
      "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
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

中級 - その他, マルチモーダルAI

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

関連ワークフロー

ペリスコンティニュア装置「Philips IntelliVue」を使ったリアルタイム患者モニタリング
Philips IntelliVueとGoogle Sheetsを使った患者の生命体征監視とアラート自動化
Code
Cron
Switch
+
Code
Cron
Switch
8 ノードOneclick AI Squad
その他
AWS Azure GCPマルチクラウドコスト監視と予算制御アラート
AWS Azure GCPのマルチクラウドコスト監視と予算制御アラート
If
Code
Cron
+
If
Code
Cron
12 ノードOneclick AI Squad
DevOps
スマートなアクティビティフォローとソーシャルアシスタント
マルチチャネルアプローチ(GPT-4、LinkedIn、HubSpot)によるイベントフォローアップの自動化
Code
Filter
Hubspot
+
Code
Filter
Hubspot
25 ノードOneclick AI Squad
リードナーチャリング
AI アクティビティとバジェットオーケストレーション套件
イベント企画と予算最適化の自動化を実現:Claude AI、Google Sheets
Code
Merge
Slack
+
Code
Merge
Slack
20 ノードOneclick AI Squad
プロジェクト管理
AIを活用したリード生成による不動産権益メールと電話販売
Llama AI、VAPIコール、Gmailマーケティングで不動産マーケティングを自動化する
Code
Wait
Gmail
+
Code
Wait
Gmail
23 ノードOneclick AI Squad
リードナーチャリング
自動化された毎日の暗号通貨市場レポート - 最も上昇したものと最も下落したもの
毎日の暗号通貨市場レポート(CoinGecko、WhatsApp、メール通知を使用)
Set
Code
Cron
+
Set
Code
Cron
13 ノードOneclick AI Squad
仮想通貨取引
ワークフロー情報
難易度
中級
ノード数8
カテゴリー2
ノードタイプ7
難易度説明

経験者向け、6-15ノードの中程度の複雑さのワークフロー

作成者
Oneclick AI Squad

Oneclick AI Squad

@oneclick-ai

The 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.

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34