Skip to content

Ashish-Rautela/AI_PHONE_AGENT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🚀 AI-Powered Promotion & Customer Support System

A futuristic, space-themed AI platform for personalized promotions and intelligent customer support

FeaturesWorkflowsInstallationUsageAPI ReferenceTech Stack


📋 Overview

This project combines cutting-edge AI technology with an immersive space-themed interface to deliver two powerful functionalities:

  • Promotion AI: Generate personalized promotional messages for targeted marketing campaigns
  • Customer Support AI: Provide intelligent, context-aware customer service with order management

Both systems feature speech recognition, text-to-speech capabilities, and real-time AI processing powered by OpenAI's GPT models.


✨ Features

🎯 Promotion AI

  • Personalized promotional message generation
  • Dynamic content creation based on customer data
  • Text-to-speech conversion for audio promotions
  • Customizable offers and product recommendations

💬 Customer Support AI

  • Intelligent query understanding and response
  • Order tracking and management
  • Natural language processing for customer inquiries
  • Voice interaction with speech-to-text and text-to-speech

🎨 User Experience

  • Futuristic space-themed interface
  • Voice input/output capabilities
  • Real-time AI responses
  • Responsive and accessible design

🔄 Workflows

1️⃣ Promotion AI Workflow

Objective: Deliver personalized promotional messages to individual customers based on their profiles and targeted campaigns.

graph LR
    A[User Input] --> B[Frontend]
    B --> C[POST Request]
    C --> D[Backend Processing]
    D --> E[OpenAI GPT]
    E --> F[Generated Message]
    F --> G[Frontend Display]
    F --> H[Text-to-Speech]
    H --> I[Audio Playback]
Loading

Process:

  1. Frontend Interaction

    • User provides customer details through the space-themed interface
    • Input includes: customer name, product, discount offer, and promotional link
    • Data sent via POST request to backend
  2. Backend Processing

    • Receives customer data and promotional parameters
    • Constructs personalized message using OpenAI's GPT model
    • Applies dynamic templating for natural, engaging content

    Example:

   Input: {
     "name": "John",
     "product": "Smartphone X",
     "offer": "20% off",
     "link": "https://example.com"
   }
   
   Output: "Hi John! We're thrilled to offer you an exclusive 20% 
   discount on Smartphone X. Don't miss out! Visit https://example.com 
   to grab your deal."
  1. Output
    • Generated message displayed in the UI
    • Optional audio conversion using TTS for voice promotions
    • Message can be saved or sent directly to customer

2️⃣ Customer Support AI Workflow

Objective: Assist customers by answering queries and providing detailed order information.

graph LR
    A[Customer Query] --> B[Speech/Text Input]
    B --> C[Frontend Processing]
    C --> D[POST Request]
    D --> E{Query Type}
    E -->|General| F[AI Response]
    E -->|Order Related| G[Order Lookup]
    G --> H[orders.json]
    H --> I[Order Details]
    I --> F
    F --> J[Text Response]
    J --> K[Text-to-Speech]
    K --> L[Audio Playback]
Loading

Process:

  1. Frontend Interaction

    • User speaks or types their query in the interface
    • For order queries: name and order ID are provided
    • Data transmitted to backend via POST request
  2. Backend Processing

    For General Queries:

    • AI analyzes query intent using GPT model
    • Generates response based on customer service prompt
    • Returns helpful, context-aware answer

    For Order-Related Queries:

    • Backend searches orders.json for matching order ID
    • If found: retrieves order details (status, items, delivery info)
    • If not found: generates apologetic response with troubleshooting tips
    • AI integrates order data into natural language response
  3. Output

    • AI-generated response displayed as text in UI
    • Response converted to speech for audio playback
    • Accessible format ensures clear communication

3️⃣ Supporting Features

🎤 Speech-to-Text Integration

  • Web Speech API captures user voice input
  • Real-time conversion from speech to text
  • Seamless integration with query processing
  • Hands-free interaction for accessibility

🔊 Text-to-Speech Integration

  • Converts all responses to natural-sounding audio
  • Supports promotional messages and support responses
  • Base64-encoded audio streaming
  • Multiple voice options available

📦 Order Management

  • JSON-based order storage (orders.json)
  • Real-time order retrieval and lookup
  • Dynamic order creation through API
  • Scalable data structure for order tracking

🚀 Installation

Prerequisites

  • Node.js (v14 or higher)
  • npm or yarn
  • OpenAI API key

Steps

  1. Clone the repository
   git clone https://github.com/yourusername/ai-promotion-support.git
   cd ai-promotion-support
  1. Install dependencies
   npm install
  1. Configure environment variables

    Create a .env file in the root directory:

   OPENAI_API_KEY=your_openai_api_key_here
   PORT=3000
  1. Set up orders database

    Create orders.json in the data directory:

   {
     "orders": [
       {
         "orderId": "12345",
         "customerName": "John Doe",
         "product": "Smartphone X",
         "status": "Shipped",
         "deliveryDate": "2025-12-10"
       }
     ]
   }
  1. Start the application
   npm start
  1. Access the application

    Open your browser and navigate to http://localhost:3000


💻 Usage

Promotion AI

  1. Navigate to the Promotion AI section
  2. Enter customer details:
    • Customer name
    • Product name
    • Discount offer
    • Promotional link
  3. Click Generate Promotion
  4. View the personalized message
  5. Optional: Click Play Audio to hear the promotion

Customer Support AI

  1. Navigate to the Customer Support section
  2. Choose input method:
    • Type your query, or
    • Click the microphone icon to speak
  3. For order queries, provide:
    • Your name
    • Order ID
  4. Submit your query
  5. Receive AI-generated response
  6. Optional: Listen to audio response

📡 API Reference

Promotion Endpoint

POST /api/promotion

Request:
{
  "name": "John",
  "product": "Smartphone X",
  "offer": "20% off",
  "link": "https://example.com"
}

Response:
{
  "message": "Hi John! We're thrilled to offer...",
  "audio": "base64_encoded_audio_string"
}

Support Endpoint

POST /api/support

Request:
{
  "query": "Where is my order?",
  "name": "John Doe",
  "orderId": "12345"
}

Response:
{
  "response": "Your order #12345 is currently...",
  "audio": "base64_encoded_audio_string",
  "orderDetails": { ... }
}

Order Management

GET /api/orders/:orderId

POST /api/orders - Create new order


🛠️ Tech Stack

Frontend

  • HTML5, CSS3, JavaScript
  • Web Speech API
  • Responsive Design
  • Space-themed UI/UX

Backend

  • Node.js
  • Express.js
  • OpenAI GPT API
  • JSON-based data storage

AI & ML

  • OpenAI GPT-4
  • Natural Language Processing
  • Text-to-Speech (TTS)
  • Speech Recognition

📁 Project Structure

.
├── public/
│   ├── index.html
│   ├── styles.css
│   └── script.js
├── src/
│   ├── routes/
│   │   ├── promotion.js
│   │   └── support.js
│   ├── services/
│   │   ├── ai.js
│   │   ├── tts.js
│   │   └── orders.js
│   └── app.js
├── data/
│   └── orders.json
├── .env
├── package.json
└── README.md

🔒 Security & Privacy

  • API keys stored securely in environment variables
  • No customer data logged or stored permanently
  • HTTPS recommended for production deployment
  • Input validation and sanitization implemented

🚧 Future Enhancements

  • Multi-language support
  • Advanced analytics dashboard
  • CRM integration
  • Email/SMS notification system
  • Machine learning for intent classification
  • Database integration (PostgreSQL/MongoDB)
  • User authentication and authorization
  • Rate limiting and API security

🤝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

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


👥 Authors


🙏 Acknowledgments

  • OpenAI for GPT API
  • Web Speech API contributors
  • Space-themed design inspiration

Made with ❤️ and AI

⬆ Back to Top

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors