A professional, production-ready template for building AI-powered chat agents using A1Base and Next.js. This template enables multi-channel communication through WhatsApp, Email, Slack, Teams, and SMS, with a focus on WhatsApp integration.
- 🧠 Advanced AI Integration - Powered by OpenAI's GPT-4
- 📱 Multi-Channel Support - WhatsApp, Email, Slack, Teams, and SMS
- 💾 Persistent Chat History - Complete message tracking and storage
- ⚡ Modern Architecture - Built on Next.js 14 with TypeScript
- 🔐 Secure Configuration - Environment-based security setup
- 📦 Quick Deployment - Simple npm-based installation
- 🛡️ Safety First - Configurable safety settings and content filtering
- 🎯 Customizable Workflows - Flexible message handling and routing
- Node.js 18.x or later
- A1Base account with API credentials
- OpenAI API key
- WhatsApp business number (via A1Base)
-
Clone the repository
git clone https://github.com/yourusername/a1base-nextjs-template cd a1base-nextjs-template
-
Install dependencies
npm install
-
Configure environment
cp .env.example .env.local
Update
.env.local
with your credentials:A1BASE_API_KEY=your_api_key # From A1Base Dashboard A1BASE_API_SECRET=your_api_secret # From A1Base Dashboard A1BASE_ACCOUNT_ID=your_account_id # From A1Base Dashboard A1BASE_AGENT_NUMBER=your_agent_number # From A1Base Dashboard A1BASE_AGENT_NAME=your_agent_name # From A1Base Dashboard A1BASE_AGENT_EMAIL=[email protected] # From A1Base Dashboard OPENAI_API_KEY=your_openai_key # From OpenAI Dashboard CRON_SECRET=your_generated_secret # Generate your own secure random string
-
Set up A1Base credentials
- Register at A1Base Dashboard
- Access Settings > API Keys for credentials
- Locate Account ID in Dashboard overview
- Configure WhatsApp business number
-
Launch development server
npm run dev
Your agent will be available at http://localhost:3000
-
Expose Local Server
ngrok http 3000
-
Configure A1Base Webhook
- Navigate to Settings > Webhooks in A1Base Dashboard
- Set Webhook URL:
https://your-ngrok-url/api/whatsapp/incoming
- Save configuration
-
Verify Setup
- Send test message to WhatsApp business number
- Confirm AI response
- Review console logs for debugging
- Agent Personality: Modify
lib/agent-profile/agent-profile-settings.json
- Safety Settings: Update
lib/safety-config/safety-settings.json
- AI Response Logic: Customize
lib/services/openai.ts
- Message Handling: Adjust
lib/ai-triage/triage-logic.ts
- Workflows: Enhance
lib/workflows/basic_workflow.ts
- Interface: Modify
app/page.tsx
The template includes a cron job system for automated tasks:
- Configure in
app/api/cron/route.ts
- Set up scheduled tasks in
lib/cron-job/cron-job.ts
- Secure with CRON_SECRET environment variable
We welcome contributions! Please see our Contributing Guidelines for details.
This project is licensed under the MIT License - see the LICENSE file for details.
- A1Base Integration: Documentation
- Template Issues: GitHub Issues
- General Inquiries: A1Base Support