Category: Automations › AI Customer Support · Best for: Companies with an internal helpdesk · Platform: n8n · Steps: 21
What it does
Staff ask HR or IT questions by text or voice, and the AI answers.
Begin by importing the PDF documents that contain your internal policies and FAQs-these will become the knowledge base for your Internal Helpdesk Assistant. For example, you can store a company handbook or IT/HR policy PDFs on a shared drive or cloud storage and reference a direct download link here.
Works with: Telegram, Embeddings OpenAI, Text Splitter Recursive Character Text Splitter, OpenAI, Memory Postgres Chat, Vector Store P G Vector, Document Default Data Loader, Agent, Tool Vector Store
What you get
- The n8n workflow file (
workflow.json), ready to import - This setup guide
- The list of fields to change for your own accounts (see Install below)
- Email support if you get stuck
Before you start
-
An n8n account. Easiest: n8n Cloud (free trial). Self-host for free with Docker:
docker run -it --rm -p 5678:5678 -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n, then open http://localhost:5678. -
Accounts and API keys for these services:
- PostgreSQL database: how to connect (used by Create HR Policies, Postgres Chat Memory, Postgres PGVector Store)
- OpenAI API key: how to connect (used by Embeddings OpenAI, OpenAI, OpenAI Chat Model, OpenAI Chat Model1, Embeddings OpenAI1)
- Telegram bot token from @BotFather: how to connect (used by Telegram Trigger, Telegram1, Unsupported Message Type, Telegram)
Install
- In n8n, click Create workflow (top right).
- Click the ⋯ menu → Import from file and choose
workflow.json. Or open the file, copy everything and paste it onto the empty canvas with Ctrl/Cmd + V. - Open each node with a red warning triangle and pick or create the matching credential from the list above.
- Point these fields at your own sheets, chats and accounts:
- Unsupported Message Type →
chatId: choose your own - Telegram →
chatId: choose your own
- Unsupported Message Type →
- Click Save.
Test it
- Click Test workflow (or Execute workflow). When clicking ‘Test workflow’ starts it. Trigger it once with real sample data.
- Click each node to check its output. A green tick means the step worked.
- Fix any red node: it's almost always a credential or a field that still points at a sheet or chat that isn't yours.
Go live
Toggle Active (top right). From now on it runs on its own. Check Executions in the left sidebar to see every run.
How it works, step by step
- When clicking ‘Test workflow’ starts the workflow (Manual).
- Telegram Trigger starts the workflow (Telegram).
- Embeddings OpenAI uses AI (Embeddings OpenAI).
- Recursive Character Text Splitter uses AI (Text Splitter Recursive Character Text Splitter).
- OpenAI Chat Model uses AI (OpenAI).
- Postgres Chat Memory uses AI (Memory Postgres Chat).
- Embeddings OpenAI1 uses AI (Embeddings OpenAI).
- OpenAI Chat Model1 uses AI (OpenAI).
- HTTP Request calls an external API (https://s3.amazonaws.com/scschoolfiles/656/employee_handbook).
- Verify Message Type checks a condition and routes items accordingly.
- Create HR Policies uses AI (Vector Store P G Vector).
- Default Data Loader uses AI (Document Default Data Loader).
- AI Agent uses AI (Agent).
- Postgres PGVector Store uses AI (Vector Store P G Vector).
- Answer questions with a vector store uses AI (Tool Vector Store).
- Extract from File uses Extract From File to pdf.
- Edit Fields reshapes the data for the next step.
- Telegram1 uses Telegram to file.
- Unsupported Message Type uses Telegram.
- Telegram uses Telegram.
- OpenAI uses AI (OpenAI).
Extra setup notes
These notes are also on the canvas as yellow sticky notes:
1. Download & Extract Internal Policy Documents
Read more about the HTTP Request Tool
Begin by importing the PDF documents that contain your internal policies and FAQs-these will become the knowledge base for your Internal Helpdesk Assistant. For example, you can store a company handbook or IT/HR policy PDFs on a shared drive or cloud storage and reference a direct download link here.
In this demonstration, we'll use the HTTP Request node to fetch the PDF file from a given URL and then parse its text contents using the Extract from File node. Once extracted, these text chunks will be used to build the vector store that underpins your helpdesk chatbot’s responses.
Example Employee Handbook with Policies
2. Create Internal Policy Vector Store
Read more about the In-Memory Vector Store
Vector stores power the retrieval process by matching a user's natural language questions to relevant chunks of text. We'll transform your extracted internal policy text into vector embeddings and store them in a database-like structure.
We will be using PostgreSQL which has production ready vector support.
How it works
- The text extracted in Step 1 is split into manageable segments (chunks).
- An embedding model transforms these segments into numerical vectors.
- These vectors, along with metadata, are stored in PostgreSQL.
- When users ask a question, their query is embedded and matched to the most relevant vectors, improving the accuracy of the chatbot's response.
3. Handling Messages with Fallback Support
This workflow processes Telegram messages to handle text and voice inputs, with a fallback for unsupported message types. Here’s how it works:
- Trigger Node:
- The workflow starts with a Telegram trigger that listens for incoming messages.
- Message Type Check:
- The workflow verifies the type of message received:
- Text Message: If the message contains
$json.message.text, it is sent directly to the agent. - Voice Message: If the message contains
$json.message.voice, the audio is transcribed into text using a transcription service, and the result is sent to the agent.
- Fallback Path:
- If the message is neither text nor voice, a fallback response is returned:
"Sorry, I couldn’t process your message. Please try again."
- Unified Output:
- Both text messages and transcribed voice messages are converted into the same format before sending to the agent, ensuring consistency in handling.
The setup needs to be run at the start or when data is changed
4. HR & IT AI Agent Provides Helpdesk Support
n8n's AI agents allow you to create intelligent and interactive workflows that can access and retrieve data from internal knowledgebases. In this workflow, the AI agent is configured to provide answers for HR and IT queries by performing Retrieval-Augmented Generation (RAG) on internal documents.
How It Works:
- Internal Knowledgebase Access: A Vector store tool is used to connect the agent to the HR & IT knowledgebase built earlier in the workflow. This enables the agent to fetch accurate and specific answers for employee queries.
- Chat Memory: A Chat memory subnode tracks the conversation, allowing the agent to maintain context across multiple queries from the same user, creating a personalized and cohesive experience.
- Dynamic Query Responses: Whether employees ask about policies, leave balances, or technical troubleshooting, the agent retrieves relevant data from the vector store and crafts a natural language response.
By integrating the AI agent with a vector store and chat memory, this workflow empowers your HR & IT helpdesk chatbot to provide quick, accurate, and conversational support to employees.
PostgrSQL is used for all steps to simplify development in production.
5. Send Message
The simplest and most important part :)
Troubleshooting
- "Credentials not found": open the node and select your credential again.
- Google "access blocked": in Google Cloud, add your email as a test user on the OAuth consent screen.
- Webhook not firing: copy the node's Production URL (not Test URL) into the other app, and make sure the workflow is Active.
- AI node errors: check your API key has billing enabled and the model name exists on your plan.
- Nothing happens on schedule: the workflow must be Active, and self-hosted n8n must stay running.
Need help?
Reply to your Morning Method order email and we'll help you get it running.
© Morning Method