e-mail Chatbot with both semantic and structured RAG, using Telegram and Pgvector

For Telegram, this workflow automates email queries using both semantic and structured data retrieval. It efficiently processes user messages, retrieves relevant email information, and responds in real-time, enhancing communication and information access. Users can seamlessly search their email database for specific queries, ensuring timely and accurate responses.

7/8/2025
20 nodes
Complex
manualcomplextelegramtriggersplitinbatcheslangchaintelegramnoopsticky noteadvancedcommunicationbotlogicconditional
Categories:
Communication & MessagingComplex WorkflowManual Triggered
Integrations:
TelegramTriggerSplitInBatchesLangChainTelegramNoOpSticky Note

Target Audience

  • Business Professionals: Individuals needing quick access to email communications for scheduling or information retrieval.
    - Project Managers: Those who require organized and timely responses regarding team communications.
    - Developers: Tech-savvy users interested in integrating Telegram with email querying capabilities.
    - Data Analysts: Users who need to analyze email data trends and insights efficiently.
    - General Users: Anyone looking for a convenient way to manage their email queries through a chatbot interface.
  • Problem Solved

  • Accessing relevant email information can be time-consuming and cumbersome.
    - Users often struggle to retrieve specific email details related to upcoming events or tasks.
    - This workflow automates the process of querying emails, providing instant responses through a Telegram bot, thus saving time and increasing productivity.
  • Workflow Steps

  • Step 1: Triggered by Telegram - The workflow starts when a user sends a message to the Telegram bot.
    - Step 2: Session Management - A unique session ID is generated to track the conversation context.
    - Step 3: Message Processing - The workflow checks if the message is coming from Telegram and processes it accordingly.
    - Step 4: AI Processing - The user's query is sent to an AI agent, which determines whether to search through structured SQL or vectorized email data.
    - Step 5: Data Retrieval - The workflow queries either the Postgres database for structured data or the PGVector store for semantic searches based on the user's request.
    - Step 6: Response Formatting - The retrieved information is formatted for clarity and conciseness before sending it back to the user.
    - Step 7: Batch Responses - If there are multiple responses, they are split into manageable chunks and sent to the user in batches to ensure readability.
  • Customization Guide

  • Adjusting Triggers: Users can modify the Telegram Trigger settings to include different chat IDs or types of updates.
    - Changing Database Connections: Update the database credentials in the Postgres PGVector Store node to connect to a different database.
    - Customizing AI Responses: Modify the system message in the AI Agent to tailor the assistant's tone and response style to better fit your needs.
    - Adding New Nodes: Users can integrate additional nodes for other functionalities, such as logging queries or sending notifications to other platforms.
    - Refining Query Logic: Customize the SQL composer workflow to refine how email queries are structured and executed, ensuring it meets specific business needs.