Module 13 · ai · intermediate
Exercises 13 · AI Voice Agent Backend
Start from workflow/starter.json (endpoint, normalizer, availability, formatter) or your finished lesson workflow.
Exercise 1: Parallel tool calls
Task: Vapi can send two tool calls in one request (e.g. lookup_customer and check_availability). Make the workflow reply with one response containing both results.
Done when: a Vapi payload with two calls returns results with two entries, each with the right toolCallId.
Hint
When items take different Switch branches, Format for Platform runs once per branch. Put a Merge (mode Append, number of inputs = 5) before it, so all branches are combined first.
Exercise 2: Alert the owner
Task: Replace Notify Owner (Exercise 2) with an SMS, Telegram or email to the business owner containing the caller's number, intent and follow-up reason.
Done when: WITH_CREDS=1 ./test/test.sh (the emergency transcript) triggers the alert.
Hint
Use the fields from Call Record. For SMS, Twilio's Send SMS node; for free testing, Telegram.
Exercise 3: Real calendar
Task: Make check_availability and book_appointment use Google Calendar instead of static data.
Done when: booking via the API creates a calendar event, and availability excludes busy times from the calendar.
Hint
Google Calendar → Get Many events for the day (busy times), then compute free slots in a Code node. Book with Create Event. Keep the same { ok, message } contract so nothing else changes.
Stretch: Verify the caller is really Retell
Reject requests without a valid X-Retell-Signature header (Retell signs the body with your API key). This stops anyone who finds your URL from booking appointments.