Run a Telegram hotel search bot with OpenAI and WinWin MCP

Go to Workflow
0 views
Built by Vadym Vadym
Created on September 01, 2026

Description

Quick overview
This workflow powers a Telegram hotel demo bot that uses OpenAI and the WinWin MCP to search live hotel offers, send rich offer cards with booking links, and store/retrieve validated hotel and room photo galleries via an n8n Data Table.

How it works
Triggers on incoming Telegram messages and button taps (callback queries) and routes them by type (start, free-text search, gallery request, or other actions).
Sends a welcome message for "/start" or acknowledges a search request with a “searching” message.
Uses an OpenAI-powered agent with Postgres chat memory to interpret the user’s request and call the WinWin MCP search (and filters when needed) while validating photo URLs via the Photo Validation tool.
Parses the agent’s structured output into a list of up to three offers and, if none are returned, sends the search summary as a “no results” Telegram message.
Formats each offer into a Telegram card with photos, pricing, dates, highlights, a Google Maps link, and inline buttons for a photo gallery and the booking URL.
Stores all hotel- and room-level photo URLs for the displayed offers in an n8n Data Table so galleries can be shown later without re-running the WinWin search.
When the user taps “View Gallery”, lets them choose hotel or room photos, loads the matching rows from the Data Table, validates reachable URLs, and sends the photos back to Telegram in appropriately sized media groups.

Setup
Create and select a Telegram Bot credential (BotFather token) for the Telegram Trigger and all Telegram send nodes.
Add an OpenAI API credential and confirm the selected chat model is available for tool calling.
Add a WinWin MCP Bearer token credential and keep the MCP endpoint URL as configured.
Add Postgres credentials for the chat memory node and ensure the database is reachable from your n8n instance.
Create an n8n Data Table (for example, OfferPhotos) with the required columns and select its Data Table ID in both the “Insert Offer Photos” and “Get Gallery Photos” nodes.

Requirements
Requirements: Access to the WinWin MCP, OpenAI (or any other tool-calling LLM) API key, Telegram bot token, and Postgres database for chat memory and photo data table.

Additional info
As a demo, this workflow is focused more on clarity than on production hardening – its purpose is to demonstrate an example of a full agent pattern (free-text parsing, tool-driven filtering, photo validation, batch pagination, stateful gallery lookup) based on the WinWin MCP.

Nodes Used (8)

AI Agent
@n8n/n8n-nodes-langchain.agent
Code
n8n-nodes-base.code
Code Tool
@n8n/n8n-nodes-langchain.toolCode
MCP Client Tool
@n8n/n8n-nodes-langchain.mcpClientTool
OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi
Postgres Chat Memory
@n8n/n8n-nodes-langchain.memoryPostgresChat
Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured
Telegram
n8n-nodes-base.telegram