Email နှင့် Notification Automation
ဤသင်ခန်းစာတွင် ဆောက်မည်သော Workflows
Section titled “ဤသင်ခန်းစာတွင် ဆောက်မည်သော Workflows”ဤတွင် Practical Notification Workflow ၃ ခု ဆောက်မည်:
- Gmail → Slack Forwarding
- Form Submit → Email + Slack Notification
- Schedule Daily Report → Email
Workflow 1: Gmail → Slack Forwarding
Section titled “Workflow 1: Gmail → Slack Forwarding”Important Label ပါသော Email ဝင်လာတိုင်း Slack ကို Notify ပေးသည်:
Gmail Trigger: New Email (Poll: 1 min)
Label = "IMPORTANT"?
YES ✅
Slack: Post Message in #alerts
NO ❌
Do nothing
Gmail Trigger Setup
Section titled “Gmail Trigger Setup”- Node Panel မှ Gmail ကို Search ပြုလုပ်ပါ
- Gmail Trigger ကို ရွေးပါ
- Credential — Google OAuth2 ချိတ်ဆက်ပါ (ရှေ့ Credentials သင်ခန်းစာ ကြည့်ပါ)
Gmail Trigger Configuration:
- Event: New Email
- Label: IMPORTANT
- Poll Time: Every 1 minute
IF Node — Label စစ်ပါ
Section titled “IF Node — Label စစ်ပါ”Condition: {{ $json.labelIds.includes("IMPORTANT") }} === trueSlack Message Format
Section titled “Slack Message Format”Slack Node Configuration: Resource: Message Operation: Post Message Channel: #alerts Text: *📧 Important Email!* From: {{ $json.from[0].address }} Subject: {{ $json.subject }} Preview: {{ $json.snippet }}Workflow 2: Contact Form → Multi-channel Notification
Section titled “Workflow 2: Contact Form → Multi-channel Notification”Website Contact Form Submit ဖြစ်တိုင်း Email + Slack + Notion Database ထဲ တပြိုင်တည်း ထည့်သည်:
Webhook: Form Submit → Set: Format Contact Data
Gmail: Notify Admin
Slack: #contact-form channel
Notion: Add to CRM Database
Form Submit တစ်ကြိမ်ဖြင့် Notification ၃ ချောင်း တပြိုင်တည်း ပို့သည်
Webhook Data Format
Section titled “Webhook Data Format”{ "name": "Ko Htun", "email": "htun@gmail.com", "phone": "+959-9123456", "subject": "Website inquiry", "message": "ဆက်သွယ်မေးမြန်းလိုသောကြောင့် ဖေါ်ပြပေးသည်"}Gmail Admin Notification
Section titled “Gmail Admin Notification”Gmail Node: To: admin@yourcompany.com Subject: 🔔 New Contact: {{ $json.subject }} Body: <h2>New Contact Form Submission</h2> <p><strong>Name:</strong> {{ $json.name }}</p> <p><strong>Email:</strong> {{ $json.email }}</p> <p><strong>Phone:</strong> {{ $json.phone }}</p> <p><strong>Message:</strong></p> <p>{{ $json.message }}</p>Slack Message Block
Section titled “Slack Message Block”{ "blocks": [ { "type": "header", "text": { "type": "plain_text", "text": "📬 Contact Form" } }, { "type": "section", "fields": [ { "type": "mrkdwn", "text": "*Name:*\n{{ $json.name }}" }, { "type": "mrkdwn", "text": "*Email:*\n{{ $json.email }}" } ] }, { "type": "section", "text": { "type": "mrkdwn", "text": "{{ $json.message }}" } } ]}Workflow 3: Daily Report Email
Section titled “Workflow 3: Daily Report Email”တနင်္လာ-သောကြာ မနက် ၉ နာရီ Report Email ပို့သည်:
Schedule Trigger 0 9 * * 1-5
HTTP Request Fetch Analytics Data
Code Node Calculate Stats
Gmail Send Daily Report
တနင်္လာ-သောကြာ နေ့တိုင်း မနက် ၉ နာရီ Report Email ပို့သည်
Report Email Template
Section titled “Report Email Template”// Code Node — Report ပြုစုခြင်းconst data = $input.first().json;
const report = { date: new Date().toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }), totalOrders: data.orders.length, revenue: data.orders.reduce((sum, o) => sum + o.total, 0), topProduct: data.orders .flatMap(o => o.items) .sort((a, b) => b.quantity - a.quantity)[0]?.name || 'N/A'};
return [{ json: report }];Email HTML Body
Section titled “Email HTML Body”<div style="font-family: Arial, sans-serif; max-width: 600px;"> <h1 style="color: #333;">📊 Daily Report — {{ $json.date }}</h1>
<table style="width: 100%; border-collapse: collapse;"> <tr style="background: #f5f5f5;"> <td style="padding: 12px; border: 1px solid #ddd;"> <strong>Total Orders</strong> </td> <td style="padding: 12px; border: 1px solid #ddd;"> {{ $json.totalOrders }} </td> </tr> <tr> <td style="padding: 12px; border: 1px solid #ddd;"> <strong>Revenue</strong> </td> <td style="padding: 12px; border: 1px solid #ddd;"> ${{ $json.revenue }} </td> </tr> <tr style="background: #f5f5f5;"> <td style="padding: 12px; border: 1px solid #ddd;"> <strong>Top Product</strong> </td> <td style="padding: 12px; border: 1px solid #ddd;"> {{ $json.topProduct }} </td> </tr> </table></div>Telegram Notification ထည့်ခြင်း
Section titled “Telegram Notification ထည့်ခြင်း”Slack အစား Telegram ဖြင့် Notify ပေးလိုပါက:
Telegram Bot ဖန်တီးနည်း
Section titled “Telegram Bot ဖန်တီးနည်း”- Telegram မှ @BotFather ကို Chat ဖွင့်ပါ
/newbotCommand ပေးပါ- Bot Name နှင့် Username ပေးပါ
- Bot Token ကို ရပါမည် (ဥပမာ:
123456:ABCdef...)
n8n Telegram Node
Section titled “n8n Telegram Node”Telegram Node: Chat ID: [Your Chat ID or Group ID] Text: 🔔 *New Order Received!*
Order #{{ $json.orderId }} Customer: {{ $json.customerName }} Amount: ${{ $json.total }} Status: {{ $json.status }}Error Handling အခြေခံ
Section titled “Error Handling အခြေခံ”Email / Notification Fail ဖြစ်ရင် Retry နှင့် Fallback:
Gmail: Send Email
❌ Error?
Wait: 5 minutes Error ဖြစ်ရင်
Retry
Gmail: Retry Send
❌ Still Error?
Slack: Alert Still error ဆိုရင်
Email Fail → Wait → Retry → Slack Alert (Fallback)
နောက်သင်ခန်းစာမှာ API Integration — Real Services တွေနဲ့ ချိတ်ဆက်နည်း ဆက်လက်လေ့လာမည်!