Telegram + OpenAI: instant best price replies
Price-checking a product sounds simple until you’re juggling search results, sponsored listings, region-specific Amazon pages, and “out of stock” traps. Then you copy a number into a chat, someone questions it, and you’re back to tab-hopping again.
This Telegram price automation is a lifesaver for marketers validating offers, founders doing quick market checks, and agency folks who need client-ready numbers without the mess. You send a product name. You get a clean “best price” reply back in Telegram. Fast.
Below, you’ll see how the workflow pulls sources reliably (without getting blocked), uses OpenAI to extract the real price, and replies in a format you can share with confidence.
How This Automation Works
See how this solves the problem:
n8n Workflow Template: Telegram + OpenAI: instant best price replies
flowchart LR
subgraph sg0["Telegram Flow"]
direction LR
n0["<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/>Telegram Trigger"]
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/code.svg' width='40' height='40' /></div><br/>Build Queries"]
n2@{ icon: "mdi:robot", form: "rounded", label: "AI Extraction Agent", pos: "b", h: 48 }
n3@{ icon: "mdi:cog", form: "rounded", label: "Google Search", pos: "b", h: 48 }
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/code.svg' width='40' height='40' /></div><br/>Extract & Filter URLs"]
n5@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Router (Amazon vs. Other)", pos: "b", h: 48 }
n6@{ icon: "mdi:cog", form: "rounded", label: "Scrape Amazon", pos: "b", h: 48 }
n7@{ icon: "mdi:swap-vertical", form: "rounded", label: "Loop (Amazon)", pos: "b", h: 48 }
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/code.svg' width='40' height='40' /></div><br/>Clean HTML (Amazon)"]
n9@{ icon: "mdi:cog", form: "rounded", label: "Scrape Other", pos: "b", h: 48 }
n10@{ icon: "mdi:swap-vertical", form: "rounded", label: "Loop (Other)", pos: "b", h: 48 }
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/>Clean HTML (Other)"]
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/>Score Match (Other)"]
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/code.svg' width='40' height='40' /></div><br/>Score Match (Amazon)"]
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/code.svg' width='40' height='40' /></div><br/>Pick Best (Amazon)"]
n15["<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/>Pick Best (Other)"]
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/merge.svg' width='40' height='40' /></div><br/>Merge Results"]
n17@{ icon: "mdi:brain", form: "rounded", label: "GPT Model", pos: "b", h: 48 }
n18["<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/>Format Context"]
n19["<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/>Send Reply"]
n17 -.-> n2
n10 --> n15
n10 --> n9
n9 --> n11
n1 --> n3
n3 --> n4
n7 --> n14
n7 --> n6
n16 --> n18
n6 --> n8
n18 --> n2
n0 --> n1
n15 --> n16
n11 --> n12
n14 --> n16
n2 --> n19
n8 --> n13
n12 --> n10
n13 --> n7
n4 --> n5
n5 --> n7
n5 --> n10
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 ai
class n17 aiModel
class n5 decision
class n1,n4,n8,n11,n12,n13,n14,n15,n18 code
classDef customIcon fill:none,stroke:none
class n0,n1,n4,n8,n11,n12,n13,n14,n15,n16,n18,n19 customIcon
The Challenge: Quick price checks turn into a time sink
You just want a straight answer: “What’s the lowest price for this product right now?” But manual checking usually means opening Google, scanning a page full of ads, clicking into marketplaces, and then wrestling with pages that load differently by country or account state. If you’re doing this for a team, it gets worse. One person sees a price, another sees a different seller, and now you’re debating screenshots instead of making a decision. Honestly, the mental load is the real cost, because it steals focus at the exact moment you’re trying to move fast.
It adds up fast. Here’s where it breaks down in real life.
- Google results are noisy, and sponsored listings often look like “real” deals.
- Amazon and similar sites frequently block scraping attempts, so DIY bots fail right when you need them.
- Even when a page loads, the price is buried in messy HTML, which makes manual copy-paste surprisingly error-prone.
- People share different formats (“EGP 12,999”, “12.9k”, “$260”), and the conversation turns into clarification instead of action.
The Fix: Telegram-to-AI best price replies (without blocked scraping)
This workflow turns a simple Telegram message into a reliable best-price summary you can trust. You message your bot something like “Sony XM5”. The automation builds smart search queries, asks Decodo to run a Google lookup, then collects valid product URLs. From there, it scrapes those pages through Decodo (which handles the tricky proxy and fingerprinting parts so requests don’t get blocked), cleans up the HTML, and scores how well each page matches the product you asked for. Finally, an AI extraction assistant paired with the OpenAI Chat Model reads the cleaned text, ignores clutter like ads or unrelated modules, pulls out the product name and price, and sends a clear “Best Price” reply back to Telegram.
The workflow starts in Telegram, then branches into Amazon and non-Amazon sources so each can be handled properly. It loops through results in batches, selects the top matches, and combines them into one context for OpenAI. The output is a tidy message you can forward to your team without rewriting it.
What Changes: Before vs. After
| What This Eliminates | Impact You’ll See |
|---|---|
|
|
Real-World Impact
Say you check 10 products per week for campaigns or client work. Manually, you might spend about 10 minutes searching and opening pages, plus another 10 minutes confirming the price and sharing it cleanly, so call it about 20 minutes per product. That’s roughly 3 hours a week. With this workflow, you send 10 Telegram messages (maybe 2 minutes total), wait for processing, and you’re done. You get those 3 hours back, and the answers are more consistent.
Requirements
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Telegram Bot to receive and send messages.
- Decodo for Google lookup and reliable scraping.
- OpenAI API key (get it from your OpenAI dashboard).
Skill level: Intermediate. You’ll connect accounts, add API keys, and tweak a prompt/query if you want different stores.
Need help implementing this? Talk to an automation expert (free 15-minute consultation).
The Workflow Flow
Telegram message triggers the lookup. You send a product name to your bot, and n8n receives it through the Telegram trigger with your webhook configured.
Search queries are composed, then Decodo runs the Google search. The workflow builds queries aimed at marketplaces (for example, Amazon.eg) and requests results through Decodo so you get usable URLs without the usual scraping headaches.
URLs are split into Amazon vs. other sources, then scraped in batches. Each branch loops over links, fetches page content safely with Decodo, and sanitizes the HTML so the next step doesn’t choke on noise.
OpenAI extracts the best price and returns a clean reply. The automation scores matches, selects top candidates, merges results into a single context, and the AI agent pulls out the product name and lowest price before sending your Telegram response.
You can easily modify the store targets in the search query to include Noon or Carrefour based on your needs. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Telegram Trigger
This workflow starts when a user sends a message to Telegram. You’ll capture the incoming query and use it throughout the workflow.
- Add and open Telegram Intake Trigger.
- Keep Updates set to
message. - Credential Required: Connect your Telegram Bot API credentials.
- Leave Additional Fields empty unless you need custom filters.
Step 2: Build Search Queries and Fetch URLs
These nodes create store-specific search queries, run a Google search, and collect valid URLs for scraping.
- Open Compose Search Queries and keep the provided JavaScript (it generates queries for Amazon and Jumia).
- In Google Lookup Request, set Query to
{{ $json.query }}, Operation togoogle_search, and Results Limit to1. - Credential Required: Connect your Decodo credentials in Google Lookup Request.
- In Collect Valid URLs, keep the JavaScript that deduplicates and limits URLs to
20.
Step 3: Route URLs and Loop Through Amazon vs Other Stores
The workflow separates Amazon links from other stores and processes them in batches.
- In Route Amazon vs Others, set the condition to String → Contains with Left Value
{{ $json.url }}and Right Valueamazon. - Ensure Route Amazon vs Others routes true to Batch Loop Amazon and false to Batch Loop Other.
- In both Batch Loop Amazon and Batch Loop Other, leave Options empty to iterate through all URLs.
Step 4: Scrape and Clean Page Content
Each URL is scraped and sanitized before scoring relevance. This step covers Amazon-specific and general page scraping.
- In Amazon Page Scraper, set URL to
{{ $('Collect Valid URLs').item.json.url }}, Operation toamazon, and Parse tofalse. - Credential Required: Connect your Decodo credentials in Amazon Page Scraper and General Page Scraper.
- In General Page Scraper, set URL to
{{ $json.url }}. - Keep the existing JavaScript in Sanitize Amazon HTML and Sanitize Other HTML to remove scripts, styles, and HTML tags.
Step 5: Score Matches and Select the Best Result
Both Amazon and non-Amazon pages are scored for relevance against the user’s Telegram message, then the highest match is selected.
- Keep the JavaScript in Score Amazon Match and Score Other Match (they dynamically compare the page text against the Telegram query).
- Ensure Score Amazon Match routes back into Batch Loop Amazon and Score Other Match routes back into Batch Loop Other.
- Keep the JavaScript in Select Top Amazon and Select Top Other to select the highest scoring match.
- Verify Select Top Amazon and Select Top Other both feed into Combine Result Sets.
Step 6: Merge Context and Configure AI Extraction
The results are combined, formatted, and sent to an AI agent for final comparison output.
- In Combine Result Sets, leave the default merge behavior to unify Amazon and other results.
- In Assemble Context Text, keep the JavaScript that outputs text (this field name is required).
- In AI Extraction Assistant, set Text to
User search intent: {{ $('Telegram Intake Trigger').first().json.message.text }} Scraped data (multiple sources): {{ $json.text }}. - Open OpenAI Chat Model and select Model
gpt-4o-mini. - Credential Required: Connect your OpenAI credentials in OpenAI Chat Model. It is the language model used by AI Extraction Assistant.
Step 7: Configure the Telegram Response
The AI’s output is sent back to the Telegram user who started the workflow.
- Open Send Telegram Response and set Text to
{{ $json.output }}. - Set Chat ID to
{{ $('Telegram Intake Trigger').item.json.message.chat.id }}. - Credential Required: Connect your Telegram Bot API credentials in Send Telegram Response.
Step 8: Test and Activate Your Workflow
Run a manual test to confirm everything works, then activate the workflow for ongoing use.
- Click Execute Workflow and send a product name to your Telegram bot.
- Verify that Google Lookup Request returns URLs, and that AI Extraction Assistant produces a single response message.
- Confirm the bot replies in Telegram via Send Telegram Response.
- Toggle the workflow to Active to run it in production.
Watch Out For
- Decodo credentials can expire or need specific permissions. If things break, check your Decodo API key and usage status in the Decodo dashboard first.
- If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.
Common Questions
About an hour if you already have your API keys.
Yes, but you’ll want someone comfortable with connecting accounts and pasting credentials. No coding is required unless you want to change how queries are built.
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 OpenAI API usage and your Decodo plan.
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.
You can widen or narrow the store coverage by editing the query logic in the “Compose Search Queries” part of the workflow. If you prefer a different AI provider, swap the OpenAI Chat Model for Claude or Gemini in the model node and keep the same extraction instructions in the AI agent. Common tweaks include changing which domains you search (Noon, Carrefour), adjusting the reply tone, and logging searches to Google Sheets for trend tracking.
Most of the time it’s a webhook issue or the bot token is wrong. Confirm the bot token in your Telegram node, then verify your webhook is actually set so the bot can “hear” messages. If it works once and then stops, regenerate the token and re-save credentials in n8n.
On a typical n8n Cloud plan, you’re mainly limited by executions per month and how many URLs you scrape per request. If you self-host, the practical limit becomes your server size plus your Decodo and OpenAI rate limits, not n8n itself. For many small teams, handling dozens of lookups a day is realistic. If you expect hundreds a day, you’ll want tighter batching and stricter filtering so you scrape fewer pages per query.
Often, yes. This workflow relies on branching, batching, and custom parsing logic, and n8n tends to handle that kind of “real workflow” better without turning every path into extra cost. Zapier or Make can still work if you keep the flow simple, but scraping + AI extraction usually gets clunky fast. Also, self-hosting n8n is a big deal if you plan to scale. If you want a sanity check, Talk to an automation expert and we’ll map it to your volume and tools.
Once this is running, price checks become a quick message instead of a mini research project. The workflow handles the repetitive digging so you can make the call and move on.
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.