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
