Magento to Telegram, promo alerts without duplicates
Your Telegram channel goes quiet, then suddenly you remember you meant to post that new product. Or worse, you post the same coupon twice and people start ignoring your “urgent” messages. That’s why Magento Telegram alerts can’t be “when someone has time.”
E-commerce managers feel it first because promos have a shelf life. But store owners running lean teams get hit too, and marketers trying to build a consistent community end up babysitting posts instead of planning campaigns.
This n8n workflow monitors Magento 2 for new products and coupons, formats a clean Telegram post, and uses MySQL to prevent repeats. You’ll see how the automation works, what you need, and the practical results you can expect.
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: Magento to Telegram, promo alerts without duplicates
flowchart LR
subgraph sg0["Schedule Flow"]
direction LR
n0@{ icon: "mdi:play-circle", form: "rounded", label: "Schedule Trigger", pos: "b", h: 48 }
n1["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Get Rule Info"]
n2@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Coupon Status", pos: "b", h: 48 }
n3["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>Post to Telegram1"]
n4["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/telegram.svg' width='40' height='40' /></div><br/>Product Alert to Telegram"]
n5["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/mysql.dark.svg' width='40' height='40' /></div><br/>Init Database"]
n6["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Fetch New Product"]
n7["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Get Product Info"]
n8["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/mysql.dark.svg' width='40' height='40' /></div><br/>Set Coupon as Posted"]
n9["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/mysql.dark.svg' width='40' height='40' /></div><br/>Set Product as Posted"]
n10["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Get Latest Offer"]
n11["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Product Message Format"]
n12["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Voucher Message Format"]
n13["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/mysql.dark.svg' width='40' height='40' /></div><br/>New Voucher Entry"]
n14["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/mysql.dark.svg' width='40' height='40' /></div><br/>New Product Entry"]
n15@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Product Status", pos: "b", h: 48 }
n16["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/x.dark.svg' width='40' height='40' /></div><br/>Voucher to X"]
n17["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/x.dark.svg' width='40' height='40' /></div><br/>Product X Post"]
n18@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Voucher Duplication Protection", pos: "b", h: 48 }
n19@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Product Duplication Protection", pos: "b", h: 48 }
n16 --> n8
n2 --> n12
n1 --> n2
n15 --> n11
n17 --> n9
n10 --> n13
n7 --> n15
n0 --> n10
n0 --> n5
n0 --> n6
n6 --> n14
n14 --> n19
n13 --> n18
n3 --> n8
n11 --> n4
n11 --> n17
n12 --> n3
n12 --> n16
n4 --> n9
n19 --> n7
n18 --> n1
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n0 trigger
class n2,n15,n18,n19 decision
class n5,n8,n9,n13,n14 database
class n1,n6,n7,n10 api
class n11,n12 code
class n16 disabled
classDef customIcon fill:none,stroke:none
class n1,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n16,n17 customIcon
The Problem: Promo posts get missed (or repeated)
Posting new arrivals and coupon drops sounds simple until you’re living inside the day-to-day chaos of an online store. Someone has to check Magento, copy a product name, grab a price, find an image, paste a link, write a message, and then do it again for coupons. The “quick post” turns into a distracting mini-project. And when it’s manual, duplicates sneak in. You either annoy subscribers with repeat alerts or you stop posting entirely because it feels messy and risky.
It adds up fast. Here’s where it breaks down in real stores:
- You lose the first few hours of momentum after a product goes live because nobody is watching Magento at the right time.
- Duplicate coupon posts happen when two people promote the same rule, or when you forget what was already shared last week.
- Formatting is inconsistent, which means links get buried and images are forgotten (the exact things that drive taps).
- You end up relying on “tribal knowledge” in Slack or a note somewhere instead of a system that scales with your catalog.
The Solution: Scheduled Magento monitoring + duplicate-proof Telegram posts
This workflow runs on a schedule (by default, once per hour) and checks Magento for two things: newly available products and the latest voucher/coupon rules exposed via the Magento REST API. When it finds something new, it records the item in a MySQL table, checks if it has been posted before, and only continues if it’s truly new. Then it pulls the details it needs (like product name, price, URL, images, or coupon status and usage limits), formats a tidy message with Markdown, and publishes it to Telegram automatically. After a successful post, it updates MySQL so the same product or coupon can’t be sent again by accident.
The workflow starts with a scheduled trigger and initializes the tracking table in MySQL. From there it runs two tracks: one for vouchers and one for products, each with a “duplicate check → validate status → format → post” pattern. Finally, it marks the item as posted so your channel stays clean.
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say you run 2 promo pushes a day (one new product, one coupon) and you post them to Telegram manually. If each post takes about 15 minutes to collect details, grab an image, format the message, and double-check you didn’t already share it, that’s about 30 minutes daily. This workflow turns that into a scheduled check plus automated posting, so your “time spent” drops to maybe 5 minutes a week to review the channel and tweak copy when needed. The posts still go out even when you’re busy with support tickets.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Magento 2 REST API access for products and coupon rules
- Telegram Bot to publish into your channel
- MySQL database credentials (create a user with INSERT/SELECT)
Skill level: Intermediate. You’ll paste API credentials, map a few fields, and run a quick MySQL table setup.
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
Scheduled check runs automatically. The workflow starts with a Schedule Trigger (set to every hour by default). It also runs a MySQL “initialize table” step so tracking exists even if you deploy this on a fresh database.
Magento data is pulled for coupons and products. It calls Magento over HTTP Request to retrieve the latest voucher/coupon info and new product data. Each item gets inserted into MySQL first so you have a record of what the workflow has seen.
Duplicates and inactive items get filtered out. Two separate If checks handle “already posted?” and “is this valid/active?” so you don’t promote dead coupons or unavailable products. Frankly, this is where most DIY automations fall apart because they skip the boring guardrails.
Messages are formatted and posted. A code step formats a Markdown message (product name, price, image, link, or coupon code with usage/status details), then Telegram sends it to your channel. The workflow can also publish to X/Twitter, but Telegram is the core output.
You can easily modify the schedule (hourly to every 15 minutes) or the message template (short vs. detailed) based on your needs. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Schedule Trigger
Set the workflow to run on a regular interval so new vouchers and products are checked automatically.
- Add and open Scheduled Automation Start.
- Set the schedule rule to run every hour by configuring Rule → Interval with Field set to
hours. - Confirm Scheduled Automation Start outputs to Retrieve Latest Voucher, Initialize Storage Table, and Retrieve New Product in parallel.
Step 2: Connect Database Storage (MySQL)
Initialize and update the storage table used to prevent duplicate postings.
- Open Initialize Storage Table and set Operation to
executeQuery. - Set Query to
CREATE TABLE IF NOT EXISTS posted_items (item_id INT PRIMARY KEY, item_type ENUM('product', 'coupon') NOT NULL, item_value VARCHAR(255), posted BOOLEAN DEFAULT FALSE, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);. - In Insert Voucher Record and Insert Product Record, keep Operation as
executeQueryand preserve the SQL that inserts new items and selects the current row. - In Mark Voucher Posted and Mark Product Posted, keep Query set to the update statements using
{{$('Retrieve Latest Voucher').item.json.items[0].rule_id}}and{{$('Validate Product Status').item.json.id}}. - Credential Required: Connect your MySQL credentials to all database nodes (5 nodes handle table initialization, inserts, and status updates).
Step 3: Connect Voucher and Product Data Sources
Pull the latest voucher and product data from your store’s API endpoints.
- Open Retrieve Latest Voucher and set URL to
{{$vars.STORE}}/rest/V1/coupons/search?searchCriteria[sortOrders][0][field]=created_at&searchCriteria[sortOrders][0][direction]=DESC&searchCriteria[pageSize]=1. - Set Authentication to
genericCredentialTypeand Generic Auth Type tohttpHeaderAuthin Retrieve Latest Voucher. - Open Retrieve New Product and set URL to
{{$vars.STORE}}rest/V1/products?searchCriteria[sortOrders][0][field]=created_at&searchCriteria[sortOrders][0][direction]=DESC. - Set Authentication to
headerAuthand enable Allow Unauthorized Certs if required in Retrieve New Product. - Open Fetch Rule Details and set URL to
https://magekwik.com/rest/V1/salesRules/{{$json.item_id}}. - Open Fetch Product Details and set URL to
https://your-website.com/rest/default/V1/products/{{$json.item_value}}. - Credential Required: Connect your HTTP Header Auth credentials to Retrieve Latest Voucher, Fetch Rule Details, and Fetch Product Details.
- Credential Required: Connect your Header Auth credentials to Retrieve New Product.
$vars.STORE variable is defined in your n8n environment so API URLs resolve correctly.Step 4: Configure Duplicate Checks and Status Validation
Prevent reposting the same item and ensure only active items are announced.
- Open Voucher Duplicate Check and confirm the condition checks Left Value
{{$json.posted}}equals1with loose type validation. - Open Product Duplicate Check and confirm the condition checks Left Value
{{$json.posted}}equals1. - In Validate Voucher Status, verify the boolean true check uses
{{$json.is_active}}. - In Validate Product Status, verify the status/active check compares
{{$json.status}}and{{$json.is_active}}. - Confirm the flow continues from Fetch Rule Details → Validate Voucher Status → Format Voucher Message, and from Fetch Product Details → Validate Product Status → Format Product Message.
Step 5: Set Up Message Formatting
Format the alert content for Telegram and X using the code nodes.
- Open Format Voucher Message and keep the JavaScript Code as-is to generate the
coupontext from Retrieve Latest Voucher and Fetch Rule Details. - Open Format Product Message and keep the JavaScript Code that builds
messageandimagefrom product data. - Confirm the execution splits in parallel: Format Voucher Message outputs to both Send Voucher to Telegram and Publish Voucher to X in parallel.
- Confirm the execution splits in parallel: Format Product Message outputs to both Send Product to Telegram and Publish Product to X in parallel.
Step 6: Configure Telegram and X Publishing
Deliver the formatted alerts to Telegram and X, then mark items as posted.
- Open Send Voucher to Telegram and set Text to
{{$json.coupon}}; add your Telegram Chat ID. - Open Publish Voucher to X and set Text to
{{$json.coupon}}. Note the node is disabled by default; enable it when ready. - Open Send Product to Telegram and set Operation to
sendMediaGroupwith Media set to{{$json.image}}and Caption to{{$json.message}}; add your Telegram Chat ID. - Open Publish Product to X and set Text to
{{$json.image}} {{$json.message}}. - Confirm Send Voucher to Telegram and Publish Voucher to X both flow into Mark Voucher Posted, and Send Product to Telegram and Publish Product to X both flow into Mark Product Posted.
- Credential Required: Connect your Telegram Bot credentials to Send Voucher to Telegram and Send Product to Telegram.
- Credential Required: Connect your Twitter credentials to Publish Voucher to X and Publish Product to X.
Step 7: Test and Activate Your Workflow
Run a manual test to confirm data retrieval, posting, and database updates before enabling the schedule.
- Click Execute Workflow to run Scheduled Automation Start once.
- Verify that new items flow through Retrieve Latest Voucher and Retrieve New Product, and that Insert Voucher Record and Insert Product Record return rows.
- Confirm messages are posted via Send Voucher to Telegram and Send Product to Telegram, and check X posts if Publish Voucher to X or Publish Product to X are enabled.
- Check the database to confirm Mark Voucher Posted and Mark Product Posted set
posted = 1. - When successful, switch the workflow to Active to run on the schedule.
Common Gotchas
- Magento API credentials can expire or lack access to coupon rules. If calls fail, check your Magento integration token/permissions and confirm the REST endpoint exposes rule details.
- If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Telegram bot posting fails surprisingly often because the bot isn’t an admin in the channel yet. Add the bot to the channel first, then re-check the chat/channel ID in n8n.
Frequently Asked Questions
About an hour if your Magento API and Telegram bot are ready.
No. You’ll connect Magento, Telegram, and MySQL, then adjust a few fields. The only “technical” part is pasting credentials and testing one run.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in your hosting and database costs (MySQL is often included with your server).
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Yes, but you’ll want to disable the voucher branch cleanly. In n8n, you can turn off the “Retrieve Latest Voucher” path (and its related duplicate check, formatting, and Telegram send nodes) while keeping the product nodes active. Common customizations include changing the schedule to every 15 minutes during launches, shortening the Telegram message to one line plus link, or adding extra fields like category and stock status so subscribers get better context.
Usually the bot isn’t allowed to post in the channel yet. Add the bot to the channel, make it an admin, then confirm you’re using the correct chat ID in n8n. If it still fails, regenerate the bot token in BotFather and update the Telegram credentials in n8n.
A lot, as long as your Magento API and database can keep up.
Often, yes, because duplicate prevention is the whole point here and n8n handles that logic (with MySQL checks, branching, and “mark as posted” updates) without feeling like you’re fighting the tool. Zapier and Make can do it, but the database-style tracking usually means extra steps, extra cost, and more fragile logic once you add both coupons and products. n8n also gives you the option to self-host, which is useful if you’re checking hourly forever. If you only need a simple “new product → send message” flow, those tools can be quicker to start. If you’re unsure, Talk to an automation expert and get a recommendation based on your volume.
Once this is running, your Telegram channel stays timely without becoming another daily task. Set it up, let MySQL prevent repeats, and get your promos out while they still matter.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.