Filtering free-form WhatsApp queries with Mistral AI
FleetTrack runs a WhatsApp bot for fleettracktz.com. The bot joins WhatsApp groups (connected through Baileys, the unofficial WhatsApp Web API, using a Meta developer account) where users ask about fleet issues right in the chat. Instead of opening a dashboard or filing a ticket, they just type into the group and the bot is there.
The hard part is the input. Users write queries in any format: shorthand, typos, half sentences, whatever comes to mind in the moment. One person writes a two-word fragment, the next writes a full paragraph describing the same problem. Keyword matching falls apart against that kind of text, and maintaining hand-written rules for every phrasing is a losing game. Every new user invents a new format.
So every incoming message goes through Mistral AI first. The model filters and classifies the free-form text, working out what the user is actually asking about, and hands the backend a structured result it can act on. The AI absorbs all the messiness of human chat; the backend only ever deals with clean, categorized input.
Underneath it is an Express.js backend with PostgreSQL on NeonDB, which stores the messages as they come in. Groups are whitelisted by SIM country code, so the bot only operates in approved groups. A random group add does not turn into an open endpoint. If a group is not whitelisted for that SIM’s country, the bot stays quiet.
The takeaway: when the input is human chat, do not fight the format. Put a classifier in front of it, store everything for later, gate which groups the bot talks in, and let people type like people.
Getting the bot into the groups runs through Baileys with a Meta developer account. That connection is what puts the bot inside real WhatsApp conversations instead of a sandbox. Once it is in, the loop is simple: a message lands, Mistral classifies it, the Express backend decides what to do with the result, and NeonDB keeps the record.