Telegram Transaction Notifier¶
Status: Active Trigger: Schedule (every 3 seconds) Created: 2026-04-11
Purpose¶
Automatically notify 'Exzen Card Show' Telegram group whenever a DBS bank transaction is received via exzenpayments@gmail.com. Parses the bank email for transaction details (amount, sender, time, reference) and sends a formatted message.
Business context: Staff team needs real-time visibility into incoming payments for card show sales. Instead of manually checking email, this workflow pushes notifications to the shared Telegram group within seconds of receiving a DBS alert.
Workflow Flow¶
Schedule Trigger (3s)
↓
Gmail (Get Many) — fetch emails labeled "dbs-notif-not-notified" from ibanking.alert@dbs.com
↓
Gmail (Get Single) — get full email HTML content
↓
Parse Transaction — extract amount, sender, time, reference via regex
↓
Telegram — send formatted message to Card Show group
↓
Gmail (Remove 'Not Notified' Label)
↓
Gmail (Add 'Notified' Label) — prevents duplicate notifications
How It Works¶
1. Schedule Trigger¶
Polls every 3 seconds (*/3 * * * * *). This is aggressive but ensures near-instant notifications.
2. Gmail (Get Many)¶
Searches for emails matching:
label:dbs-notif-not-notified from:ibanking.alert@dbs.com
3. Gmail (Get Single)¶
Fetches the full email content (including HTML body) for each matched email. The "Get Many" node returns metadata only — "Get Single" retrieves the actual email body needed for parsing.
4. Parse Transaction (Code Node)¶
Strips HTML tags from the email body and extracts four fields using regex:
| Field | Regex pattern | Example match |
|---|---|---|
| Amount | received\s+(SGD\s*[\d\.]+) |
SGD 150.00 |
| Time | on\s+(\d{1,2}\s+[a-zA-Z]{3}\s+\d{4}\s+\d{2}:\d{2}\s*[A-Z]{3}) |
11 Apr 2026 14:30 SGT |
| Sender name | From:[\s\u200B-\u200D\uFEFF\u202F\xA0]*([^\r\n]+) |
JOHN DOE |
| Reference | Transaction Ref:[\s\u200B-\u200D\uFEFF\u202F\xA0]*([^\r\n]+) |
FT26101ABC123 |
Note
The regex handles Unicode zero-width characters (\u200B-\u200D, \uFEFF, \u202F, \xA0) that DBS embeds in their email HTML. Without this, the "From" and "Transaction Ref" fields fail to match.
5. Telegram (Notify Card Show Group)¶
Sends a formatted message to the team group:
🚨 *New Transaction Received* 🚨
👤 *Name:* JOHN DOE
💰 *Amount:* SGD 150.00
🕒 *Time:* 11 Apr 2026 14:30 SGT
📄 *Ref:* FT26101ABC123
6. Gmail Label Management¶
After notification is sent:
1. Remove the dbs-notif-not-notified label
2. Add the dbs-notif-notified label
This ensures each email is only processed once. The next polling cycle skips already-notified emails.
Setup Requirements¶
Gmail Labels (create manually in Gmail)¶
| Label | Purpose |
|---|---|
dbs-notif-not-notified |
Applied to incoming DBS alerts (via Gmail filter) |
dbs-notif-notified |
Applied after notification is sent |
Gmail filter to auto-label incoming DBS emails:
- From:
ibanking.alert@dbs.com - Action: Apply label
dbs-notif-not-notified
Gmail OAuth Credential Setup¶
Since n8n is self-hosted on n8n.exzentcg.com, you need your own Google Developer credentials (Client ID + Secret) to connect Gmail. This is free and takes ~5 minutes.
Step 1 — Create a Google Cloud Project
- Go to Google Cloud Console and log in with the Gmail account you want to read emails from
- Top-left corner → click the Select a Project dropdown → New Project
- Name:
n8n-gmail→ Create - Make sure this project is selected at the top
Step 2 — Enable the Gmail API
- Sidebar → APIs & Services → Library
- Search for Gmail API → click it → Enable
Step 3 — Configure the OAuth Consent Screen
- Sidebar → APIs & Services → OAuth consent screen
- Choose External → Create
- App Information:
- App Name:
n8n - User Support Email: your Gmail address
- App Name:
- Scroll to bottom → enter your email under Developer contact information → Save and Continue
- Scopes: Skip — just click Save and Continue (n8n requests the scopes it needs automatically)
- Test Users: Click Add Users → type your exact Gmail address (e.g.,
exzenpayments@gmail.com) → Add → Save and Continue → Back to Dashboard
Warning
You MUST add yourself as a test user. Without this, Google will reject your login attempt when connecting n8n.
Step 4 — Generate Client ID and Secret
- Sidebar → APIs & Services → Credentials
- + CREATE CREDENTIALS → OAuth client ID
- Application type: Web application
- Name:
n8n web app - Under Authorized redirect URIs → + ADD URI → paste:
https://n8n.exzentcg.com/rest/oauth2-credential/callback - Create
Step 5 — Connect in n8n
- Copy the Client ID and Client Secret from the popup
- In n8n → create a new Gmail OAuth2 credential → paste both values
- Click Sign in with Google
- Google will warn "Google hasn't verified this app" (because the app is in Testing mode) → click Advanced → Go to n8n (unsafe) → check the permission boxes → Continue
Note
The "unverified app" warning is normal and expected for self-hosted apps in Testing mode. It only appears for the test users you added in Step 3. To remove the warning permanently, you'd need to submit the app for Google verification — unnecessary for personal/team use.
Telegram Bot Setup¶
Step 1 — Create a bot
- Open Telegram → search for @BotFather → start a chat
- Send
/newbot - Follow the prompts: give it a name and username
- BotFather gives you a bot token (looks like
123456:ABC-DEF...) — save this
Step 2 — Add bot to your group
- Open the target Telegram group
- Add the bot as a member (Group Settings → Add Members → search for your bot's username)
- Send any message in the group (to generate activity)
Step 3 — Get the group chat ID
Open this URL in your browser (replace <TOKEN> with your bot token):
https://api.telegram.org/bot<TOKEN>/getUpdates
Look for "chat":{"id":-100XXXXXXXXXX} in the response. The negative number is your chat ID.
Step 4 — Connect in n8n
- In n8n → create a new Telegram API credential → paste the bot token
- In the Telegram node → set
chatIdto the group chat ID (e.g.,-1002523639741)
Step 5 — Optional: reply threading
The workflow sends messages as replies to a specific message (message ID 4852 in the reply_to_message_id parameter). This keeps notifications threaded under a pinned "Transaction Notifications" topic. To change:
1. Pin a message in the group that says "Transaction Notifications" (or similar)
2. Right-click that message → Copy Message Link → the number at the end of the URL is the message ID
3. Update reply_to_message_id in the Telegram node
Troubleshooting¶
| Problem | Cause | Fix |
|---|---|---|
| No notifications sent | No emails with dbs-notif-not-notified label |
Check Gmail filter is applying the label to new DBS emails |
| Duplicate notifications | Label management failing | Check Gmail credentials have modify permission. Verify label IDs in the workflow match your Gmail labels |
| Parsing returns "Unknown" | DBS email format changed | Open a recent DBS email, view source HTML, update regex in the Parse Transaction code node |
| Telegram "chat not found" | Bot removed from group, or wrong chat ID | Re-add bot to group, get fresh chat ID from getUpdates |
| High CPU / rate limiting | 3-second polling too aggressive | Change cron to */10 * * * * * (10 seconds) or * * * * * (1 minute) |
Export¶
The raw n8n workflow JSON is stored at exports/telegram-transaction-notifier.n8n. Import via n8n UI: Settings → Import from File.