Answer HR and IT policy questions on Telegram with OpenAI and Postgres PGVector
Quick overview This workflow builds a searchable HR policy knowledge base from a PDF and runs a Telegram helpdesk bot that answers employee questions from that content, handling both text messages and voice notes via OpenAI transcription and retrieval from a Postgres PGVector vector store.
How it works Manually runs once to download an HR policy PDF over HTTP and extract its text. Splits the extracted policy text into chunks, generates OpenAI embeddings, and inserts the vectors into a Postgres PGVector store. Triggers on new Telegram messages sent to your bot. Routes incoming Telegram updates by type, sending text directly to the assistant, transcribing voice messages with OpenAI, or replying that other formats are unsupported. Uses an OpenAI chat model with Postgres-backed chat memory and a PGVector retrieval tool to answer questions grounded in the stored policy content. Sends the final answer back to the user in Telegram.
Setup Add an OpenAI API key for embeddings, chat completions, and audio transcription. Set up a Postgres database with the PGVector extension enabled and add the Postgres credentials for both the vector store and chat memory. Create a Telegram bot with BotFather, add the bot token credentials, and enable the Telegram Trigger so it can receive updates. Replace the PDF URL with your own policy/handbook document and run the manual ingestion once to populate the vector store before using the bot.
Related Templates
AI SEO Readability Audit: Check Website Friendliness for LLMs
Who is this for? This workflow is designed for SEO specialists, content creators, marketers, and website developers who ...
Text automations using Apple Shortcuts
Overview This workflow answers user requests sent via Mac Shortcuts Several Shortcuts call the same webhook, with a quer...
Task Deadline Reminders with Google Sheets, ChatGPT, and Gmail
Intro This template is for project managers, team leads, or anyone who wants to automatically remind teammates of tasks ...
π Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments