An intelligent AI-powered sales assistant widget for Shopify stores that helps customers find products, answer questions, and provide personalized recommendations.
- 🎯 Smart Product Recommendations - AI-powered product suggestions based on customer queries
- 💬 Real-time Chat Interface - Floating chat widget with customizable positioning
- 🎨 Fully Customizable - Admin panel to configure colors, text, position, and behavior
- 📱 Mobile Responsive - Optimized for all device sizes
- 🔌 N8N Integration - Optional integration with N8N workflows for advanced AI processing
- ⚡ Real-time Updates - Settings changes reflect immediately on the storefront
- 🛡️ Secure - Built with Shopify's security best practices
- Frontend: Remix with TypeScript and Shopify Polaris UI
- Backend: Node.js with Prisma ORM and SQLite database
- Theme Extension: Liquid template with vanilla JavaScript
- AI Integration: N8N webhooks with fallback processing
- Authentication: Shopify OAuth with session management
- Node.js 18+ and npm
- Shopify Partner account
- Shopify CLI 3.0+
-
Clone the repository
git clone https://github.com/SankaiAI/iheard.ai.git cd iheard.ai -
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env # Edit .env with your Shopify app credentialsRequired values for
.env:SHOPIFY_API_KEY: Get from Shopify Partner Dashboard > Apps > [Your App] > App setup (Client ID)SHOPIFY_SALES_ASSISTANT_WIDGET_ID: Generate a UUID at uuidgenerator.net
Optional N8N Integration:
N8N_WEBHOOK_URL: Your N8N webhook URL for AI processingN8N_API_KEY: N8N API key (if authentication required)
See
SETUP.mdfor detailed instructions on obtaining these values. SeeN8N_SETUP.mdfor complete N8N workflow setup. -
Configure Shopify app
cp shopify.app.example.toml shopify.app.toml # Edit shopify.app.toml with your app details -
Set up the database
npx prisma generate npx prisma migrate dev
-
Start development server
shopify app dev
Create a .env file with the following variables:
SHOPIFY_API_KEY=your_shopify_api_key_here
SHOPIFY_SALES_ASSISTANT_WIDGET_ID=your_widget_id_hereUpdate shopify.app.toml with your app details:
client_id = "your_shopify_app_client_id"
name = "ihear.ai"
application_url = "https://your-tunnel-url.trycloudflare.com"ihear-ai/
├── app/ # Remix application
│ ├── routes/ # App routes
│ │ ├── app.settings.tsx # Admin settings page
│ │ ├── api.widget-settings.tsx # Widget settings API
│ │ └── apps.sales-assistant-api.tsx # AI chat API
│ ├── db.server.ts # Database connection
│ └── shopify.server.ts # Shopify authentication
├── extensions/ # Shopify theme extensions
│ └── sales-assistant-widget/ # AI widget extension
│ ├── blocks/ # Theme blocks
│ │ └── ai_sales_assistant.liquid # Main widget
│ ├── assets/ # Static assets
│ ├── locales/ # Translations
│ └── snippets/ # Reusable snippets
├── prisma/ # Database schema and migrations
│ ├── schema.prisma # Database schema
│ └── migrations/ # Database migrations
└── services/ # External services
└── n8n.service.ts # N8N integration
- Enable/Disable - Toggle widget on/off across the store
- Position Settings - 6 positioning options (corners and center sides)
- Customization - Button text, chat title, welcome message, placeholder text
- Color Picker - Fully functional color customization
- Live Preview - See changes in real-time
- Default Workflow - Use the developer's pre-configured AI assistant with product recommendations
- Custom N8N Workflow - Configure your own N8N webhook URL for custom AI processing
- Dynamic Switching - Easily switch between default and custom workflows
- Fallback Protection - Automatic fallback to local processing if webhooks fail
- Changes in admin panel update the storefront within 5 seconds
- Database persistence ensures settings survive server restarts
- Fallback to default settings if API is unavailable
# Generate Prisma client
npx prisma generate
# Create and apply migrations
npx prisma migrate dev --name description
# Reset database (development only)
npx prisma migrate reset
# View database in browser
npx prisma studioshopify app dev, you must update the App Proxy URL in your Shopify Partner Dashboard because the tunnel URL changes.
Quick Steps:
- Check your new tunnel URL in
shopify.app.toml→application_url - Update the proxy URL in Partner Dashboard → Apps → [Your App] → App setup → App proxy
- Set proxy URL to:
https://NEW-TUNNEL-URL.trycloudflare.com/api/widget-settings
Why this matters:
- The widget needs to fetch settings from your app's API
- Tunnel URLs change on each restart for security
- Without updating the proxy URL, you'll get "Failed to fetch" errors
See SETUP.md for detailed instructions on app proxy configuration.
The widget is built as a Shopify theme extension block that can be added to any theme template. It automatically:
- Fetches configuration from the admin panel
- Applies custom styling and positioning
- Handles real-time chat interactions
- Integrates with the AI backend
GET /api/widget-settings- Fetch widget configurationPOST /apps/sales-assistant-api- Process AI chat messages
1. Default Developer Workflow
- Pre-configured AI assistant with product recommendations
- Works out-of-the-box with no additional setup
- Integrated with your store's product catalog
- Handles common customer queries automatically
2. Custom N8N Workflow
- Configure your own N8N webhook URL through the admin panel
- Advanced AI processing with full customization
- Integrate with external AI services (OpenAI, Claude, etc.)
- Custom business logic and integrations
Admin Panel Configuration:
- Go to App Settings → AI Workflow Configuration
- Choose between "Use Developer's Default Workflow" or "Use My Custom N8N Workflow"
- If using custom: Enter your N8N webhook URL (must be HTTPS)
- Save settings - changes take effect immediately
Environment Configuration (Optional):
- Set
N8N_WEBHOOK_URLin.envfor a global default - Individual stores can override this with their own webhook URLs
- Supports both shared and per-store N8N configurations
The app provides robust fallback protection:
- If custom webhook fails → Falls back to local processing
- If network issues occur → Provides helpful default responses
- Ensures chat widget always works regardless of external dependencies
The app runs in development mode with Shopify CLI:
shopify app devFor production deployment, you'll need to:
- Set up a production server (Railway, Heroku, etc.)
- Configure production environment variables
- Set up a production database
- Deploy using Shopify CLI
shopify app deploy- API Keys: Never commit
.envorshopify.app.tomlfiles - Database: SQLite is suitable for development; use PostgreSQL for production
- CORS: Widget API includes proper CORS headers for cross-origin requests
- Authentication: All admin routes require Shopify OAuth authentication
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: Shopify App Development
- Issues: Open an issue on GitHub
- Discussions: Use GitHub Discussions for questions and ideas
- Built with Shopify CLI
- UI components from Shopify Polaris
- Database ORM by Prisma
- Web framework by Remix
Made with ❤️ for the Shopify ecosystem
