Skip to content
Go back

Building an AI Debt Collection Chatbot From Scratch: A Weekend Project That Actually Works

Edit page

The Beginning

You know that feeling when you have an idea stuck in your head and you just have to build it? That was me, sometime late 2024. I work in fintech, and I saw a problem every day: our customer service team was overwhelmed with the same questions over and over again. “How do I pay?” “What’s my bill amount?” “Can I pay next week?”

So I thought — what if we could automate this? Not with some boring FAQ bot, but with something that actually understands people.

I gave myself one month. Every Saturday. Every Sunday. Sometimes after office hours when I couldn’t sleep. Just me, my laptop, and way too much coffee.


What I Built

I built “Maya” — an AI-powered collection assistant that talks to customers through WhatsApp. She’s not your typical chatbot that replies with robotic templates. Maya actually understands what people are saying, even when they type things like “besok deh bayar” (I’ll pay tomorrow) or “belum gajian” (haven’t got my salary yet).

Here’s what makes her special:

She Understands Natural Language When someone says “akhir bulan ya” (end of month), Maya knows they mean the last day of the current month. When they say “minggu depan” (next week), she calculates exactly 7 days from today. This might sound simple, but getting an AI to understand casual Indonesian language? That took a lot of trial and error.

She Can See Yes, Maya has eyes. When customers send payment receipt images, she actually reads them using vision AI. She can extract amounts, dates, and transaction IDs from screenshots. No more “please describe your receipt” nonsense.

She Knows When to Step Back This was important to me. Maya isn’t trying to replace humans completely. When someone is genuinely angry or when the situation is too complex, she gracefully hands off to a human agent — with full conversation context so the customer doesn’t have to repeat themselves.

She’s Empathetic Maya’s tone changes based on the situation. For someone who just missed their due date by a day? Friendly reminder. For someone who’s 60 days late? More serious, but still respectful. For someone going through a disaster like a flood? Genuinely empathetic, offering flexible payment options.


The Technical Bits (For My Fellow Engineers)

I built this using LangGraph with the ReAct (Reason + Act) pattern. The architecture looks something like this:

The whole thing runs on PostgreSQL for state management and uses OpenRouter for LLM inference.


Did It Actually Work?

This is the part I’m most proud of. We didn’t just deploy and hope for the best. We ran a proper A/B test with over 22,000 users.

The results:

MetricImprovement
7-day payment velocity+23.5% faster
Promise to Pay conversion100% of new users who promised actually paid
Human handoff rateOnly 7.3% of conversations needed a human

For new users especially, Maya made a real difference. They got instant answers to their questions at 2 AM when no CS agent was available. They got reminded to pay. They actually paid.


The Hardest Parts

Not everything was smooth sailing. Here are some challenges I faced:

Indonesian Language is Messy: People don’t type formal Indonesian. They mix slang, abbreviations, typos. Getting the AI to understand “gmn cara byar” (how to pay) took many iterations.

Timing is Everything: If Maya replies too fast, it feels robotic. Too slow, and people get impatient. Finding the right debounce window (4 seconds) took experimentation.

Edge Cases are Endless: What if someone sends 10 images? What if they type in English? What if they try to jailbreak the bot? Each edge case required careful handling.

Sleep Deprivation: Building this over weekends while having a full-time job is… exhausting. But also rewarding.


What I Learned

  1. Start Small, Then Iterate: I didn’t build all features on day one. I started with basic Q&A, then added PTP, then image analysis, then morning follow-ups.

  2. Test With Real Data: Synthetic test cases are useful, but nothing beats testing with actual customer messages. The weird edge cases they come up with will humble you.

  3. AI Isn’t Magic: It’s a tool. It needs guardrails, fallbacks, and human oversight. The goal isn’t to replace humans — it’s to help them focus on what matters.

  4. Side Projects Can Have Real Impact: This started as a weekend experiment. Now it’s helping thousands of customers get their questions answered instantly.


What’s Next

Maya is still learning. Every conversation teaches us something new. We’re looking at expanding her capabilities, improving her language understanding, and maybe even supporting more languages.

Building this reminded me why I got into engineering in the first place. Not just to write code, but to solve real problems for real people.

If you’re thinking about starting a side project, here’s my advice: just start. Give yourself a deadline. Work on it consistently, even if it’s just weekends. You’ll be surprised what you can build.


This project was built entirely from scratch over 4 weekends, with additional work after office hours. The LLM used is Grok via OpenRouter. All results are from actual A/B testing in production.


Edit page
Share this post on:

Previous Post
I Used Claude Code to Build a Credit Scoring Model (Here's What I Learned)