New Case study · Freight · AI extraction
AI Freight Lead-to-Quote
Checks a freight inbox every minute and turns each enquiry into a CRM deal, a reply asking for the missing shipment details, and an alert to the owner.
- n8n
- Gmail
- Groq LLM
- HubSpot
What happens to each email
- Inbox checkGmail is polled every minute for unread mail.
- Clean and filterSender name and address are pulled out. No-reply, mailer-daemon and newsletter senders are dropped.
- Read the enquiryA language model returns cargo type, origin, destination, container size, urgency and a one-line summary as JSON.
- Parse, with a safety netCode fences and stray text are stripped. If the output still cannot be read, the lead is kept and marked for manual review.
- Is it an enquiry?Only requests for a quote, shipping, clearing or logistics continue.the flow stops here
- CRM recordThe contact is created or updated in HubSpot and a deal opens with cargo, route and container size filled in. Calls retry up to three times, two seconds apart.
- Reply to the senderA threaded reply confirms the route and asks for weight, container quantity, addresses, ship date and Bill of Lading.
- Alert the ownerAn email summarises the lead and confirms the deal and the reply are done.
From email to deal
Hello, we need to move one 40ft container of used tyres from Hamburg to Apapa. It is urgent and the cargo will be ready for pickup next week.
{ "is_inquiry": true, "cargo_type": "used tyres", "origin": "Hamburg", "destination": "Apapa", "container_size": "40ft", "urgency": "high", "summary": "One 40ft container of used tyres, urgent." }
HubSpot deal name: Hamburg → Apapa | used tyres | Ada Okafor
Illustrative example. Names and cargo are invented to show the shape of the data.
Built to survive bad input
- Automated senders skipped. Newsletters and no-reply mail never reach the model.
- Tolerant parsing. Malformed model output creates a flagged lead instead of a lost one.
- Retries on the CRM. HubSpot calls try three times before the error lane fires.
- Visible failures. The owner gets the failed node and a run link by email.