الدرس 7 · الوحدة 2: Your First Working AI Automation
Project: an AI appointment booking assistant ready to show a client
- Design a booking assistant from a client brief
- Build it in n8n using free tools
- Package it as a demo a client can say yes to
Why this matters
Many small businesses lose customers because the owner cannot reply to booking messages fast enough while working with clients. This lesson shows how to combine a free local model, a calendar, a spreadsheet and an error alert into one assistant that handles routine bookings and passes the unusual ones to a human. It also shows how to package the result so a client can see the value before buying.
Key ideas
- Design before you build. Write down the customer, the assistant and the source of truth for availability, then list what the assistant must never do. The brief decides the workflow, not the other way round.
- The model extracts, the tools decide. The language model turns a messy message into named fields, such as service, date, time and name. A calendar node, not the model, decides whether a slot is free.
- Missing details trigger a question. If any required field is empty, the workflow asks a follow-up question instead of guessing.
- Every path ends with a reply. A free slot creates a booking, a taken slot offers the nearest alternatives, and an unclear request goes to the owner. The customer always gets an answer.
- Logs and alerts make it sellable. A row per booking in a sheet, a short email to the owner, and an error workflow turn a working flow into something a client can trust.
Worked example. Suppose a customer asks for 10:00 and the calendar already holds 10:00, 11:00 and 14:00. The workflow checks the free slots from 09:00 to 17:00 in one-hour steps, finds 09:00, 12:00 and 13:00 as the closest free times to 10:00, and replies with those three options.
Try it before you watch
A customer asks for 14:00 on Friday. The calendar says 14:00 is taken, and the free slots are 09:00, 10:00 and 15:00. According to the key ideas, which part of the workflow should decide whether to offer alternatives, and what should the customer receive?
Show answerHide answer
The calendar check decides, because availability is a fact the model must not guess. The workflow should offer the nearest free times, here 10:00 and 15:00 (and 09:00 if three options are wanted), in a reply to the customer. This shows that the model extracts the request while the tools make the decision.
Words to know
- Webhook: a web address that receives a message from another system and starts a workflow when the message arrives.
- Extraction: pulling structured pieces, such as a date or a name, out of ordinary text.
- JSON: a plain text format that stores named values in a predictable shape, so a workflow can read them reliably.
- Source of truth: the one place whose answer is accepted as correct, here the calendar for free and taken slots.
- Switch node: a workflow step that sends each message down one of several paths based on a rule.
- Error trigger: a workflow step that starts when another workflow fails, so the owner hears about the problem.
What to watch for
- How the Ollama prompt asks for named fields and writes null when a value is missing, instead of inventing one.
- How the free-slot logic walks the day and sorts the free times by how close they are to the request.
- How each of the three decision paths ends with a reply, and which case goes to the owner.
تعلّمه مع معلمك على السبورة المباشرة
أهم نقاط الفيديو
Lina's phone never stops
- A one-chair salon, dozens of booking messages a day
- Every reply means stopping a haircut
- Missed messages are missed customers
layout: full
parts:
lina: {chip: Lina, sub: "One-chair salon", icon: scissors}
steps:
- at: "Meet Lina"
highlight: lina
note: "A one-chair salon"
- at: "fills up with messages"
spokes: {of: lina, items: ["Can I come Thursday?", "Anything after work?", "Beard trim price?"]}
- at: "putting down the scissors"
note: "Each reply stops a haircut"
- at: "wait three hours"
note: "Replies wait for hours"
- at: "never get answered"
note: "Some never get a reply"
- at: "Missed messages are missed customers"
note: "Missed messages, lost customers"
- at: "real money walking out the door"
note: "Real money walks away"
- at: "an assistant that reads those messages"
note: "An assistant reads them"
- at: "ties the whole module together"
note: "The project ties it together" What you will learn
- Design a booking assistant from a client brief
- Build it in n8n using free tools
- Package it as a demo a client can say yes to
tree:
This lesson:
Design: [Client brief, Limits]
Build: [n8n flow, Free tools]
Package: [Demo, One-page summary]
direction: down
start: none
steps:
- at: "Here's the plan for this lesson"
show: This lesson
- at: "in three goals"
grow: This lesson
- at: "design a booking assistant"
grow: Design
highlight: Design
- at: "what it must never do"
highlight: Limits
- at: "build it in n8n"
grow: Build
- at: "using free tools"
highlight: Free tools
- at: "package it as a demo"
grow: Package
highlight: Package
- at: "a one-page summary"
highlight: One-page summary
- at: "You already know every piece"
highlight: This lesson
- at: "Now we connect them"
note: "Three goals, one working build" The client brief as a picture
- Customer: writes normal sentences
- Assistant: understands, asks, never invents
- Calendar: the single source of truth
layout: wide
direction: LR
components:
cust: {kind: user, label: Customer}
asst: {kind: service, label: Assistant}
cal: {kind: database, label: Google Calendar}
links: [cust->asst, asst->cal]
steps:
- at: "draw the job"
note: "Draw the job before you build"
- at: "On the left is the Customer"
show: [cust]
- at: "they write normal sentences"
note: "Normal sentences, with typos"
- at: "In the middle is the Assistant"
show: [asst]
flow: ["cust>asst: haircut next Thursday"]
- at: "never invent an answer"
note: "Asks, never invents"
- at: "On the right is the Calendar"
show: [cal]
- at: "single source of truth"
highlight: cal
note: "Single source of truth"
- at: "A slot is free only if"
flow: ["asst>cal: check slot", "cal>asst: free or taken"]
- at: "Write these three roles down"
highlight: [cust, asst, cal]
note: "Three roles, every project"
- at: "it understands language"
highlight: asst
note: "Understands language"
- at: "decides facts"
highlight: cal
note: "The calendar decides facts" The workflow at a glance
- The webhook takes the chat message
- Ollama turns words into fields
- Asks the calendar, logs, emails, replies
layout: wide
direction: LR
components:
cust: {kind: user, label: Customer}
chat: {kind: client, label: Website chat}
hook: {kind: api, label: n8n Webhook}
llm: {kind: llm, label: Ollama model}
cal: {kind: database, label: Google Calendar}
sheet: {kind: storage, label: Google Sheets}
mail: {kind: email, label: Owner email}
zones:
- {label: Free tools, contains: [llm, cal, sheet, mail]}
links: [cust->chat, chat->hook, hook->llm, hook->cal, hook->sheet, hook->mail]
steps:
- at: "Here's the whole system"
show: [cust]
note: "The whole system"
- at: "types into the chat box"
show: [chat]
flow: ["cust>chat: message"]
- at: "the text to an n8n webhook"
show: [hook]
flow: ["chat>hook: message"]
- at: "trigger you met"
highlight: hook
note: "The trigger from lesson one"
- at: "the helpers it calls"
highlight: none
note: "Helpers the flow calls"
- at: "the Ollama model running"
show: [llm]
note: "Runs on your machine"
- at: "Google Calendar"
show: [cal]
- at: "Google Sheets"
show: [sheet]
- at: "and email"
show: [mail]
- at: "all free at this size"
highlight: none
note: "All free at this size"
- at: "follow one booking request"
highlight: none
note: "One booking request"
- at: "goes to the model"
flow: ["hook>llm: extract"]
- at: "sends back neat fields"
flow: ["llm>hook: JSON"]
- at: "asks the calendar whether"
flow: ["hook>cal: check slot", "cal>hook: free"]
- at: "logs the booking in the sheet"
flow: ["hook>sheet: log"]
- at: "emails Lina"
flow: ["hook>mail: notify"]
- at: "replies to the customer"
flow: ["hook>chat: confirmed"]
- at: "Every arrow is a node"
highlight: hook
note: "Each arrow is a node" Step 1: words become fields
{
"intent": "book",
"service": "haircut",
"date": "2026-10-08",
"time": "10:00",
"name": "Omar",
"phone": null
} Step 2: find free slots
from datetime import datetime, timedelta
booked = ["10:00", "11:00", "14:00"]
fmt = "%H:%M"
def free_slots(start="09:00", end="17:00", minutes=60):
t = datetime.strptime(start, fmt)
stop = datetime.strptime(end, fmt)
slots = []
while t + timedelta(minutes=minutes) <= stop:
if t.strftime(fmt) not in booked:
slots.append(t.strftime(fmt))
t += timedelta(minutes=minutes)
return slots
wanted = "10:00"
slots = free_slots()
if wanted in slots:
print("Book", wanted)
else:
w = datetime.strptime(wanted, fmt)
near = sorted(slots, key=lambda s: abs(
datetime.strptime(s, fmt) - w))
print(wanted, "is taken. Offer:", near[:3]) Step 3: decide and reply
- Slot free: create the event, confirm
- Slot taken: offer the three nearest times
- Unclear or unusual: hand over to Lina
layout: full
parts:
slots: {chip: "Free slots", sub: "Calendar check", icon: calendar}
case: {chip: "Which case?", sub: "Switch node", icon: git-branch}
flow: {box: "Decide and reply", holds: [slots, case]}
steps:
- at: "Free slots check"
highlight: slots
note: "Is the slot open?"
- at: "which case is this"
highlight: case
note: "Switch node decides"
- at: "There are three paths"
spokes: {of: case, items: ["Create event", "Offer 3 times", "Hand to Lina"]}
- at: "first path, Create event"
note: "Free: book it"
- at: "second path, Offer 3 times"
note: "Taken: offer nearest"
- at: "third path, Hand to Lina"
note: "Unclear: hand over"
- at: "ends with a reply"
zoom_out: flow
note: "Every path replies"
- at: "knows its limits"
highlight: none
note: "Clients relax when it knows limits" Step 4: log, notify, catch errors
- Every booking becomes a row in Google Sheets
- Lina gets a short email per booking
- An error workflow alerts her if anything breaks
layout: side
objects:
head: {text: "Google Sheets log", pos: [0, 2.8]}
r1: {text: "Sara, haircut, 45", pos: [0, 1.9]}
r2: {text: "Karim, cut and beard, 60", pos: [0, 1.2]}
r3: {text: "Omar, haircut, 45", pos: [0, 0.5]}
s1: {tex: 'D_2+D_3+D_4', pos: [0, -0.2]}
s2: {tex: '45+60+45', pos: [0, -0.2]}
s3: {tex: '45+60+45=150', pos: [0, -0.2], color: green}
mail: {text: "Email to Lina per booking", pos: [0, -1.0]}
err: {text: "Error workflow alerts Lina", pos: [0, -1.6]}
reply: {text: "Polite holding reply", pos: [0, -2.2]}
case1: {text: "Ollama down", pos: [-1.3, -2.9], color: red}
case2: {text: "Login expires", pos: [1.3, -2.9], color: red}
steps:
- at: "appended as a row in a Google Sheet"
show: head
- at: "Here are three bookings"
highlight: head
note: "Three bookings so far"
- at: "Sara came in"
show: r1
- at: "Karim chose a cut"
show: r2
- at: "Omar booked"
show: r3
- at: "One SUM formula"
show: s1
- at: "Written out"
morph: [s1, s2]
- at: "a hundred and fifty dollars"
morph: [s2, s3]
- at: "makes an owner say yes"
highlight: s3
- at: "a short email per booking"
show: mail
- at: "attach the error workflow from lesson six"
show: err
- at: "Ollama is down"
show: case1
- at: "the calendar login expires"
show: case2
- at: "emails Lina straight away"
highlight: err
- at: "a polite holding reply"
show: reply
- at: "Nothing fails silently"
highlight: err
note: "Alerted, never silent" Ready to show a client
- Three test messages: easy, taken slot, odd request
- A two-minute screen recording of all three
- A one-page summary: what it does, what it costs, where it runs
layout: full
parts:
demo: {chip: "Client demo", sub: "Ready to show", icon: clipboard-check}
steps:
- at: "A working workflow isn't yet a sale"
highlight: demo
note: "Working is not yet selling"
- at: "the owner can follow without knowing what a node is"
note: "No jargon for the owner"
- at: "Write three test messages"
spokes: {of: demo, items: ["Easy booking", "Taken slot", "Odd request"]}
- at: "an easy booking that goes straight through"
note: "Easy booking: confirmed"
- at: "one that asks for a taken slot"
note: "Taken slot: alternatives"
- at: "an odd one, like a wedding party of eight"
note: "Odd request: a human"
- at: "Record your screen for two minutes"
note: "Two-minute screen recording"
- at: "the chat, the calendar filling in"
note: "Chat, calendar, sheet, email"
- at: "Then write one page"
note: "One-page summary"
- at: "what it never does"
note: "What it never does"
- at: "what it costs to run"
note: "What it costs to run"
- at: "put that hosting cost on the page too"
note: "Hosting cost on the page too"
- at: "Show that page and the owner sees a solved problem"
highlight: demo
note: "A solved problem, not a tech project" Common mistake: trusting the AI with facts
- The model says "Thursday at ten is free" without checking
- Result: two customers, one chair
- Fix: only the calendar decides availability
layout: wide
direction: LR
components:
cust: {kind: user, label: Customer}
cust2: {kind: user, label: Second customer}
llm: {kind: llm, label: Ollama model}
cal: {kind: database, label: Calendar}
links: [cust->llm, cust2->llm, llm->cal]
steps:
- at: "Here's the mistake"
show: [cust, llm, cal]
note: "The mistake that loses clients"
- at: "give the model the whole job"
flow: ["cust>llm: Thursday at 10?"]
note: "The model answers alone"
- at: "Thursday at ten works"
flow: ["llm>cust: Yes, ten works"]
- at: "even when the slot is taken"
highlight: cal
note: "Ten is already taken"
- at: "two customers, one chair"
show: all
flow: ["cust2>llm: Thursday at 10?", "llm>cust2: Yes, ten works"]
note: "Two customers, one chair"
- at: "The fix is the rule from the brief"
highlight: none
note: "Rule from the brief"
- at: "turns words into fields"
highlight: llm
note: "Words in, fields out"
- at: "decided by the calendar node"
highlight: cal
flow: ["llm>cal: check slot", "cal>llm: Free or taken"]
note: "The calendar decides"
- at: "Keep facts in your tools"
highlight: [cal, llm]
note: "Facts in tools, language in the model" Recap
- Design first: customer, assistant, source of truth
- AI extracts fields, tools decide facts, humans get the odd cases
- Log, alert and demo make it sellable
layout: full
parts:
lina: {chip: "Booking assistant", sub: "Three takeaways", icon: scissors}
steps:
- at: "Let's wrap up"
highlight: lina
note: "Three takeaways"
- at: "First, design before you build"
note: "One: design first"
- at: "name the customer, the assistant"
spokes: {of: lina, items: [Customer, Assistant, Source of truth]}
- at: "write down what the assistant must never do"
note: "Write down the limits"
- at: "Second, give each part one job"
note: "Two: one job per part"
- at: "The local model turns messy messages"
note: "Model turns words into fields"
- at: "the calendar decides what's free"
note: "Calendar decides what is free"
- at: "anything unclear goes to the owner"
note: "Unclear goes to the owner"
- at: "Third, the extras are what make it sellable"
note: "Three: the extras sell it"
- at: "a booking log with a weekly total"
note: "Booking log, weekly total"
- at: "an email per booking"
note: "Email per booking"
- at: "an error alert"
note: "Error alert on failure"
- at: "a short demo"
note: "Short demo, one-page summary"
- at: "You've just built a complete"
highlight: lina
note: "Client-ready, free tools" Your exercise
- Build the booking assistant for a business you know
- Run the three test messages and fix what breaks
- Record a two-minute demo and write the one-page summary
layout: full
parts:
task: {chip: "Your exercise", sub: "Your portfolio piece", icon: clipboard-check}
steps:
- at: "Before the next lesson"
highlight: task
note: "Build it for a business you know"
- at: "a barber, a dentist"
note: "Barber, dentist, tutor or groomer"
- at: "Use the webhook"
spokes: {of: task, items: ["Webhook", "Ollama extraction", "Calendar check", "Three-way decision", "Sheet log", "Error workflow"]}
note: "Six parts you already know"
- at: "run your three test messages"
highlight: task
note: "Easy, taken slot, odd request"
- at: "Fix whatever breaks"
note: "Something will break, and that's normal"
- at: "record a two-minute demo"
note: "Two-minute screen recording"
- at: "write the one-page summary"
note: "One-page summary"
- at: "Keep both files"
highlight: task
note: "Keep both files"
- at: "first paying client"
note: "Your first portfolio piece" النص المكتوب
Lina's phone never stops. Meet Lina. She runs a small hair salon with one chair and a lot of loyal clients. Every day her phone fills up with messages: can I come Thursday, do you have anything after work, how much is a beard trim. Every reply means putting down the scissors, checking her paper diary, and typing back. Some messages wait three hours. Some never get answered. Missed messages are missed customers, and those people book somewhere else. That's real money walking out the door. Today you'll build the thing Lina would happily pay for: an assistant that reads those messages, checks her calendar, books the slot or offers alternatives, and tells her what happened. This is the project that ties the whole module together.
What you will learn. Here's the plan for this lesson, in three goals. First, you'll design a booking assistant from a client brief, so you know exactly what it must do and what it must never do. Second, you'll build it in n8n using free tools: a local model in Ollama, Google Calendar and Google Sheets. Third, you'll package it as a demo a client can say yes to, with a two-minute recording and a one-page summary. You already know every piece. Now we connect them.
The client brief as a picture. Before touching n8n, draw the job. On the left is the Customer, typing something like: can I get a haircut next Thursday morning. They don't use a form, they write normal sentences, with typos. In the middle is the Assistant, which is our workflow. Its job is to understand the request, ask for anything missing such as a name, and never invent an answer it can't back up. On the right is the Calendar, Lina's Google Calendar, which is the single source of truth. A slot is free only if the calendar says so. Write these three roles down for every automation project. It keeps the AI in its lane: it understands language, while the calendar decides facts.
The workflow at a glance. Here's the whole system. It starts when a customer types into the chat box on Lina's website. The website sends the text to an n8n webhook, which takes the chat message, the trigger you met in lesson one. Now look at the helpers it calls. First the Ollama model running on your own machine, which turns words into fields. Then Google Calendar, Google Sheets and email, all free at this size. Let's follow one booking request. The message goes to the model, which sends back neat fields. The workflow asks the calendar whether the slot is free, logs the booking in the sheet, emails Lina, and replies to the customer. Every arrow is a node you already know how to configure.
Step 1: words become fields. The first real step is extraction. Omar writes: haircut next Thursday around ten please. That customer message goes into the Ollama prompt, which says: reply only with named parts, such as intent, service, date, time, name and phone. The model hands back the JSON fields, like the block on screen. Also add today's date, using n8n's now expression. Without it, the model guesses what next Thursday means, and often gets the date wrong. Tell it to write null, meaning empty, when something is missing instead of guessing. Here the phone is missing, so we ask: is every field filled? If yes, the request moves on to check the calendar. If no, an IF node sends a polite follow-up asking for a number. Never let the model fill gaps with made-up details.
Step 2: find free slots. Now the calendar check. In n8n, a Google Calendar node fetches Thursday's events, and a small Code node works out what's free. This Python version shows the same logic. You don't need to write it yourself: you can paste it into the Code node as given. Lina works nine to five in one-hour slots, and ten, eleven and two are already booked. The function walks through the day hour by hour and keeps every slot that isn't taken. Omar wants ten, which is booked, so instead of a flat no, the line that starts with near sorts the free slots by how close they are to ten, and we offer the nearest three: nine, noon and one. That one small touch often turns a rejection into a booking.
Step 3: decide and reply. Now the decision. The Free slots check gives the answer, and a Switch node asks: which case is this? There are three paths. The first path, Create event, runs when the slot is free: the workflow creates the calendar event with the client's name and service, then replies: you're booked for Thursday at nine. The second path, Offer 3 times, runs when the slot is taken, so it offers the three nearest times. The third path, Hand to Lina, matters most for trust. If the request is unclear or unusual, like a wedding party, the workflow doesn't try to be clever. It tells the customer that Lina will reply personally. Every path ends with a reply. Clients relax when they see the assistant knows its limits.
Step 4: log, notify, catch errors. Every confirmed booking becomes a row in a Google Sheet, so Lina can read her record without opening n8n. Here are three bookings so far. Sara came in for a haircut at forty-five. Karim chose a cut and beard at sixty. Omar booked a haircut too, at forty-five. One SUM formula totals the column. Written out, it reads forty-five plus sixty plus forty-five. Adding them up gives a hundred and fifty dollars of booked revenue, and that number often makes an owner say yes. She also gets a short email per booking. Finally, attach the error workflow from lesson six. If Ollama is down or the calendar login expires, an Error Trigger emails Lina straight away, and the customer gets a polite holding reply. Nothing fails silently.
Ready to show a client. A working workflow isn't yet a sale. Prepare a demo the owner can follow without knowing what a node is. Write three test messages: an easy booking that goes straight through, one that asks for a taken slot and gets alternatives, and an odd one, like a wedding party of eight, that's handed to a human. Record your screen for two minutes showing the chat, the calendar filling in, the sheet row and the email arriving. Then write one page: what it does, what it never does, and what it costs to run. The model itself is free because it runs locally, and the demo can run on your laptop. But a live assistant on Lina's website needs an always-on computer or a small server with a public address for the webhook, so put that hosting cost on the page too. Show that page and the owner sees a solved problem, not a tech project.
Common mistake: trusting the AI with facts. Here's the mistake that loses clients fastest. It's tempting to give the model the whole job: here's the message, write a nice reply. The model will cheerfully write, yes, Thursday at ten works, because that sounds helpful, even when the slot is taken. The result is a double booking: two customers, one chair, and an owner who switches your system off that afternoon. The fix is the rule from the brief. The model only turns words into fields and writes friendly text. Whether a slot exists is decided by the calendar node, every time. Keep facts in your tools, and language in the model.
Recap. Let's wrap up. First, design before you build: name the customer, the assistant and the source of truth, and write down what the assistant must never do. Second, give each part one job. The local model turns messy messages into fields, the calendar decides what's free, and anything unclear goes to the owner. Third, the extras are what make it sellable: a booking log with a weekly total, an email per booking, an error alert, and a short demo with a one-page summary. You've just built a complete, client-ready automation with free tools.
Your exercise. Before the next lesson, build this assistant for a real or imagined business you know well: a barber, a dentist, a tutor or a dog groomer. Use the webhook, the Ollama extraction step, a Google Calendar check, the three-way decision, the sheet log and the error workflow. Then run your three test messages: an easy booking, a taken slot and an odd request. Fix whatever breaks, because something will, and that's normal. Finally, record a two-minute demo and write the one-page summary. Keep both files. They're the first piece of your portfolio, and the thing you'll show your first paying client.
استكشف الرسوم المتحركة
الرسوم المتحركة نفسها التي في الفيديو، دقيقة وتفاعلية: شغّلها أو أوقفها، أو اسحب المؤشر، أو انتقل إلى أي خطوة بالسرعة التي تناسبك.
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
أجب عن كل الأسئلة ثم تحقّق. تنجح بنسبة 70%، ويمكنك إعادة المحاولة كما تشاء.
ملخص الدرس
- القراءة
- مشاهدة الفيديو
- اجتياز الاختبار (70%)
- Design first: customer, assistant, source of truth
- AI extracts fields, tools decide facts, humans get the odd cases
- Log, alert and demo make it sellable