Inspiration

As a Singaporean deal hunter, I noticed that the best local deals are often scattered across niche communities, social media, and word of mouth, making them hard to find and easy to miss. Many times i would spend hours researching trying to find the best deal to save my money which wouldnt seem worth the time. So, I wanted to build an AI-powered assistant that not only aggregates these hidden gems but also verifies and supplements them with real-time web search, ensuring that I always get the most relevant and up-to-date offers.


What it does

SG Deals Bot is an AI-powered Telegram bot that helps users discover, verify, and track the best deals in Singapore. Users can ask for deals in natural language (e.g., “1-for-1 bubble tea in Orchard”), and the bot responds with a curated, up-to-date list of offers—combining a unique local database with real-time web search and human-like explanations. The bot also supports follow-up questions, collects user feedback, and keeps the deal database fresh by ingesting new deals from Instagram and other sources.


How I built it

  • Backend: Python 3.8+ with asyncio for high concurrency and responsiveness.
  • Telegram Bot: Built using python-telegram-bot for seamless chat interaction.
  • Vector Search: Qdrant is used as a vector database to store and retrieve deals using semantic search (RAG).
  • Embeddings & Reranking: Cohere powers both dense embeddings and reranking for hybrid search.
  • Perplexity AI (Sonar API):
    • Used for natural language understanding, web search, and response generation.
    • Every user query is enhanced and sent to Perplexity, which performs retrieval-augmented generation (RAG) with live web search, supplementing and verifying the local database.
    • Perplexity is also used to extract and structure deals from Instagram posts (including image analysis).
  • Deal Ingestor: Automated scripts scrape Instagram, extract deal info using Perplexity, and store structured data in Qdrant.
  • Feedback & Analytics: User feedback is collected and stored for continuous improvement.

Key files:

  • bot.py: Main Telegram bot logic, Perplexity integration, hybrid search, and feedback.
  • deal_ingestor.py: Automated ingestion and structuring of deals from Instagram.

Challenges I ran into

  • Hybrid Search Complexity: Combining vector search, BM25, and real-time web search required careful orchestration and prompt engineering.
  • Rate Limiting & API Reliability: Handling Perplexity and Cohere API rate limits and failures gracefully, with retries and fallbacks.
  • Data Quality: Extracting structured deal data from messy Instagram posts and images was challenging, but Perplexity’s multi-modal capabilities helped. Adding crowdsourced deals into vectordb was also challenging as i needed to allow flexibility in metadata as well as get the enough information so that i can clean up and create more structured db later for bot's usage. All of this had to be automated
  • Latency: Ensuring fast response times (<10s) while performing multiple async API calls and searches in parallel. Researched a lot into different APIs, mechanisms, self hosting options, cloud etc
  • User Experience: Designing a conversational flow that feels natural and helpful, even for follow-up queries.

Accomplishments that I'm proud of

  • Built a fully functional, production-ready AI bot as a solo developer.
  • Seamlessly integrated Perplexity’s Sonar API for both web search and NLU, creating a true RAG system.
  • Achieved >90% deal relevance in user testing, with average response times under 10 seconds.
  • Automated ingestion of deals from Instagram and crowdsourced users, including image-based extraction.
  • Created a feedback loop for continuous improvement based on real user input.

What I learned

  • How to leverage Perplexity’s Sonar API for both retrieval-augmented generation and multi-modal (image+text) understanding.
  • Advanced prompt engineering for hybrid search and deal verification.
  • Best practices for building scalable, async Python bots and integrating multiple AI services.
  • The importance of user feedback and rapid iteration in building conversational AI products.

What's next for SG Deals Bot

  • Personalized Deal Notifications: Proactive alerts based on user preferences and location.
  • More Data Sources: Integrate additional local deal sources and social channels.
  • Advanced Analytics: Build a dashboard for deal trends and user engagement.

Built With

  • cohere
  • perplexity
  • python
  • python-telegram-bot
  • qdrant
Share this project:

Updates