学校へのお知らせを WhatsApp とメールで配信するワークフロー
これはMiscellaneous分野の自動化ワークフローで、10個のノードを含みます。主にIf, Code, EmailSend, HttpRequest, MicrosoftExcelなどのノードを使用。 WhatsApp、Eメール、Excelを使った学校通知配信の自動化
- •ターゲットAPIの認証情報が必要な場合あり
カテゴリー
{
"id": "HPVAZGksUMoYkWlX",
"meta": {
"instanceId": "dd69efaf8212c74ad206700d104739d3329588a6f3f8381a46a481f34c9cc281",
"templateCredsSetupCompleted": true
},
"name": "School Notice Distribution Workflow via WhatsApp and Email",
"tags": [],
"nodes": [
{
"id": "4ed6aade-7953-401e-9c87-54f159b81428",
"name": "毎日9時の通知確認",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-500,
400
],
"parameters": {
"rule": {
"interval": [
{
"triggerAtHour": 9
}
]
}
},
"typeVersion": 1.2
},
{
"id": "cdd53457-2296-42db-ba46-444e2ac7ab6b",
"name": "通知データの検証",
"type": "n8n-nodes-base.if",
"position": [
-60,
400
],
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json.title}}",
"operation": "isNotEmpty"
},
{
"value1": "={{$json.message}}",
"operation": "isNotEmpty"
},
{
"value1": "={{$json.targetAudience}}",
"operation": "isNotEmpty"
}
]
}
},
"typeVersion": 1
},
{
"id": "752ae286-9f2d-4c7e-8e01-1ff92966a9c4",
"name": "通知配信の処理",
"type": "n8n-nodes-base.code",
"position": [
160,
400
],
"parameters": {
"jsCode": "const notices = $('Read Notices').all();\nconst contacts = $('Read Stakeholder Contacts').all();\n\nconst processedNotices = [];\n\nfor (const notice of notices) {\n const noticeData = notice.json;\n \n const targetAudience = noticeData.targetAudience.toLowerCase();\n const relevantContacts = contacts.filter(contact => {\n const contactData = contact.json;\n \n if (targetAudience === 'all') return true;\n if (targetAudience === 'students' && contactData.type === 'Student') return true;\n if (targetAudience === 'parents' && contactData.type === 'Parent') return true;\n if (targetAudience === 'teachers' && contactData.type === 'Teacher') return true;\n if (targetAudience === 'staff' && contactData.type === 'Staff') return true;\n \n return false;\n });\n \n for (const contact of relevantContacts) {\n processedNotices.push({\n noticeId: noticeData.noticeId || 'NOTICE-' + Date.now(),\n title: noticeData.title,\n message: noticeData.message,\n priority: noticeData.priority || 'Medium',\n targetAudience: noticeData.targetAudience,\n contactName: contact.json.name,\n contactEmail: contact.json.email,\n contactPhone: contact.json.phone,\n contactType: contact.json.type,\n distributionDate: new Date().toISOString().split('T')[0],\n status: 'Ready for Distribution'\n });\n }\n}\n\nreturn processedNotices.map(item => ({ json: item }));"
},
"typeVersion": 2
},
{
"id": "9d1fd210-9737-4756-a70d-002c899e3f0f",
"name": "メール本文の作成",
"type": "n8n-nodes-base.code",
"position": [
380,
300
],
"parameters": {
"jsCode": "const noticeData = $input.first().json;\n\nconst emailSubject = `[${noticeData.priority} Priority] ${noticeData.title}`;\nconst emailBody = `Dear ${noticeData.contactName},\n\n${noticeData.message}\n\n---\nNotice Details:\n- Priority: ${noticeData.priority}\n- Target Audience: ${noticeData.targetAudience}\n- Distribution Date: ${noticeData.distributionDate}\n- Notice ID: ${noticeData.noticeId}\n\nFor any questions or concerns, please contact the school administration.\n\nBest regards,\nSchool Administration Team`;\n\nreturn [{\n json: {\n to: noticeData.contactEmail,\n subject: emailSubject,\n body: emailBody,\n recipientName: noticeData.contactName,\n noticeId: noticeData.noticeId,\n priority: noticeData.priority\n }\n}];"
},
"typeVersion": 2
},
{
"id": "5b817e81-22d2-4618-848e-62b0c286e1b4",
"name": "WhatsApp本文の作成",
"type": "n8n-nodes-base.code",
"position": [
380,
500
],
"parameters": {
"jsCode": "const noticeData = $input.first().json;\n\nconst whatsappMessage = `🏫 *${noticeData.title}*\\n\\n${noticeData.message}\\n\\n📋 Notice ID: ${noticeData.noticeId}\\n⚡ Priority: ${noticeData.priority}\\n📅 Date: ${noticeData.distributionDate}\\n\\n_This is an official school notice. Please keep this for your records._`;\n\nreturn [{\n json: {\n phone: noticeData.contactPhone,\n message: whatsappMessage,\n recipientName: noticeData.contactName,\n noticeId: noticeData.noticeId,\n priority: noticeData.priority\n }\n}];"
},
"typeVersion": 2
},
{
"id": "88cc77ed-4861-4a1a-b4bb-0c491e58a709",
"name": "メール通知の送信",
"type": "n8n-nodes-base.emailSend",
"position": [
600,
300
],
"webhookId": "adef7634-8e55-45e9-a79e-89aaac2a2b70",
"parameters": {
"text": "={{$json.body}}",
"options": {},
"subject": "={{$json.subject}}",
"toEmail": "={{$json.to}}",
"fromEmail": "notices@school.edu",
"emailFormat": "text"
},
"credentials": {
"smtp": {
"id": "G1kyF8cSWTZ4vouN",
"name": "SMTP -test"
}
},
"typeVersion": 2.1
},
{
"id": "5b58440e-6a47-4ba0-94ba-19b998d4204e",
"name": "WhatsApp通知の送信",
"type": "n8n-nodes-base.httpRequest",
"position": [
600,
500
],
"parameters": {
"url": "https://graph.facebook.com/v17.0/FROM_PHONE_NUMBER_ID/messages",
"options": {},
"jsonBody": "={\n \"messaging_product\": \"whatsapp\",\n \"to\": \"{{ $json.phone }}\",\n \"type\": \"text\",\n \"text\": {\n \"body\": \"{{ $json.message }}\"\n }\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer YOUR_ACCESS_TOKEN"
},
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "5c4b3929-cb7d-45d7-804e-b7281adef0e7",
"name": "通知ステータスの更新",
"type": "n8n-nodes-base.microsoftExcel",
"position": [
820,
400
],
"parameters": {
"options": {},
"dataMode": "autoMap",
"resource": "worksheet",
"workbook": {
"__rl": true,
"mode": "id",
"value": "=notices-workbook-001"
},
"operation": "update",
"worksheet": {
"__rl": true,
"mode": "id",
"value": "=notices-sheet-001"
},
"columnToMatchOn": "=title"
},
"credentials": {
"microsoftExcelOAuth2Api": {
"id": "jevPChvDpEJk6W9v",
"name": "Microsoft Excel account - test"
}
},
"typeVersion": 2
},
{
"id": "e77a2dd6-1487-4632-b6f6-9e9b6237fc8f",
"name": "ワークフローの文書化",
"type": "n8n-nodes-base.stickyNote",
"position": [
-560,
-220
],
"parameters": {
"color": 4,
"width": 640,
"height": 400,
"content": "### **School Notice Distribution Workflow Components**\n\n**📅 Triggers:**\n* **Daily Notice Check - 9 AM** - Scheduled trigger for automated daily notice distribution\n\n**📊 Data Processing:**\n* **Read Notices** - Fetches notices from Excel database\n* **Validate Notice Data** - Ensures notice data completeness and format\n* **Process Notice Distribution** - Matches notices with target audiences\n\n**📧 Communication:**\n* **Prepare Email Content** - Creates personalized email messages\n* **Prepare WhatsApp Content** - Formats WhatsApp messages with emojis\n* **Send Email Notice** - Distributes via email to stakeholders\n* **Send WhatsApp Notice** - Sends WhatsApp messages via Business API\n\n**📈 Reporting:**\n* **Update Notice Status** - Marks notices as distributed"
},
"typeVersion": 1
},
{
"id": "003b88f7-1cc6-4170-94ff-32d25a6bb758",
"name": "通知の読み取り",
"type": "n8n-nodes-base.microsoftExcel",
"position": [
-280,
400
],
"parameters": {
"filters": {
"fields": [
{
"value": "Pending",
"column": "Status"
}
]
},
"resource": "worksheet",
"workbook": {
"__rl": true,
"mode": "id",
"value": "=notices-workbook-001"
}
},
"credentials": {
"microsoftExcelOAuth2Api": {
"id": "jevPChvDpEJk6W9v",
"name": "Microsoft Excel account - test"
}
},
"typeVersion": 2
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "2046bf84-b64c-40b9-9270-8bbc4455f878",
"connections": {
"003b88f7-1cc6-4170-94ff-32d25a6bb758": {
"main": [
[
{
"node": "cdd53457-2296-42db-ba46-444e2ac7ab6b",
"type": "main",
"index": 0
}
]
]
},
"88cc77ed-4861-4a1a-b4bb-0c491e58a709": {
"main": [
[
{
"node": "5c4b3929-cb7d-45d7-804e-b7281adef0e7",
"type": "main",
"index": 0
}
]
]
},
"5b58440e-6a47-4ba0-94ba-19b998d4204e": {
"main": [
[
{
"node": "5c4b3929-cb7d-45d7-804e-b7281adef0e7",
"type": "main",
"index": 0
}
]
]
},
"5c4b3929-cb7d-45d7-804e-b7281adef0e7": {
"main": [
[]
]
},
"cdd53457-2296-42db-ba46-444e2ac7ab6b": {
"main": [
[
{
"node": "752ae286-9f2d-4c7e-8e01-1ff92966a9c4",
"type": "main",
"index": 0
}
],
[]
]
},
"9d1fd210-9737-4756-a70d-002c899e3f0f": {
"main": [
[
{
"node": "88cc77ed-4861-4a1a-b4bb-0c491e58a709",
"type": "main",
"index": 0
}
]
]
},
"5b817e81-22d2-4618-848e-62b0c286e1b4": {
"main": [
[
{
"node": "5b58440e-6a47-4ba0-94ba-19b998d4204e",
"type": "main",
"index": 0
}
]
]
},
"4ed6aade-7953-401e-9c87-54f159b81428": {
"main": [
[
{
"node": "003b88f7-1cc6-4170-94ff-32d25a6bb758",
"type": "main",
"index": 0
}
]
]
},
"752ae286-9f2d-4c7e-8e01-1ff92966a9c4": {
"main": [
[
{
"node": "9d1fd210-9737-4756-a70d-002c899e3f0f",
"type": "main",
"index": 0
},
{
"node": "5b817e81-22d2-4618-848e-62b0c286e1b4",
"type": "main",
"index": 0
}
]
]
}
}
}このワークフローの使い方は?
上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。
このワークフローはどんな場面に適していますか?
中級 - その他
有料ですか?
このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。
関連ワークフロー
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.
このワークフローを共有