I built my first custom chatbot with Claude Code in about four hours. The client was a Vancouver law firm that wanted to automate answers to common questions about their estate planning services. They were getting 20–30 emails a week asking the same five questions. Their assistant was spending six hours a week writing variations of the same replies.
We put those answers into a knowledge base, connected it to a chatbot interface on their website, and trained it to escalate anything complex to a human. Within two weeks, they'd cut those repetitive emails by 85%. The assistant got six hours back every week to focus on actual client support instead of being a human FAQ page.
Here's exactly how to build a custom chatbot with Claude Code, even if you've never written a line of code in your life.
Why Build a Custom Chatbot Instead of Using a Template
Before we get into the how, it's worth clarifying why you'd build a custom chatbot instead of using one of the off-the-shelf options like Intercom or Drift.
The short answer: control and cost. Pre-built chatbot platforms charge $50–$200 per month and give you limited customization. You're locked into their interface, their knowledge base structure, and their pricing tiers. If you want to integrate with your CRM or pull data from a proprietary system, you're either stuck or you're paying enterprise-level fees.
A custom chatbot built with Claude Code costs $30–$60 per month to run (API usage plus hosting), can pull from any data source you control, and can be designed to match your exact workflow. You own it. You can modify it anytime. And you're not paying for features you don't need.
Step 1: Define What Your Chatbot Needs to Know
The first step isn't technical — it's strategic. You need to decide what knowledge your chatbot should have access to.
For most businesses, this falls into three categories:
- Product or service FAQs — pricing, availability, process details, common objections
- Support and troubleshooting — how-to guides, account setup, common error fixes
- Lead qualification questions — understanding visitor intent, collecting contact info, routing to the right team member
Start by compiling the information you already have. Pull from your FAQ page, support documentation, email templates your team uses, and any internal guides. Export it all into plain text or Google Docs. The format doesn't matter yet — we'll structure it in the next step.
For the law firm I mentioned, this step took about 90 minutes. We went through their most common email replies, extracted the core answers, and organized them by topic (wills, trusts, probate, power of attorney). The result was a 12-page document covering about 40 common scenarios.
Step 2: Build the Chatbot with Claude Code
This is where Claude Code does the heavy lifting. You don't need to know how to code. You just need to explain what you want in plain English, and Claude Code writes the bot for you.
Here's the process I follow:
- Open a new Claude Code session and upload your knowledge base document.
- Give Claude Code a clear prompt describing what you want the chatbot to do. Example: "Build me a customer support chatbot that can answer questions about estate planning services. It should reference the attached knowledge base, keep answers concise, and escalate to a human if the user asks about a specific case or wants to book a consultation."
- Claude Code will generate the bot logic, the user interface (usually a simple embed widget), and the API connection to pull answers from your knowledge base.
- Test it in a sandbox environment. Ask it the same questions your customers ask. Refine the prompt if the tone or accuracy isn't quite right.
The key is being specific in your initial prompt. The more detail you give Claude Code about tone, escalation rules, and edge cases, the better the output. If you want the bot to sound friendly and informal, say that. If you want it to refuse medical or legal advice and route those queries to a human, specify that upfront.
The chatbot I built for the law firm had one critical rule: never give legal advice. If a question required judgment or case-specific analysis, the bot would say, "That's a great question, but I'd recommend speaking with one of our lawyers to get an answer tailored to your situation. Would you like me to connect you?" Then it collected their email and sent an internal alert to the firm's intake coordinator.
That guardrail alone was worth the entire project — no risk of the bot giving bad advice, and every escalated conversation was already qualified.
Connecting It to Your Website
Once the bot is working in the Claude Code environment, you need to embed it on your site. Claude Code will generate an embed script — usually a small JavaScript snippet that you paste into your website's footer or header.
If you're on WordPress, Webflow, Squarespace, or Shopify, this is as simple as pasting the code into a custom code block. If you have a developer on your team, they can handle it in about five minutes. If you don't, I can walk you through it — it's not complicated.
The chatbot widget will appear as a small icon in the bottom-right corner of your site (or wherever you configure it). Visitors click it, type a question, and get an instant response pulled from your knowledge base.
How to Build a Custom Chatbot That Escalates to Humans
The best chatbots aren't trying to replace humans — they're filtering out the repetitive stuff so humans can focus on high-value conversations.
This is where the escalation logic matters. You want the bot to recognize when it's out of its depth and hand off to a real person gracefully.
Here's the escalation framework I use:
- If the user asks a question the bot can answer confidently (based on the knowledge base), it answers.
- If the user asks something ambiguous or outside the knowledge base, the bot says, "I'm not sure about that — let me connect you with someone who can help."
- If the user explicitly asks to talk to a human ("Can I speak with someone?"), the bot collects their contact info and sends an alert to the right team member.
You can route escalations through email, Slack, or a CRM integration. For the law firm, we connected the bot to their intake system so every escalated conversation created a new lead record automatically. No manual data entry. No risk of a hot lead falling through the cracks.
Real Costs and Maintenance
Let's talk about what this actually costs to run, because it's way cheaper than most people expect.
Initial build: if you're doing it yourself with Claude Code, the only cost is your time (4–6 hours for a basic version). If you hire me to build it, it's typically $200–$400 depending on complexity and integrations.
Ongoing costs:
- Claude API usage: roughly $20/month for a bot handling 300–500 conversations
- Hosting: $10–$40/month depending on traffic (I usually recommend a simple serverless setup on Vercel or Netlify)
Total: $30–$60 per month. Compare that to Intercom's $74/month starter plan or Drift's $2,500/month enterprise tier, and you're saving real money while keeping full control.
Maintenance is minimal. Once the bot is live, you update the knowledge base when your services or policies change. That's usually a once-per-quarter task that takes 20 minutes. Claude Code makes it easy to add new Q&A pairs or refine existing ones without touching the underlying code.
Common Mistakes to Avoid
I've built about a dozen of these for clients over the past year. Here are the mistakes I see most often:
- Over-scoping the knowledge base. Don't try to make your bot an expert on everything. Start narrow — cover the 10–15 questions you get most often, and expand from there. A bot that's great at five things is better than one that's mediocre at fifty.
- Not testing edge cases. Before you go live, spend an hour trying to break the bot. Ask nonsense questions. Ask the same question five different ways. See how it handles typos, slang, and vague phrasing. Refine the prompts until it degrades gracefully.
- Forgetting to update the knowledge base. If your pricing changes or you launch a new service, update the bot's training data immediately. An out-of-date chatbot is worse than no chatbot — it actively damages trust.
Is This Right for Your Business?
A custom chatbot makes sense if you're spending significant time answering the same questions over and over. It's especially valuable if:
- You get 20+ support or sales inquiries per week with a lot of overlap
- Your team is small and stretched thin on routine communication
- You want to provide 24/7 coverage without hiring night-shift staff
- You need lead qualification or intake automation
If you're only getting a handful of inquiries per week and they're all unique, a chatbot probably isn't worth it yet. But if you're at the point where customer communication is becoming a bottleneck, this is one of the highest-ROI AI implementations you can do.
I've written more about how Claude Code handles customer support automation, and if you want to see the broader automation possibilities, check out my guide on getting started with Claude Code. For answers to technical questions about implementation, the FAQ page covers most of the common ones.
If you want to talk through whether a chatbot makes sense for your specific situation, or if you want me to build one for you, reach out. I can usually have a working version live within a week.