Memuat
Memuat
Want to go deeper?
Join one of our courses or ask us directly on WhatsApp.
Picked from the software, topic, and level of “Claude from Zero to Expert Class #92: Building a Simple Q&A Bot”.
Other ways we can help with Claude.
Learn with a mentor
Scheduled AI & Machine Learning courses with live guidance and a certificate.

Midjourney Course: Create Stunning AI Images from Text
★ 4.9

DALL-E Course: Creating Professional AI Images from Text
★ 4.9

Stable Diffusion Course: AI Art from Beginner to Professional
★ 4.9
Have it built for you
No time to learn Claude? Our team can do the project for you.

AI Image Creation with Stable Diffusion — Unlimited Custom Visual Production
★ 4.9

AI Image & Video Creation with Leonardo AI — All-in-One Visuals for Business
★ 4.9

AI Image Creation with Midjourney — Cinematic AI Art for Business
★ 4.9
Get notified about new Claude classes
At most one email a week. Unfollow anytime with one click.
The full narration of this video. The current sentence is highlighted while the video plays; click any sentence to jump there.
Hi, and welcome back. The project folder and API key are safe, so today we build something customers can use right away. We'll ask Claude Code to write a Telegram Q&A bot for Sunset Coffee, then test it from a phone and refine its rules until they're tidy.
The first step isn't writing code; it's defining the job. The Sunset Coffee bot may answer questions about product prices and sizes. Placing or changing orders stays with Dimas, the shop's admin. The bot may share the opening hours, eight in the morning to nine at night. Complaints and refunds must be handled by a person. The bot may explain local shipping: ten thousand rupiah, free above two hundred thousand. Transfer receipts and payments are off-limits for the bot. The bot may describe what's in the gift hamper. Questions unrelated to the shop get a polite answer that the bot only handles Sunset Coffee info. Limits like these make the bot safe and easy to test. For your business, make the same table: routine questions in the left column, and matters that must be handled by a person on the right. There are three ingredients. First, the shop info file with products, prices, opening hours, and shipping. The bot may only answer from this file, so when prices change, you only update this file. Second, the Telegram bot token. This token is just as secret as the API key, so it goes in the .env file too. Third, the system instructions: the bot's role, its tone, and the rules for when to hand over to the admin. Keeping data, secrets, and rules in three separate places is a habit that makes a project easy to maintain. Laras can change prices without fear of breaking the code, and Raka can fix the code without seeing the secrets.
A Telegram bot is created through Telegram's official account called BotFather. Raka sends the command slash newbot. BotFather asks for the bot's name. The flow is short and simple. Raka answers Sunset Coffee Bot, then picks a username that ends with the word bot, as Telegram's rules require. BotFather hands over the token. Notice that in this video the token is masked on purpose. This token is a secret key: whoever holds it can control your bot. Raka copies the token into the .env file with an editor, below the API key, not into a chat and not into Claude Code. If BotFather looks different for you, follow Telegram's official guide.
Now for the Claude Code part. Raka writes his request in everyday language: a Q&A bot that only answers from the shop info file and sends orders to Dimas. He asks for a plan first. Claude Code drafts a four-step plan. Look at point two: the bot's rules go in a separate instructions file, so Laras can change the rules without touching the code. Raka reads the plan and chooses to start. Reading a plan before approving it is a habit we practiced in the Advanced Claude Code session. Claude Code writes the bot.py file, about sixty-four lines. We don't need to understand every line. It also writes the instructions file containing the bot's rules. This is the file we'll change most often. Then it installs two supporting packages, which are bundles of ready-made code for Telegram and the Claude API. Finally, Claude Code explains how to run the bot. One important note: the bot lives only while this terminal is open. If the laptop is turned off, the bot stops too. Let's open the instructions file. The role section: the friendly admin of Sunset Coffee in Bandung. The data section: answer only from the shop info file. If the information isn't there, the bot must admit it doesn't know yet, not make something up. The limits section: orders, complaints, and payments go to Dimas, and the bot must never promise discounts. The format section: three sentences at most, in a casual tone. Short answers are easier to read on a phone, and they also save tokens. This layout is the same structured prompt we learned at the start of the class. The difference is that we don't type it every time; the program sends it automatically with every customer question.
Time to test. Raka starts the bot, then from his phone he pretends to be a customer named Rina and asks about the price of the cold brew. The bot answers fifty-five thousand rupiah, matching the shop info file, and politely suggests another product. The second question is harder: two liters of iced coffee, how much is shipping? The bot works out one hundred seventy thousand, so shipping is ten thousand. The math is right, but we still check it by hand. Numbers must always be checked. Then Rina tries to place an order and gives an address. The bot doesn't record the order. It sends Rina to Dimas, exactly as the rules say. This is why we made that table of limits at the start. An equally important test: a question whose answer isn't in the file. Rina asks whether there's matcha on the menu. It turns out the bot says yes, even quoting a price of twenty-five thousand. But Sunset Coffee doesn't sell matcha. The bot made it up. This is exactly why we test before real customers use the bot. Imagine that answer reaching a real customer. Rina comes to the shop looking for matcha and goes home disappointed. One small bot mistake can damage the trust Laras has built over years.
Raka reports the problem to Claude Code exactly as it happened: the bot made up a matcha drink, even though it's not in the shop info file. Claude Code reads the instructions file first, before changing anything. Here's the change. Red lines are removed, green lines are added. The rule is now firm: a product that isn't listed is not sold, and when in doubt, the bot tells the customer to ask Dimas. Raka reads the change first, then approves it. Notice that the code didn't change at all. Only the rules, written in everyday language, changed. Retest with the same question. This time the bot honestly says matcha isn't on the menu. Always retest the question that failed. Raka also asks Claude Code to save the list of test questions in a separate file. Every time the rules change, the same list is retested, so a new fix doesn't break answers that were already correct. Before customers use the bot, check five things. First, test at least ten questions, including questions outside the data. Second, check prices and shipping by hand with a calculator. Third, the bot token and API key live only in the .env file, not in the code and not in a chat. Fourth, customers know they're talking to a bot. This honesty protects trust. Fifth, decide how the bot stays alive. A bot on a laptop dies when the laptop is turned off. The options are moving the program to a server, or using n8n, which runs all the time. We cover the second option in the next episode. The BotFather, terminal, and Telegram screens in this video are simulations. Menu names and messages may differ slightly on your screen, but the flow stays the same: plan, secure the secrets, code, test, refine.
The Sunset Coffee Q&A bot is running: its rules live in a separate file, the token and key are safe in .env, and the bot is honest when it doesn't know. Try building a version for your own business with your own data. In the next episode we connect Claude to n8n, so Claude becomes one step inside an automation that keeps running without your laptop switched on. See you there!
Try these on your own after watching to lock in what you learned.
Type a question or keyword; we find the part of this episode that explains it and jump the video there.
Notes are saved with the current video time and are only visible to you.
Stuck on a step? Ask here; the instructor and other learners can answer.
No questions yet.

Cerdas Inovasi Digital Team
Software developers, BIM & 3D engineers, and AI practitioners
We build software, BIM models, games and AI automations for clients every day, and turn that hands-on work into step-by-step classes: every step is shown on screen and comes with a PDF guide you can keep.
See our clients →