Available Adapters
MemoryDB
In-memory storage for development and testing
JSON File
Simple file-based persistence for small applications
MongoDB
NoSQL database for flexible, scalable storage
MySQL
Relational database with robust transaction support
PostgreSQL
Advanced relational database with rich features
Choosing a Database
MemoryDB
Best for:- Local development
- Testing
- Proof of concepts
- Stateless bots (no persistence needed)
JSON File Database
Best for:- Small bots with low traffic
- Single-server deployments
- Simple projects without database infrastructure
MongoDB
Best for:- Flexible schema requirements
- Horizontal scaling
- Document-oriented data
- Cloud deployments (MongoDB Atlas)
MySQL
Best for:- Traditional relational data models
- Existing MySQL infrastructure
- ACID transaction requirements
- Well-established hosting options
PostgreSQL
Best for:- Advanced SQL features
- Complex queries and relationships
- Contact management with custom fields
- High-performance production environments
Common Interface
All database adapters extend the baseMemoryDB class and implement these core methods:
Data Schema
Conversation history entries contain:Reference to the flow
Trigger keyword that initiated the flow
The user’s response or message content
Serialized flow reference for state management
Phone number or user identifier
Additional metadata and flow options
Switching Adapters
Switching between adapters is straightforward - just change the import and initialization:Next Steps
Quick Start
Set up your first bot with a database
Testing
Test your bot with different databases