-
Notifications
You must be signed in to change notification settings - Fork 0
Bot System
Aziel edited this page Dec 16, 2025
·
2 revisions
AZ-WAP includes a reusable AI bot system that operates independently from WhatsApp. This architecture allows the bot to be used with multiple communication channels.
The bot system is not tied to WhatsApp. It can:
- Process messages from any source
- Generate responses independently
- Be triggered via API for external integrations
- Maintain conversation context across channels
┌─────────────────────────────────────────────┐
│ Bot System (Core) │
│ ┌───────────────────────────────────────┐ │
│ │ • AI Provider (Gemini) │ │
│ │ • System Prompt │ │
│ │ • Knowledge Base │ │
│ │ • Memory/Context │ │
│ └───────────────────────────────────────┘ │
└─────────────────┬───────────────────────────┘
│
┌─────────────┼─────────────┐
▼ ▼ ▼
┌────────┐ ┌──────────┐ ┌──────────┐
│WhatsApp│ │ Chatwoot │ │ External │
│ │ │ │ │ API │
└────────┘ └──────────┘ └──────────┘
POST /bots
Content-Type: application/json
{
"name": "Sales Assistant",
"description": "Handles sales inquiries",
"provider": "gemini",
"api_key": "your-gemini-api-key",
"model": "gemini-2.0-flash",
"system_prompt": "You are a helpful sales assistant...",
"audio_enabled": true,
"image_enabled": true,
"memory_enabled": true
}| Field | Description |
|---|---|
name |
Bot display name |
provider |
AI provider (gemini) |
api_key |
Provider API key |
model |
Model to use |
system_prompt |
Base instructions for the AI |
knowledge_base |
Additional context/documentation |
timezone |
Timezone for date/time awareness |
audio_enabled |
Process audio messages |
image_enabled |
Process image messages |
memory_enabled |
Maintain conversation history |
PUT /instances/{id}/bot
{
"bot_id": "bot-uuid"
}AZ-WAP's bot system handles message processing internally, which means:
- No External Bot Dependencies: You don't need Chatwoot's agent bot
- Faster Response Times: Direct processing without external API hops
- Duplicate Prevention: Single source of truth for message handling
- Unified Logic: Same bot works across WhatsApp and other channels
- Message arrives (WhatsApp, webhook, etc.)
- AZ-WAP routes to assigned bot
- Bot processes and generates response
- Response is sent to all configured destinations:
- Back to WhatsApp (if from WhatsApp)
- To Chatwoot (if enabled)
- To webhooks (if configured)
The bot can process messages without WhatsApp:
POST /bot/{bot_id}/chat
Content-Type: application/json
{
"session_id": "unique-session-id",
"message": "Hello, I need help with..."
}This allows you to:
- Build custom chat interfaces
- Integrate with other platforms
- Use the same AI logic across your application
For security, you can store API keys separately:
POST /credentials
{
"name": "Gemini Production",
"kind": "gemini",
"api_key": "your-api-key"
}Then reference by ID in bot configuration:
{
"credential_id": "credential-uuid"
}