A ready, tested workflow for n8n needs to be created, which will function as the first line of support for the SaaS service Venta-CRM.
The agent must accept user inquiries in Telegram, gather the complete request, refer to the knowledge base on Google Drive, and respond to the user only when there is an exact answer in the knowledge base.
If there is no exact answer, the agent should not invent a response. In this case, they should forward the inquiry to the Telegram group of managers.
Communication Channel
We use only:
Two scenarios need to be supported:
1. The client writes to the bot in private messages
2. The client writes in the Telegram group where the bot is present
There is one bot. However, in the future, there should be the ability to scale the logic to other clients.
Knowledge Base
The knowledge base is located in Google Drive.
Format:
Google Docs
15-20 documents currently
in the future 50+ documents
each document - a separate instruction or a separate question
the language of the documents - Ukrainian
average document size - 1-2 pages
Examples of documents:
How to connect telephony
How to optimize the route
How to add a driver
How the client balance works
How to set up tariffs
The knowledge base needs to be prepared for AI search.
Desired logic:
Google Drive
↓
uploading Google Docs
↓
splitting text into chunks
↓
OpenAI embeddings
↓
vector store
↓
AI Agent searches for an answer in the vector store
Indexing the Knowledge Base
A separate workflow for indexing the knowledge base is needed.
Options:
1. manual indexing launch
2. automatic re-indexing once a week
The agent should not read all documents from Google Drive with each user inquiry. The base should be pre-indexed.
AI Model
We use only the OpenAI API.
The model can be suggested to the performer, but the optimal option should be chosen based on quality and price.
Expectations:
short answers
natural style of a live manager
without unnecessary long explanations
without inventing information
Agent's Logic
Main scenario:
The user writes a message
↓
n8n receives the message via Telegram Bot API
↓
the bot waits 45 seconds
↓
if the user has written several messages, they are combined into one request
↓
the agent determines the essence of the inquiry
↓
the agent searches for an answer in the knowledge base
↓
if an exact answer is found and confidence >= 80% - responds to the user
↓
if there is no answer or confidence < 80% - forwards the inquiry to the managers
Processing Messages in Parts
If the user writes:
Good day
Please tell me
How to add a new driver?
The agent must process this as one request:
Good day. Please tell me how to add a new driver?
If the user only wrote:
The bot should not search for an answer in the knowledge base. It should respond:
Good day! Please write your question about Venta-CRM - I will try to help.
Response Conditions
The agent responds to the user only if:
1. the question is clear
2. an exact answer is found in the knowledge base
3. confidence is not lower than 80%
The agent should not respond if:
the answer is found only partially
the answer is not confirmed by the knowledge base
the question is not fully understood
there is no exact instruction in the base
In such cases:
if the question is incomplete - ask a clarifying question
if the question is clear but there is no answer - forward to the managers
Forwarding to Managers
If the agent did not find an answer, a message should be sent to a common Telegram group of managers.
The message to the managers should contain:
A new user inquiry without an exact answer in the knowledge base
Client:
{{client_name}}
Username / Telegram ID:
{{telegram_user}}
Source:
private messages to the bot / Telegram group
Full inquiry:
{{full_user_question}}
Context of the last messages:
{{dialog_context}}
Reason for forwarding:
answer not found / confidence below 80%
At this moment, the user needs to be responded to:
Thank you, the question has been received. I have forwarded it to the manager to check the information and provide an exact answer.
Manager's Response
The ability for the manager to respond to the client from the Telegram group of managers needs to be implemented.
It is also desirable to add buttons:
Took into work
Responded
Add to knowledge base
If the implementation of buttons complicates the MVP, it should be separated into a separate block, but it is preferable to incorporate it into the architecture.
Adding New Q&A to the Knowledge Base
If the manager answered a question that was not in the knowledge base, manual addition of the new question-answer to the knowledge base should be provided.
Preferred option:
Google Sheets or a separate Google Drive folder for new Q&A
The manager manually confirms that the answer can be added to the knowledge base.
Statistics
Statistics need to be stored in Google Sheets.
Minimum KPIs:
date of inquiry
user's Telegram ID
type of source: private messages / group
topic or brief essence of the question
whether the agent responded independently
whether it was forwarded to the manager
confidence
response time
status: answered / escalated / clarification
popular questions
Technical Requirements
Platform:
n8n self-hosted
Hetzner server
latest stable version of n8n
Telegram Bot API
OpenAI API
Google Drive
Google Sheets
I do not provide API keys and credentials to the performer.
The workflow needs to be made so that I can connect my credentials in n8n myself.
What Should Be the Result
The performer must deliver:
1. a ready n8n workflow in JSON format
2. a separate JSON workflow for indexing the knowledge base
3. instructions for connecting credentials
4. instructions for setting up the Telegram Bot API
5. instructions for connecting the Google Drive folder of the knowledge base
6. instructions for connecting Google Sheets for statistics
7. a brief description of the workflow logic
8. a list of places where variables need to be replaced
Testing Before Acceptance
Important: the workflow must be tested by the performer before delivery.
I expect the performer to:
1. run the workflow in their n8n or test environment
2. test it on a real Telegram bot
3. test it on a test Google Drive knowledge base
4. show the result of the work
5. after that, deliver the JSON workflow
I accept the task only after I can test the workflow in my n8n with my Telegram Bot API, OpenAI API, and Google Drive.
Acceptance Criteria
The workflow is considered ready if:
1. the bot receives messages in Telegram
2. the bot waits 45 seconds and gathers messages in parts
3. the bot recognizes a simple greeting
4. the bot searches for an answer in the knowledge base
5. the bot responds only when confidence >= 80%
6. the bot does not invent answers
7. the bot asks a clarifying question if the request is incomplete
8. the bot forwards the question to managers if there is no answer
9. managers receive the full context of the inquiry
10. statistics are recorded in Google Sheets
11. the knowledge base is indexed from Google Drive
12. there is a ready JSON workflow
13. there is a clear step-by-step instruction for installation
Important for the Performer
Please respond only if you have practical experience with:
n8n
Telegram Bot API
OpenAI API
AI Agent / RAG
Google Drive API
Google Sheets
vector store / embeddings
In the response, please briefly indicate:
1. whether you have created similar AI support agents
2. which vector store you recommend for this task
3. how you plan to implement the 45-second buffer
4. how you will determine confidence >= 80%
5. the estimated completion time
6. examples of similar workflows, if any
Expected Result
A ready working workflow for n8n is needed, which can be imported via JSON, credentials connected according to the instructions, and used as the first line support AI agent for Venta-CRM.