For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
  • Introduction
    • Overview
    • Installation
    • Developer Onboarding
    • Quick Start
  • Concepts
    • Architecture
    • Call States and Lifecycle
    • Call Commands
    • Audio Streaming
    • Event Handling
  • Integrations
    • Google GenAI SDK (Gemini Live)
    • Google ADK (Agent Development Kit)
  • Use Cases
    • After-hours Voicemail
    • Appointment Booking
    • Call Monitoring and Coaching
    • Database Lookup
    • Human Escalation
    • Interactive Notifications
  • Reference
    • API Reference
    • Error Handling
    • Advanced Topics
LogoLogo
On this page
  • Overview
  • Example
  • How It Works
  • Key Commands Used
  • Related
Use Cases

Interactive Notifications

||View as Markdown|
Was this page helpful?
Previous

Human Escalation

Next

API Reference

Built with

Deliver pending notifications to callers and collect interactive responses, with database tracking of acknowledgments and follow-ups.

Overview

This use case demonstrates:

  • Delivering pending notifications to callers
  • Interactive voice response via AI
  • Database acknowledgment tracking
  • Follow-up flagging for unconfirmed items

State flow: PENDING -> ANSWERED -> DISCONNECTED

Example

1@client.on(events.INCOMING_CALL)
2async def interactive_notification(call: ActiveCall):
3 await call.answer()
4
5 customer = await db.get_customer_by_phone(call.caller_number)
6 pending_notifications = await db.get_pending_notifications(customer.id)
7
8 for notification in pending_notifications:
9 await call.send_audio(
10 await tts.synthesize(notification.message)
11 )
12
13 # AI listens for confirmation/response
14 response = await ai_model.get_caller_response(call)
15
16 if response.confirmed:
17 await db.mark_notification_acknowledged(notification.id)
18 await call.send_audio(
19 await tts.synthesize("Got it, that's been confirmed.")
20 )
21 else:
22 await db.flag_for_followup(notification.id)
23 await call.send_audio(
24 await tts.synthesize(
25 "No problem, someone from our team will follow up."
26 )
27 )
28
29 await call.send_audio(
30 await tts.synthesize("That's everything. Have a great day!")
31 )
32 await call.disconnect()

How It Works

  1. When the caller calls in, the AI answers and identifies the customer by phone number
  2. It retrieves all pending notifications from the database for that customer
  3. For each notification, the AI:
    • Reads the notification message aloud
    • Listens for the caller’s response using AI comprehension
    • If confirmed: marks the notification as acknowledged in the database
    • If not confirmed: flags it for follow-up by a human team member
  4. After all notifications are delivered, the AI signs off and ends the call

Key Commands Used

  • answer() - Answer the incoming call
  • send_audio() - Read notifications aloud
  • disconnect() - End the call

Related

  • AI Receptionist with Database Lookup - Similar CRM-driven pattern
  • Appointment Booking - Another conversational data-gathering flow