Skip to content

signalwire/santa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ… Santa's Workshop AI - Interactive Voice Assistant

An enchanting AI-powered Santa experience that allows children (and adults!) to have real-time voice conversations with Santa Claus. Built with SignalWire's AI Agent technology, this application features dynamic gift searching, real-time product displays, and a magical Christmas atmosphere.

Santa's Workshop Python License

πŸŽ„ Features

Voice Interaction

  • Real-time conversations with Santa using SignalWire's AI Agent
  • ElevenLabs voice synthesis for authentic Santa voice
  • Natural language processing for understanding gift requests
  • WebRTC video/audio streaming with festive backgrounds

Dynamic Gift Search

  • Real-time Amazon product search via RapidAPI
  • Visual gift gallery with product images and details
  • Interactive gift selection with 3D card effects
  • Smart product recommendations based on conversation context

Festive UI Elements

  • Animated snowfall with accumulation effect
  • Twinkling Christmas lights with individual bulb animations
  • Aurora Borealis background effects
  • Christmas countdown timer
  • Background holiday music with volume controls

Interactive Features

  • Nice list checker with animated results
  • Gift selection confirmation with confetti effects
  • Responsive design for all devices

πŸš€ Quick Start

Prerequisites

  • Python 3.9+
  • SignalWire account with AI Agent access
  • RapidAPI account for Amazon product search

Environment Setup

  1. Clone the repository:
git clone https://github.com/signalwire/santa.git
cd santa
  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Create .env file:
# SignalWire Configuration
SIGNALWIRE_PROJECT_ID=your_project_id
SIGNALWIRE_TOKEN=your_auth_token
SIGNALWIRE_SPACE=your_space.signalwire.com

# RapidAPI Configuration
RAPIDAPI_KEY=your_rapidapi_key
RAPIDAPI_HOST=real-time-amazon-data.p.rapidapi.com

# Optional: Custom domain
HTTP_USERNAME=your_username
HTTP_PASSWORD=your_password
HTTP_DOMAIN=your-domain.com

# Server Configuration
PORT=5000
HOST=0.0.0.0

Running Locally

  1. Start the application:
python santa_ai.py
  1. Access the application:

    • Open your browser to http://localhost:5000
    • Click "Talk to Santa!" to begin
  2. Configure SignalWire phone number:

    • Point your SignalWire number to: https://your-domain.com/swml
    • Set the webhook type to "Voice"

🎁 Usage Guide

Starting a Conversation

  1. Click the green "Talk to Santa!" button
  2. Allow microphone/camera permissions when prompted
  3. Santa will greet you with his jolly voice
  4. Tell Santa what gifts you'd like for Christmas

Searching for Gifts

  • Say something like: "I want a toy robot"
  • Santa will search his workshop catalog
  • 4 gift options will appear with images and details
  • Say "option 1", "option 2", "option 3", or "option 4" to select

Interactive Elements

  • Mute Button: Toggle your microphone during the call
  • Snow Effect: Watch snow accumulate at the bottom
  • Christmas Lights: Individual bulbs twinkle independently
  • Gift Cards: Hover for 3D effects, click to select

πŸ› οΈ Architecture

Backend (Python/FastAPI)

santa_ai.py
β”œβ”€β”€ SantaAI class (SignalWire AI Agent)
β”œβ”€β”€ SWAIG Functions
β”‚   β”œβ”€β”€ search_gifts()
β”‚   β”œβ”€β”€ select_gift()
β”‚   └── check_nice_list()
β”œβ”€β”€ RapidAPI Integration
└── WebSocket Communication

Frontend (HTML/CSS/JavaScript)

web/
β”œβ”€β”€ index.html          # Main application page
β”œβ”€β”€ app.js             # SignalWire SDK integration
β”œβ”€β”€ styles.css         # Festive styling & animations
└── media/             # Audio/video assets

State Management

  • Gift State: Tracks search results and selections
  • Conversation Context: Manages dialogue flow
  • Frontend Events: Real-time UI updates via WebSocket

πŸ“± Deployment

Dokku Deployment

  1. Create a Dokku app:
dokku apps:create santa-ai
  1. Set environment variables:
dokku config:set santa-ai SIGNALWIRE_PROJECT_ID=xxx
dokku config:set santa-ai SIGNALWIRE_TOKEN=xxx
dokku config:set santa-ai RAPIDAPI_KEY=xxx
  1. Deploy:
git remote add dokku dokku@your-server:santa-ai
git push dokku main

Production Considerations

  • SSL/TLS: Required for WebRTC connections
  • CORS: Configure for your domain
  • Rate Limiting: Implement for API endpoints
  • Monitoring: Add logging and error tracking
  • Scaling: Use load balancer for multiple instances

🎨 Customization

Voice Options

Edit voice ID in santa_ai.py:

voice_id = 'uDsPstFWFBUXjIBimV7s'  # Santa voice

Visual Theme

Modify CSS variables in styles.css:

--christmas-red: #C41E3A;
--christmas-green: #165B33;
--christmas-gold: #FFD700;

Search Behavior

Adjust product count in santa_ai.py:

for i, product in enumerate(products[:4], 1):  # Shows 4 products

πŸ› Troubleshooting

Common Issues

No Audio/Video

  • Ensure HTTPS is enabled (required for WebRTC)
  • Check browser permissions for microphone/camera
  • Verify SignalWire credentials

Search Not Working

  • Confirm RapidAPI key is valid
  • Check API rate limits
  • Verify network connectivity

Mute Button Issues

  • Refresh browser to clear cache
  • Check console for WebRTC errors

πŸ“Š API Documentation

API Endpoints

POST /swml

  • Receives SignalWire AI Agent requests
  • Returns SWML instructions

GET /swml

  • Alternative webhook endpoint for SignalWire

GET /health

  • Health check endpoint
  • Returns: {"status": "healthy"}

GET /api/info

  • System information endpoint
  • Returns API version and status

Frontend Events

Events sent via WebSocket:

  • gifts_found: Products found from search
  • gift_selected: User selected a gift
  • nice_list_checked: Nice list verification complete
  • searching: Search in progress
  • search_failed: Search encountered an error

🀝 Contributing

We welcome contributions!

Development Setup

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

πŸ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • SignalWire - AI Agent platform and WebRTC infrastructure
  • ElevenLabs - Voice synthesis technology
  • RapidAPI - Real-time Amazon product data
  • Open Source Community - Various libraries and tools

πŸ”— Links

πŸ“ž Support

For questions and support:


πŸŽ„ Happy Holidays from SignalWire! πŸŽ…

Built with ❀️ and holiday magic by the SignalWire team.

About

AI Agent Santa's Workshop

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published