How to Build a Simple Chatbot with $0 Using AI in 2 Hours
How to Build a Simple Chatbot with $0 Using AI in 2026
If you’ve ever thought about building a chatbot, you’re not alone. Many indie hackers and solo founders see the potential for chatbots to automate customer interactions and save time. The good news is that with the right AI tools, you can build a functional chatbot in just about two hours without spending a dime. Yes, you read that right—$0 cost. In this guide, I'll walk you through the process step-by-step, share the tools I recommend, and highlight what really works based on our experience.
Prerequisites for Building Your Chatbot
Before diving in, here’s what you’ll need:
- A Google account: for using Google Sheets and Google Apps Script.
- Basic understanding of JavaScript: you’ll need some familiarity, but I’ll guide you through the key parts.
- An OpenAI API key: sign up for a free trial if you haven’t already, which gives you access to powerful AI models.
- About 2 hours of your time: this includes setup and testing.
Step-by-Step Guide to Building Your Chatbot
1. Set Up Your Google Sheet
First, create a new Google Sheet that will serve as your database for questions and answers.
- Columns Needed: Create two columns: "User Question" and "Bot Response".
- Sample Data: Populate it with a few questions and answers to test your bot later.
2. Use Google Apps Script
Next, we’ll write a simple script to interact with the OpenAI API.
- Go to Extensions > Apps Script in your Google Sheet.
- Delete any code in the editor and paste in the following template:
function getResponse(userInput) {
var apiKey = 'YOUR_OPENAI_API_KEY';
var url = 'https://api.openai.com/v1/engines/davinci-codex/completions';
var payload = {
prompt: userInput,
max_tokens: 150
};
var options = {
method: 'post',
contentType: 'application/json',
headers: { 'Authorization': 'Bearer ' + apiKey },
payload: JSON.stringify(payload)
};
var response = UrlFetchApp.fetch(url, options);
var json = JSON.parse(response.getContentText());
return json.choices[0].text.trim();
}
- Replace
'YOUR_OPENAI_API_KEY'with your actual OpenAI API key.
3. Create a Simple User Interface
Now, let’s create a way for users to interact with your chatbot.
- Use Google Forms or a simple HTML interface to capture user input.
- Link the form responses back to your Google Sheet for processing.
4. Testing Your Chatbot
Fill out the form with a few test questions and see how well your bot responds.
- Expected Output: Your bot should return relevant answers based on the questions you set up in the Google Sheet.
- Troubleshooting: If it doesn’t work, check your API key and ensure the script is saved and authorized.
5. Deploying Your Chatbot
For deployment, you can share the link to your Google Form or host the HTML page on a simple web server.
- Limitations: This setup is basic and might not handle complex conversations well. You may need to refine your prompts for better responses.
Tool Comparison Table
Here’s a breakdown of the tools you can use in this process:
| Tool | Pricing | Best For | Limitations | Our Verdict | |--------------------|-----------------------|------------------------------------|------------------------------------------|--------------------------------------| | Google Sheets | Free | Data storage for chatbot queries | Limited to basic data handling | Perfect for quick setups | | Google Apps Script | Free | Automating Google Sheets tasks | Requires JavaScript knowledge | Great for those familiar with coding | | OpenAI API | Free trial + $0.006/token | Advanced AI responses | Costs can add up with heavy usage | Powerful, but keep an eye on usage | | Google Forms | Free | Simple user interfaces | Limited customization options | Good for quick user input | | HTML/CSS | Free (self-hosted) | Custom UI for chatbot | Requires web hosting knowledge | Best for those looking to customize |
What We Actually Use
In our experience, we primarily use Google Sheets for data management and the OpenAI API for AI responses. This combination allows us to maintain a low cost while still providing a functional chatbot experience.
Conclusion: Start Here
If you're just starting out and want to build a chatbot quickly and inexpensively, follow the steps outlined above. Start with Google Sheets and the OpenAI API, and don’t hesitate to iterate on your chatbot based on user feedback. This approach is not only cost-effective but also gives you a solid foundation to build on as your needs grow.
Follow Our Building Journey
Weekly podcast episodes on tools we're testing, products we're shipping, and lessons from building in public.