2025-11-23 17:02:22 -03:00
# Universal Messaging & Multi-Channel
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
BotServer automatically handles conversations across different channels (Web, WhatsApp, Email, etc.) using the same BASIC scripts. Write once, deploy everywhere.
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
## How It Works
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
Your BASIC scripts don't need to know which channel they're running on. The same `TALK` and `HEAR` commands work universally:
2025-11-21 23:23:53 -03:00
```basic
2025-11-23 17:02:22 -03:00
TALK "Hello! How can I help you?"
HEAR response
TALK "You said: " + response
2025-11-21 23:23:53 -03:00
```
2025-11-23 17:02:22 -03:00
This script works identically whether the user is:
- Chatting via web browser
- Messaging on WhatsApp
- Sending emails
- Using Microsoft Teams
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
## Supported Channels
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
### Web (Default)
The primary channel. Users access via browser at `http://localhost:8080` .
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
### WhatsApp Business
Requires WhatsApp Business API configuration. Messages are automatically formatted for WhatsApp's constraints.
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
### Email
Bots can receive and respond to emails. Each email thread becomes a conversation session.
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
### Microsoft Teams
Deploy bots directly to Teams channels and direct messages.
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
## Channel Detection
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
BotServer automatically detects the channel based on the session context. No special code needed:
2025-11-21 23:23:53 -03:00
```basic
2025-11-23 17:02:22 -03:00
' This works on ALL channels
TALK "Welcome to our service!"
TALK "What's your name?"
HEAR name
TALK "Nice to meet you, " + name
2025-11-21 23:23:53 -03:00
```
2025-11-23 17:02:22 -03:00
## Channel-Specific Formatting
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
While your code stays the same, BotServer automatically handles channel-specific formatting:
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
### Web
- Full HTML support
- Rich formatting
- Images and media
- Interactive elements
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
### WhatsApp
- Plain text with emoji
- Media as attachments
- Quick reply buttons
- 1024 character limit per message
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
### Email
- HTML email format
- Subject line handling
- Attachments
- Proper threading
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
### Teams
- Adaptive cards
- @mentions
- Channel vs DM detection
- Teams-specific formatting
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
## Media Handling
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
Send files and media universally:
2025-11-21 23:23:53 -03:00
```basic
2025-11-23 17:02:22 -03:00
' Works on all channels that support files
SEND FILE "report.pdf"
TALK "I've sent you the report."
2025-11-21 23:23:53 -03:00
```
2025-11-23 17:02:22 -03:00
Each channel handles files appropriately:
- Web: Download link
- WhatsApp: Document attachment
- Email: Email attachment
- Teams: File card
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
## Session Management
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
Each channel maintains its own session handling:
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
- **Web**: Cookie-based sessions
- **WhatsApp**: Phone number as session ID
- **Email**: Thread ID as session
- **Teams**: User/channel context
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
## Configuration
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
Channel configuration is done in the bot's `config.csv` :
2025-11-21 23:23:53 -03:00
```csv
2025-11-23 17:02:22 -03:00
channel-web,enabled
channel-whatsapp,enabled
channel-email,enabled
channel-teams,disabled
2025-11-21 23:23:53 -03:00
```
2025-11-23 17:02:22 -03:00
## Best Practices
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
1. **Keep messages concise** - Some channels have length limits
2. **Use simple formatting** - Not all channels support rich text
3. **Test on target channels** - Ensure your bot works well on each
4. **Handle media gracefully** - Not all channels support all file types
5. **Consider response times** - Email is async, chat is real-time
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
## Channel Limitations
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
| Channel | Message Length | Media Support | Rich Text | Real-time |
|---------|---------------|---------------|-----------|-----------|
| Web | Unlimited | Full | Yes | Yes |
| WhatsApp | 1024 chars | Images, Docs | Limited | Yes |
| Email | Unlimited | Attachments | HTML | No |
| Teams | 28KB | Full | Adaptive Cards | Yes |
2025-11-21 23:23:53 -03:00
2025-11-23 17:02:22 -03:00
## Summary
2025-11-21 23:23:53 -03:00
2025-11-23 20:12:09 -03:00
Universal messaging means your BASIC scripts work across all channels without modification. BotServer handles the complexity of channel-specific formatting and delivery, letting you focus on the conversation logic.