Verteilungsworkflow für Schulbenachrichtigungen über WhatsApp und E-Mail

Fortgeschritten

Dies ist ein Miscellaneous-Bereich Automatisierungsworkflow mit 10 Nodes. Hauptsächlich werden If, Code, EmailSend, HttpRequest, MicrosoftExcel und andere Nodes verwendet. Automatisierung der Verteilung von Schulbenachrichtigungen über WhatsApp, E-Mail und Excel

Voraussetzungen
  • Möglicherweise sind Ziel-API-Anmeldedaten erforderlich

Kategorie

Workflow-Vorschau
Visualisierung der Node-Verbindungen, mit Zoom und Pan
Workflow exportieren
Kopieren Sie die folgende JSON-Konfiguration und importieren Sie sie in n8n
{
  "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": "Tägliche Mitteilungsprüfung - 9 Uhr",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -500,
        400
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "cdd53457-2296-42db-ba46-444e2ac7ab6b",
      "name": "Mitteilungsdaten validieren",
      "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": "Mitteilungsverteilung verarbeiten",
      "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": "E-Mail-Inhalt vorbereiten",
      "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-Inhalt vorbereiten",
      "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": "E-Mail-Mitteilung senden",
      "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-Mitteilung senden",
      "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": "Mitteilungsstatus aktualisieren",
      "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": "Workflow-Dokumentation",
      "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": "Mitteilungen lesen",
      "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
          }
        ]
      ]
    }
  }
}
Häufig gestellte Fragen

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

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.

Workflow-Informationen
Schwierigkeitsgrad
Fortgeschritten
Anzahl der Nodes10
Kategorie1
Node-Typen7
Schwierigkeitsbeschreibung

Für erfahrene Benutzer, mittelkomplexe Workflows mit 6-15 Nodes

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

Externe Links
Auf n8n.io ansehen

Diesen Workflow teilen

Kategorien

Kategorien: 34