Quick overview
This workflow reviews each chatbot answer using Mistral Medium, stores an anonymized quality score in an n8n Data Table, and sends a Telegram alert when the answer is poor or the client seems unhappy or requests a human.
How it works
- Starts either when you manually execute the workflow (using a sample conversation) or when it is called by your chatbot as a sub-workflow.
- Merges your incoming chat data with configuration settings like bot rules, Telegram chat ID, alert threshold, and audit rate.
- Sends the conversation context, client message, bot answer, and your rules to Mistral Medium to score accuracy, rule-following, tone, and handover, and to classify the client’s mood and whether they want a human.
- Parses the model’s JSON response, calculates the overall score, decides whether to keep a short reason/excerpt for auditing, and flags the interaction for alerting (including handling model/parse errors).
- Writes one review row (without chat identifiers) to the n8n Data Table.
- If the item is flagged, sends a formatted alert to your team in Telegram with the score, mood, handover status, and the stored reason/excerpt.
Setup
- Add a Mistral Cloud credential for the Mistral Medium chat model.
- Create an n8n Data Table named
ai_reviews and ensure it includes fields for score, mood, status, reason, excerpt, lang, wants_human, handed_over, and alert.
- Add a Telegram bot credential, add the bot to your team group, and set the correct
team_chat_id in the Configuration step.
- Update the
rules, alert_max_score, and audit_rate values in the Configuration step to match your chatbot policy and alerting preferences.
- If calling from your chatbot, configure it to pass
question, answer, summary, lang, and handed_over into this workflow’s Execute Workflow trigger.
Requirements
- Mistral API key (Mistral Medium)
- Telegram bot that is a member of your team group
- n8n with Data tables (self-hosted or Cloud)
Customization
- Change alert_max_score and audit_rate in the Configuration node
- Replace Mistral Medium with any other chat model node
- Add a scheduled cleanup that deletes old rows according to your privacy policy
Additional info
Built for our own Telegram AI assistant and used in production. Tested on self-hosted n8n 2.x.