Module 20 · ai · intermediate
Exercises 20 · WhatsApp AI Assistant
Start from workflow/starter.json (triggers, verification, parsing) or your finished lesson workflow.
Exercise 1: Save leads to Google Sheets
Task: Replace Save Lead (Exercise 1) with a Google Sheets append: time, WhatsApp number, name, service, ZIP, preferred time, and a link to the chat (https://wa.me/<wa_id>).
Done when: finishing a booking adds exactly one row, even if Meta retries the webhook.
Exercise 2: Alert staff on handoff and emergencies
Task: Replace Alert Staff (Exercise 2) with a Slack message (or email) to the team: who, why (handoff, emergency, or a message while a human has the chat), the last few messages, and a release link.
Done when: "can I talk to a person?" pings the team within seconds, and an emergency message is marked urgent.
Hint
The last messages are in the conversation: call GET /webhook/wa/conversation?wa_id=… with an HTTP Request node, or read static data in a Code node. Use action to choose the wording.
Exercise 3: Follow up on unfinished bookings (24-hour window)
Task: Every hour, find conversations that started a booking (awaiting is set) but went quiet for 2+ hours, and send one reminder, only while the 24-hour window is still open.
Done when: a chat stuck at "What's the ZIP code?" gets one nudge after 2 hours, none after the window closes, and none if the customer replied.
Hint
Add a Schedule Trigger and a new Route output. Loop over db.convos, check awaiting, last_inbound_at, window_open_until and a new nudged_at field. Outside the window you'd need an approved template (WhatsApp Send Template).
Stretch: Voice notes
Transcribe voice notes (WhatsApp Media → Download, then OpenAI Transcribe) and feed the text into the normal flow instead of asking the customer to type.