A comprehensive AI-powered system that transforms WhatsApp conversations into organized, actionable workflows.
- Real-time Message Processing: Intelligent scanning of WhatsApp messages
- AI Task Extraction: Automatic identification of tasks, deadlines, and assignments
- Universal Integrations: Connect with 15+ platforms (Jira, Monday.com, Google Calendar, etc.)
- Smart Automation: Intelligent workflow automation and task routing
- Business Analytics: Comprehensive dashboards and productivity insights
- Multi-platform Support: Web, mobile, desktop, and browser extension
This project follows a microservices architecture with the following core services:
- Message Processor
- Task Extractor (AI/ML)
- Integration Hub
- Automation Engine
- Analytics Service
- User Management
- Notification Service
- Clone the repository
- Copy
.env.exampleto.envand configure - Run
npm install - Start development environment:
npm run dev - Access dashboard at
http://localhost:3000
services/- Microservices backendfrontend/- Web applications (dashboard, admin, landing)mobile/- Mobile applications (React Native, Flutter)desktop/- Desktop client (Electron)browser-extension/- Browser extensionai-pipeline/- AI/ML models and trainingintegrations/- Third-party service connectorsinfrastructure/- DevOps and deployment configsdocs/- Documentation
See individual service README files for detailed setup instructions.
MIT License - see LICENSE file for details.
The Ultimate AI-Powered WhatsApp Task Management Ecosystem
Transform conversational chaos into organized, actionable workflows. WhatsAppFlowHub serves as a universal bridge between informal WhatsApp communication and professional task management, powered by cutting-edge AI and seamless integrations.
- ๐ Overview
- โจ Key Features
- ๐๏ธ System Architecture
- ๐ ๏ธ Technology Stack
- ๐ Quick Start
- ๐ฆ Installation
- โ๏ธ Configuration
- ๐ฏ Usage
- ๐ API Documentation
- ๐ Integrations
- ๐ค AI & Machine Learning
- ๐ Analytics & Insights
- ๐ Security & Compliance
- ๐ข Enterprise Features
- ๐ฑ Multi-Platform Support
- ๐งช Testing
- ๐ข Deployment
- ๐ฅ Contributing
- ๐บ๏ธ Roadmap
- ๐ฐ Monetization
- ๐ Support
- ๐ License
WhatsAppFlowHub is an intelligent AI-powered ecosystem that revolutionizes how individuals and businesses manage tasks extracted from WhatsApp conversations. By combining advanced Natural Language Processing, seamless third-party integrations, and intelligent automation, it transforms informal messaging into structured, actionable workflows.
- Communication Overload: Important tasks get lost in endless WhatsApp conversations
- Context Switching: Constant switching between messaging and task management tools
- Missed Deadlines: Critical follow-ups and deadlines buried in chat history
- Team Inefficiency: Unclear task assignments and progress tracking
- No Centralized View: Scattered information across multiple communication channels
WhatsAppFlowHub provides:
- Intelligent Message Scanning: AI-powered extraction of tasks, deadlines, and assignments
- Universal Integration Hub: Connect with 15+ popular productivity platforms
- Smart Automation: Automated task creation, routing, and progress tracking
- Business Intelligence: Comprehensive analytics and productivity insights
- Multi-Platform Access: Web, mobile, desktop, and browser extension
- Natural Language Processing: Advanced AI models for task identification
- Multi-language Support: Process messages in 10+ languages
- Context Awareness: Maintain conversation threading and context
- Sentiment Analysis: Detect urgency and emotional context
- Smart Categorization: Automatic project and priority classification
- Task Management: Jira, Monday.com, Asana, Trello, ClickUp, Notion
- Calendars: Google Calendar, Outlook, Apple Calendar
- CRM Systems: Salesforce, HubSpot, Pipedrive, Zoho
- Communication: Slack, Microsoft Teams, Email systems
- Automation: Zapier, Make.com, Custom Webhooks
- Time Tracking: Toggl, RescueTime, Harvest
- Storage: Google Drive, Dropbox, OneDrive
- Auto Task Creation: Generate tasks with smart titles and descriptions
- Dynamic Assignment: Route tasks based on conversation patterns
- Deadline Management: Set realistic deadlines using historical data
- Progress Tracking: Monitor completion and send intelligent reminders
- Workflow Triggers: Conditional automation based on message content
- Real-time Dashboards: Visual task and productivity overviews
- Performance Analytics: Team and individual productivity metrics
- Communication Insights: Peak times, active contacts, task patterns
- Predictive Analytics: Workload forecasting and delay identification
- Custom Reports: Tailored insights for different business needs
- Web Dashboard: Comprehensive browser-based interface
- Mobile Apps: Native iOS and Android applications
- Desktop Client: Standalone Electron application
- Browser Extension: In-browser WhatsApp monitoring
- API Access: RESTful APIs for custom integrations
graph TB
WA[WhatsApp Business API] --> MP[Message Processor]
MP --> MQ[Message Queue]
MQ --> TE[Task Extractor]
MQ --> SA[Sentiment Analyzer]
TE --> IH[Integration Hub]
SA --> AE[Automation Engine]
IH --> DB[(Database)]
AE --> NS[Notification Service]
subgraph "Frontend Layer"
WD[Web Dashboard]
MA[Mobile Apps]
DC[Desktop Client]
BE[Browser Extension]
end
subgraph "AI/ML Pipeline"
NLP[NLP Models]
ML[ML Training]
MCP[MCP Protocol]
end
subgraph "Data Layer"
PG[(PostgreSQL)]
MG[(MongoDB)]
RD[(Redis)]
end
IH --> WD
IH --> MA
IH --> DC
IH --> BE
TE --> NLP
ML --> NLP
MCP --> NLP
-
Message Processor Service
- WhatsApp webhook handling
- Message validation and parsing
- Rate limiting and queue management
-
Task Extractor Service
- AI-powered task identification
- Entity recognition and classification
- Context maintenance and threading
-
Integration Hub Service
- Third-party API management
- OAuth flow handling
- Data synchronization
-
Automation Engine Service
- Rule processing and execution
- Workflow orchestration
- Intelligent task routing
-
Analytics Service
- Data aggregation and processing
- Report generation
- Predictive modeling
-
User Management Service
- Authentication and authorization
- Profile and preference management
- Billing and subscription handling
-
Notification Service
- Multi-channel notification delivery
- Template management
- Delivery tracking
- Runtime: Node.js 18+, Python 3.9+
- Frameworks: Express.js, FastAPI
- Databases: PostgreSQL 15, MongoDB 6.0, Redis 7
- Message Queue: RabbitMQ, Apache Kafka
- API Gateway: Kong, AWS API Gateway
- Containerization: Docker, Docker Compose
- Orchestration: Kubernetes
- NLP Libraries: spaCy, Transformers (Hugging Face)
- ML Frameworks: PyTorch, scikit-learn
- Language Models: Custom fine-tuned models, GPT integration
- Vector Database: Pinecone, Weaviate
- Model Serving: FastAPI, TensorFlow Serving
- Web: React 18, TypeScript, Material-UI
- Mobile: React Native, Flutter
- Desktop: Electron
- State Management: Redux Toolkit, Zustand
- Build Tools: Vite, Webpack
- Cloud Platforms: AWS, GCP, Azure
- IaC: Terraform, AWS CloudFormation
- CI/CD: GitHub Actions, GitLab CI
- Monitoring: Prometheus, Grafana, Datadog
- Logging: ELK Stack, Fluentd
- Security: Vault, AWS Secrets Manager
- Node.js 18+ and npm/yarn
- Python 3.9+
- Docker and Docker Compose
- Git
# Clone and setup the entire ecosystem
git clone https://github.com/vishalm/WhatsAppFlowHub.git
cd WhatsAppFlowHub
./scripts/quick-start.sh# Start all services with Docker Compose
docker-compose up -d
# Access the dashboard
open http://localhost:3000# 1. Clone repository
git clone https://github.com/vishalm/WhatsAppFlowHub.git
cd WhatsAppFlowHub
# 2. Install dependencies
npm install
# 3. Setup environment
cp .env.example .env
# Edit .env with your configuration
# 4. Start databases
docker-compose up -d postgres mongodb redis
# 5. Run migrations
npm run db:migrate
# 6. Start development servers
npm run devMinimum Requirements:
- CPU: 2 cores, 2.4 GHz
- RAM: 4GB
- Storage: 20GB SSD
- Network: Broadband internet connection
Recommended for Production:
- CPU: 8 cores, 3.0 GHz
- RAM: 16GB+
- Storage: 100GB+ SSD
- Network: High-speed internet with low latency
# Install Node.js dependencies
npm install
# Install Python dependencies
cd ai-pipeline
pip install -r requirements.txt
# Setup pre-commit hooks
npm run setup:hooks
# Start development environment
npm run dev:all# Build production images
docker-compose -f docker-compose.prod.yml build
# Deploy to production
./scripts/deployment/deploy.sh production-- Create database and user
CREATE DATABASE WhatsAppFlowHub;
CREATE USER WhatsAppFlowHub_user WITH PASSWORD 'secure_password';
GRANT ALL PRIVILEGES ON DATABASE WhatsAppFlowHub TO WhatsAppFlowHub_user;// Create MongoDB collections and indexes
use WhatsAppFlowHub;
db.createCollection("messages");
db.createCollection("conversations");
db.messages.createIndex({ "timestamp": 1, "user_id": 1 });# Configure Redis for caching and session management
CONFIG SET save "900 1 300 10 60 10000"
CONFIG SET maxmemory 2gb
CONFIG SET maxmemory-policy allkeys-lru
# Application Configuration
NODE_ENV=production
PORT=3000
API_VERSION=v1
LOG_LEVEL=info
# Database URLs
DATABASE_URL=postgresql://user:pass@localhost:5432/WhatsAppFlowHub
MONGODB_URL=mongodb://localhost:27017/WhatsAppFlowHub
REDIS_URL=redis://localhost:6379
# WhatsApp Business API
WHATSAPP_ACCESS_TOKEN=your_access_token
WHATSAPP_WEBHOOK_VERIFY_TOKEN=your_verify_token
WHATSAPP_BUSINESS_ACCOUNT_ID=your_account_id
WHATSAPP_PHONE_NUMBER_ID=your_phone_number_id
# AI/ML Configuration
OPENAI_API_KEY=your_openai_key
HUGGING_FACE_API_KEY=your_hf_key
MODEL_CACHE_DIR=/app/models
INFERENCE_BATCH_SIZE=32
# Integration APIs
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
SLACK_CLIENT_ID=your_slack_client_id
SLACK_CLIENT_SECRET=your_slack_client_secret
JIRA_API_KEY=your_jira_api_key
MONDAY_API_KEY=your_monday_api_key
# Security
JWT_SECRET=your_jwt_secret_key
ENCRYPTION_KEY=your_encryption_key
API_RATE_LIMIT=1000
CORS_ORIGINS=https://yourdomain.com
# Monitoring & Analytics
SENTRY_DSN=your_sentry_dsn
DATADOG_API_KEY=your_datadog_key
PROMETHEUS_PORT=9090
# Email Configuration
SMTP_HOST=smtp.your-provider.com
SMTP_PORT=587
SMTP_USER=your_email@domain.com
SMTP_PASS=your_email_password
# File Storage
AWS_ACCESS_KEY_ID=your_aws_access_key
AWS_SECRET_ACCESS_KEY=your_aws_secret_key
AWS_S3_BUCKET=your_s3_bucket
AWS_REGION=us-east-1{
"webhook": {
"port": 3001,
"path": "/webhook/whatsapp",
"verify_token": "${WHATSAPP_WEBHOOK_VERIFY_TOKEN}"
},
"processing": {
"batch_size": 100,
"max_retries": 3,
"timeout": 30000
},
"rate_limiting": {
"messages_per_minute": 1000,
"burst_limit": 100
}
}models:
task_extraction:
model_name: "distilbert-base-uncased"
max_length: 512
batch_size: 32
confidence_threshold: 0.7
sentiment_analysis:
model_name: "cardiffnlp/twitter-roberta-base-sentiment"
labels: ["negative", "neutral", "positive"]
entity_recognition:
model_name: "dbmdz/bert-large-cased-finetuned-conll03-english"
entities: ["PERSON", "DATE", "TIME", "ORG"]
training:
learning_rate: 2e-5
epochs: 3
warmup_steps: 500
eval_steps: 1000-
Account Setup
# Register new user curl -X POST http://localhost:3000/api/v1/auth/register \ -H "Content-Type: application/json" \ -d '{"email":"user@example.com","password":"secure123","name":"John Doe"}'
-
WhatsApp Integration
- Connect your WhatsApp Business account
- Configure webhook endpoints
- Set up message filtering rules
-
Third-party Integrations
- Connect preferred task management tools
- Configure calendar synchronization
- Set up notification preferences
-
Message Reception
- WhatsApp messages are automatically scanned
- AI extracts tasks, deadlines, and assignments
- Context is maintained across conversations
-
Task Management
- Review extracted tasks in the dashboard
- Edit, approve, or reject AI suggestions
- Assign tasks to team members or integrations
-
Automation
- Set up automation rules and workflows
- Configure smart routing and escalation
- Monitor task progress and completion
// POST /api/v1/messages/extract
const response = await fetch('/api/v1/messages/extract', {
method: 'POST',
headers: {
'Authorization': 'Bearer your_jwt_token',
'Content-Type': 'application/json'
},
body: JSON.stringify({
message: "Please review the Q4 report by Friday and send feedback to the team",
sender: "john@example.com",
context: "project_alpha"
})
});
const tasks = await response.json();
// Returns: [{ title: "Review Q4 report", deadline: "2024-01-26", assignee: "john@example.com" }]// POST /api/v1/integrations/webhooks
const webhook = await fetch('/api/v1/integrations/webhooks', {
method: 'POST',
headers: {
'Authorization': 'Bearer your_jwt_token',
'Content-Type': 'application/json'
},
body: JSON.stringify({
integration: "jira",
events: ["task.created", "task.updated"],
url: "https://your-domain.com/webhooks/jira",
secret: "webhook_secret"
})
});// GET /api/v1/analytics/productivity
const analytics = await fetch('/api/v1/analytics/productivity?period=30d', {
headers: {
'Authorization': 'Bearer your_jwt_token'
}
});
const data = await analytics.json();
// Returns productivity metrics, task completion rates, etc.POST /api/v1/auth/login
POST /api/v1/auth/register
POST /api/v1/auth/refresh
POST /api/v1/auth/logout
GET /api/v1/messages
POST /api/v1/messages/extract
GET /api/v1/messages/:id
PUT /api/v1/messages/:id
DELETE /api/v1/messages/:id
GET /api/v1/tasks
POST /api/v1/tasks
GET /api/v1/tasks/:id
PUT /api/v1/tasks/:id
DELETE /api/v1/tasks/:id
PATCH /api/v1/tasks/:id/status
GET /api/v1/integrations
POST /api/v1/integrations/connect
GET /api/v1/integrations/:type/status
POST /api/v1/integrations/:type/sync
DELETE /api/v1/integrations/:type/disconnect
GET /api/v1/analytics/dashboard
GET /api/v1/analytics/productivity
GET /api/v1/analytics/communications
GET /api/v1/analytics/tasks
GET /api/v1/analytics/team
{
"success": true,
"data": {
"id": "task_123",
"title": "Review documentation",
"status": "pending",
"created_at": "2024-01-15T10:00:00Z"
},
"meta": {
"timestamp": "2024-01-15T10:00:00Z",
"version": "1.0.0"
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid input parameters",
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
},
"meta": {
"timestamp": "2024-01-15T10:00:00Z",
"request_id": "req_abc123"
}
}{
"object": "whatsapp_business_account",
"entry": [{
"id": "phone_number_id",
"changes": [{
"value": {
"messaging_product": "whatsapp",
"messages": [{
"from": "1234567890",
"id": "wamid.xxx",
"text": {
"body": "Please schedule a meeting for tomorrow"
},
"timestamp": "1642185600",
"type": "text"
}]
}
}]
}]
}// Configuration
const jiraConfig = {
baseUrl: 'https://your-domain.atlassian.net',
email: 'your-email@domain.com',
apiToken: 'your_api_token',
projectKey: 'PROJ',
issueType: 'Task'
};
// Automatic task creation
const createJiraTicket = async (task) => {
return await jira.createIssue({
fields: {
project: { key: jiraConfig.projectKey },
summary: task.title,
description: task.description,
issuetype: { name: jiraConfig.issueType },
assignee: { accountId: task.assigneeId },
duedate: task.deadline
}
});
};// GraphQL mutation for task creation
const createMondayItem = async (task) => {
const mutation = `
mutation CreateItem($boardId: Int!, $itemName: String!, $columnValues: JSON!) {
create_item(
board_id: $boardId,
item_name: $itemName,
column_values: $columnValues
) {
id
name
}
}
`;
return await monday.execute(mutation, {
boardId: config.boardId,
itemName: task.title,
columnValues: JSON.stringify({
status: { label: 'Working on it' },
date4: { date: task.deadline },
person: { personsAndTeams: [{ id: task.assigneeId }] }
})
});
};// OAuth 2.0 setup and event creation
const createCalendarEvent = async (task) => {
const event = {
summary: task.title,
description: task.description,
start: {
dateTime: task.startTime,
timeZone: 'America/New_York'
},
end: {
dateTime: task.endTime,
timeZone: 'America/New_York'
},
attendees: task.attendees.map(email => ({ email })),
reminders: {
useDefault: false,
overrides: [
{ method: 'email', minutes: 24 * 60 },
{ method: 'popup', minutes: 10 }
]
}
};
return await calendar.events.insert({
calendarId: 'primary',
resource: event
});
};// Send notification to Slack channel
const sendSlackNotification = async (task, channel) => {
const blocks = [
{
type: 'section',
text: {
type: 'mrkdwn',
text: `*New Task Created:* ${task.title}`
}
},
{
type: 'section',
fields: [
{
type: 'mrkdwn',
text: `*Assignee:*\n${task.assignee}`
},
{
type: 'mrkdwn',
text: `*Due Date:*\n${task.deadline}`
}
]
},
{
type: 'actions',
elements: [
{
type: 'button',
text: { type: 'plain_text', text: 'View Task' },
url: `${process.env.DASHBOARD_URL}/tasks/${task.id}`
}
]
}
];
return await slack.chat.postMessage({
channel: channel,
blocks: blocks
});
};# Custom BERT model for task extraction
class TaskExtractor(nn.Module):
def __init__(self, model_name="distilbert-base-uncased", num_labels=2):
super().__init__()
self.bert = AutoModel.from_pretrained(model_name)
self.classifier = nn.Linear(self.bert.config.hidden_size, num_labels)
self.dropout = nn.Dropout(0.1)
def forward(self, input_ids, attention_mask):
outputs = self.bert(input_ids=input_ids, attention_mask=attention_mask)
pooled_output = outputs.pooler_output
output = self.dropout(pooled_output)
return self.classifier(output)
# Training pipeline
def train_task_extractor():
model = TaskExtractor()
optimizer = AdamW(model.parameters(), lr=2e-5)
for epoch in range(3):
for batch in train_dataloader:
optimizer.zero_grad()
outputs = model(**batch)
loss = criterion(outputs.logits, batch['labels'])
loss.backward()
optimizer.step()# Extract entities from messages
class EntityExtractor:
def __init__(self):
self.nlp = spacy.load("en_core_web_sm")
self.date_parser = dateparser
def extract_entities(self, text):
doc = self.nlp(text)
entities = {
'persons': [ent.text for ent in doc.ents if ent.label_ == "PERSON"],
'dates': self.extract_dates(text),
'organizations': [ent.text for ent in doc.ents if ent.label_ == "ORG"],
'times': [ent.text for ent in doc.ents if ent.label_ == "TIME"]
}
return entities
def extract_dates(self, text):
dates = []
date_matches = self.date_parser.search.search_dates(text)
if date_matches:
for date_string, date_obj in date_matches:
dates.append({
'text': date_string,
'parsed': date_obj.isoformat()
})
return dates# training/config/task_extraction.yaml
model:
name: "WhatsAppFlowHub-task-extractor"
base_model: "distilbert-base-uncased"
num_labels: 3 # task, non-task, urgent-task
training:
batch_size: 16
learning_rate: 2e-5
num_epochs: 3
warmup_steps: 500
weight_decay: 0.01
data:
train_path: "data/processed/train_tasks.jsonl"
val_path: "data/processed/val_tasks.jsonl"
max_length: 512
evaluation:
metrics: ["accuracy", "f1", "precision", "recall"]
eval_steps: 1000
save_steps: 2000# AI inference API
from fastapi import FastAPI, HTTPException
from transformers import pipeline
app = FastAPI()
# Load pre-trained models
task_classifier = pipeline(
"text-classification",
model="./models/task-extractor",
tokenizer="./models/task-extractor"
)
sentiment_analyzer = pipeline(
"sentiment-analysis",
model="cardiffnlp/twitter-roberta-base-sentiment"
)
@app.post("/predict/tasks")
async def extract_tasks(message: str):
try:
# Classify if message contains tasks
classification = task_classifier(message)
if classification[0]['label'] == 'TASK':
# Extract task details
entities = entity_extractor.extract_entities(message)
sentiment = sentiment_analyzer(message)
return {
"has_task": True,
"confidence": classification[0]['score'],
"entities": entities,
"sentiment": sentiment[0],
"extracted_task": {
"title": generate_task_title(message),
"description": message,
"priority": determine_priority(sentiment, entities),
"deadline": entities.get('dates', [None])[0]
}
}
else:
return {"has_task": False, "confidence": classification[0]['score']}
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))# MCP integration for context management
class MCPContextManager:
def __init__(self):
self.context_store = {}
self.conversation_history = defaultdict(list)
def update_context(self, user_id, message_id, context_data):
"""Update conversation context using MCP"""
if user_id not in self.context_store:
self.context_store[user_id] = {
'current_projects': [],
'active_tasks': [],
'communication_patterns': {},
'preferences': {}
}
# Update context with new information
self.context_store[user_id].update(context_data)
# Maintain conversation history
self.conversation_history[user_id].append({
'message_id': message_id,
'timestamp': datetime.now(),
'context_snapshot': self.context_store[user_id].copy()
})
def get_contextual_suggestions(self, user_id, current_message):
"""Get AI suggestions based on context"""
context = self.context_store.get(user_id, {})
history = self.conversation_history[user_id][-10:] # Last 10 messages
suggestions = {
'likely_assignees': self.predict_assignees(context, current_message),
'suggested_deadline': self.predict_deadline(context, current_message),
'project_classification': self.classify_project(context, current_message),
'priority_level': self.predict_priority(context, current_message)
}
return suggestions- Task Identification Accuracy: Percentage of correctly identified tasks
- Response Time: Average time from message to task creation
- Completion Rate: Percentage of tasks completed on time
- User Engagement: Active users and session duration
- Integration Reliability: Uptime and sync success rates
// Real-time analytics dashboard
const AnalyticsDashboard = () => {
const [metrics, setMetrics] = useState({});
useEffect(() => {
// WebSocket connection for real-time updates
const ws = new WebSocket('ws://localhost:3000/analytics/stream');
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
setMetrics(prevMetrics => ({
...prevMetrics,
[data.metric]: data.value
}));
};
return () => ws.close();
}, []);
return (
<div className="analytics-dashboard">
<MetricCard
title="Tasks Extracted Today"
value={metrics.tasksToday}
trend={metrics.tasksTrend}
/>
<MetricCard
title="Average Response Time"
value={`${metrics.avgResponseTime}ms`}
trend={metrics.responseTimeTrend}
/>
<LineChart
data={metrics.dailyTaskCreation}
title="Daily Task Creation"
/>
<PieChart
data={metrics.tasksByPriority}
title="Tasks by Priority"
/>
</div>
);
};# Workload prediction model
class WorkloadPredictor:
def __init__(self):
self.model = RandomForestRegressor(n_estimators=100)
def train(self, historical_data):
features = self.extract_features(historical_data)
targets = historical_data['task_count']
self.model.fit(features, targets)
def predict_workload(self, user_id, date_range):
"""Predict task workload for upcoming period"""
features = self.get_user_features(user_id, date_range)
prediction = self.model.predict(features.reshape(1, -1))
return {
'predicted_tasks': int(prediction[0]),
'confidence_interval': self.calculate_confidence_interval(prediction),
'recommendations': self.generate_recommendations(prediction[0])
}
def extract_features(self, data):
return np.array([
data['day_of_week'],
data['hour_of_day'],
data['recent_activity'],
data['team_size'],
data['project_complexity']
])// Custom report builder
const ReportBuilder = {
async generateProductivityReport(userId, dateRange, options) {
const data = await fetchAnalyticsData(userId, dateRange);
const report = {
summary: {
totalTasks: data.tasks.length,
completedTasks: data.tasks.filter(t => t.status === 'completed').length,
avgCompletionTime: calculateAvgCompletionTime(data.tasks),
productivityScore: calculateProductivityScore(data.tasks)
},
trends: {
dailyTaskCreation: groupTasksByDate(data.tasks),
priorityDistribution: groupTasksByPriority(data.tasks),
integrationUsage: analyzeIntegrationUsage(data.integrations)
},
insights: {
peakProductivityHours: findPeakHours(data.activities),
mostActiveContacts: rankContactsByActivity(data.messages),
recommendedOptimizations: generateOptimizationSuggestions(data)
}
};
return report;
},
async generateTeamReport(teamId, dateRange) {
const teamData = await fetchTeamAnalytics(teamId, dateRange);
return {
teamOverview: {
memberCount: teamData.members.length,
totalTasks: teamData.tasks.length,
collaborationScore: calculateCollaborationScore(teamData)
},
individualPerformance: teamData.members.map(member => ({
id: member.id,
name: member.name,
tasksCompleted: countCompletedTasks(member.id, teamData.tasks),
avgResponseTime: calculateAvgResponseTime(member.id, teamData.messages),
collaborationIndex: calculateCollaborationIndex(member.id, teamData)
})),
recommendations: generateTeamRecommendations(teamData)
};
}
};// JWT-based authentication with role-based access control
const authMiddleware = {
async authenticateToken(req, res, next) {
const authHeader = req.headers['authorization'];
const token = authHeader && authHeader.split(' ')[1];
if (!token) {
return res.sendStatus(401);
}
try {
const decoded = jwt.verify(token, process.env.JWT_SECRET);
const user = await User.findById(decoded.userId);
if (!user || !user.isActive) {
return res.sendStatus(403);
}
req.user = user;
next();
} catch (error) {
return res.sendStatus(403);
}
},
requireRole(roles) {
return (req, res, next) => {
if (!req.user || !roles.includes(req.user.role)) {
return res.status(403).json({
error: 'Insufficient permissions'
});
}
next();
};
}
};# End-to-end encryption for sensitive data
from cryptography.fernet import Fernet
import base64
class DataEncryption:
def __init__(self, key=None):
self.key = key or Fernet.generate_key()
self.cipher_suite = Fernet(self.key)
def encrypt_message(self, message):
"""Encrypt WhatsApp message content"""
encrypted_data = self.cipher_suite.encrypt(message.encode())
return base64.b64encode(encrypted_data).decode()
def decrypt_message(self, encrypted_message):
"""Decrypt WhatsApp message content"""
encrypted_data = base64.b64decode(encrypted_message.encode())
decrypted_data = self.cipher_suite.decrypt(encrypted_data)
return decrypted_data.decode()
def encrypt_user_data(self, user_data):
"""Encrypt sensitive user information"""
sensitive_fields = ['email', 'phone', 'api_keys']
encrypted_data = user_data.copy()
for field in sensitive_fields:
if field in encrypted_data:
encrypted_data[field] = self.encrypt_message(
str(encrypted_data[field])
)
return encrypted_data// GDPR consent management
const ConsentManager = {
async recordConsent(userId, consentTypes) {
const consent = {
userId,
consentTypes,
timestamp: new Date(),
ipAddress: req.ip,
userAgent: req.get('User-Agent')
};
await ConsentRecord.create(consent);
// Update user preferences
await User.findByIdAndUpdate(userId, {
'privacy.consents': consentTypes,
'privacy.lastUpdated': new Date()
});
},
async withdrawConsent(userId, consentType) {
const user = await User.findById(userId);
const updatedConsents = user.privacy.consents.filter(
c => c !== consentType
);
await User.findByIdAndUpdate(userId, {
'privacy.consents': updatedConsents,
'privacy.lastUpdated': new Date()
});
// Trigger data cleanup if necessary
if (consentType === 'data_processing') {
await this.initiateDataDeletion(userId);
}
},
async initiateDataDeletion(userId) {
// Mark user data for deletion
await DataDeletionRequest.create({
userId,
requestDate: new Date(),
status: 'pending',
scheduledDeletion: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000) // 30 days
});
// Immediate anonymization of sensitive data
await this.anonymizeUserData(userId);
}
};// Comprehensive audit logging
const AuditLogger = {
async logAction(userId, action, resource, details = {}) {
const logEntry = {
userId,
action,
resource,
details,
timestamp: new Date(),
ipAddress: details.ipAddress,
userAgent: details.userAgent,
sessionId: details.sessionId
};
await AuditLog.create(logEntry);
// Real-time security monitoring
if (this.isSecurityEvent(action)) {
await this.triggerSecurityAlert(logEntry);
}
},
isSecurityEvent(action) {
const securityEvents = [
'failed_login',
'privilege_escalation',
'data_export',
'integration_connected',
'api_key_generated'
];
return securityEvents.includes(action);
},
async triggerSecurityAlert(logEntry) {
// Send alert to security team
await NotificationService.sendSecurityAlert({
severity: this.calculateSeverity(logEntry.action),
user: logEntry.userId,
action: logEntry.action,
timestamp: logEntry.timestamp,
details: logEntry.details
});
}
};// Advanced rate limiting with Redis
const rateLimit = require('express-rate-limit');
const RedisStore = require('rate-limit-redis');
const createRateLimiter = (windowMs, max, message) => {
return rateLimit({
store: new RedisStore({
client: redis,
prefix: 'rl:'
}),
windowMs,
max,
message: { error: message },
standardHeaders: true,
legacyHeaders: false,
handler: (req, res) => {
AuditLogger.logAction(
req.user?.id,
'rate_limit_exceeded',
'api',
{ endpoint: req.path, ip: req.ip }
);
res.status(429).json({ error: message });
}
});
};
// Different rate limits for different endpoints
app.use('/api/v1/auth', createRateLimiter(15 * 60 * 1000, 5, 'Too many authentication attempts'));
app.use('/api/v1/messages', createRateLimiter(60 * 1000, 100, 'Too many message requests'));
app.use('/api/v1/', createRateLimiter(15 * 60 * 1000, 1000, 'Too many requests'));// Comprehensive input validation
const { body, param, query, validationResult } = require('express-validator');
const messageValidation = [
body('message')
.trim()
.isLength({ min: 1, max: 4000 })
.withMessage('Message must be between 1 and 4000 characters')
.escape(),
body('sender')
.isEmail()
.withMessage('Invalid sender email')
.normalizeEmail(),
body('context')
.optional()
.isAlphanumeric()
.withMessage('Context must be alphanumeric')
.isLength({ max: 100 })
.withMessage('Context must be less than 100 characters')
];
const handleValidationErrors = (req, res, next) => {
const errors = validationResult(req);
if (!errors.isEmpty()) {
return res.status(400).json({
success: false,
errors: errors.array()
});
}
next();
};// Tenant-aware database operations
class TenantService {
constructor() {
this.tenantCache = new Map();
}
async getTenantContext(tenantId) {
if (this.tenantCache.has(tenantId)) {
return this.tenantCache.get(tenantId);
}
const tenant = await Tenant.findById(tenantId);
if (!tenant) {
throw new Error('Tenant not found');
}
const context = {
id: tenant.id,
name: tenant.name,
settings: tenant.settings,
limits: tenant.subscriptionLimits,
dbConnection: await this.getTenantDatabase(tenant.id)
};
this.tenantCache.set(tenantId, context);
return context;
}
async getTenantDatabase(tenantId) {
// Separate database per tenant for data isolation
const connectionString = `${process.env.DATABASE_URL}_tenant_${tenantId}`;
return mongoose.createConnection(connectionString);
}
async executeWithTenantContext(tenantId, operation) {
const context = await this.getTenantContext(tenantId);
// Set tenant context for all database operations
return await operation(context);
}
}
// Middleware to inject tenant context
const tenantMiddleware = async (req, res, next) => {
const tenantId = req.headers['x-tenant-id'] || req.user?.tenantId;
if (!tenantId) {
return res.status(400).json({ error: 'Tenant ID required' });
}
try {
req.tenantContext = await tenantService.getTenantContext(tenantId);
next();
} catch (error) {
return res.status(404).json({ error: 'Tenant not found' });
}
};// Hierarchical role system
const RoleSystem = {
roles: {
'super_admin': {
permissions: ['*'], // All permissions
level: 100
},
'tenant_admin': {
permissions: [
'tenant:manage',
'users:create',
'users:update',
'users:delete',
'integrations:manage',
'settings:update'
],
level: 90
},
'team_lead': {
permissions: [
'team:manage',
'tasks:assign',
'reports:view',
'workflows:create'
],
level: 70
},
'user': {
permissions: [
'tasks:view',
'tasks:create',
'integrations:connect',
'profile:update'
],
level: 50
},
'viewer': {
permissions: [
'tasks:view',
'reports:view'
],
level: 30
}
},
hasPermission(userRole, requiredPermission) {
const role = this.roles[userRole];
if (!role) return false;
// Super admin has all permissions
if (role.permissions.includes('*')) return true;
// Check specific permission
if (role.permissions.includes(requiredPermission)) return true;
// Check wildcard permissions
const permissionParts = requiredPermission.split(':');
const wildcardPermission = `${permissionParts[0]}:*`;
return role.permissions.includes(wildcardPermission);
},
canAccessResource(userRole, resourceOwnerRole) {
const userLevel = this.roles[userRole]?.level || 0;
const resourceLevel = this.roles[resourceOwnerRole]?.level || 0;
return userLevel >= resourceLevel;
}
};// Enterprise-grade reporting system
class EnterpriseReporting {
async generateExecutiveDashboard(tenantId, timeframe) {
const data = await this.aggregateEnterpriseData(tenantId, timeframe);
return {
summary: {
totalUsers: data.userStats.total,
activeUsers: data.userStats.active,
tasksProcessed: data.taskStats.processed,
productivityGain: data.productivityMetrics.improvement,
costSavings: this.calculateCostSavings(data.productivityMetrics),
roi: this.calculateROI(data.usage, data.costSavings)
},
departmentBreakdown: await this.getDepartmentMetrics(tenantId, timeframe),
trends: {
userAdoption: data.adoptionTrends,
taskVolume: data.taskVolumeTrends,
integrationUsage: data.integrationTrends
},
benchmarks: {
industryComparison: await this.getIndustryBenchmarks(tenantId),
goalProgress: await this.getGoalProgress(tenantId)
},
recommendations: await this.generateExecutiveRecommendations(data)
};
}
async generateComplianceReport(tenantId, reportType) {
const complianceData = await this.getComplianceData(tenantId);
const reports = {
gdpr: () => this.generateGDPRReport(complianceData),
sox: () => this.generateSOXReport(complianceData),
hipaa: () => this.generateHIPAAReport(complianceData),
iso27001: () => this.generateISO27001Report(complianceData)
};
if (!reports[reportType]) {
throw new Error(`Unknown compliance report type: ${reportType}`);
}
return reports[reportType]();
}
}// Custom integration builder for enterprise clients
class CustomIntegrationBuilder {
async createCustomIntegration(config) {
const integration = {
id: generateId(),
name: config.name,
type: 'custom',
tenant: config.tenantId,
endpoints: this.validateEndpoints(config.endpoints),
authentication: this.setupAuthentication(config.auth),
dataMapping: this.createDataMapping(config.mapping),
webhooks: this.setupWebhooks(config.webhooks),
status: 'pending_approval'
};
// Deploy integration to sandbox first
await this.deploySandbox(integration);
return await CustomIntegration.create(integration);
}
async deployProduction(integrationId) {
const integration = await CustomIntegration.findById(integrationId);
// Run security audit
const auditResults = await this.runSecurityAudit(integration);
if (!auditResults.passed) {
throw new Error(`Security audit failed: ${auditResults.issues.join(', ')}`);
}
// Deploy to production
await this.deployToProduction(integration);
// Update status
integration.status = 'active';
integration.productionDeployedAt = new Date();
await integration.save();
return integration;
}
validateEndpoints(endpoints) {
return endpoints.map(endpoint => {
// Validate URL format
if (!this.isValidURL(endpoint.url)) {
throw new Error(`Invalid endpoint URL: ${endpoint.url}`);
}
// Validate HTTP methods
const allowedMethods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'];
if (!allowedMethods.includes(endpoint.method)) {
throw new Error(`Invalid HTTP method: ${endpoint.method}`);
}
return {
...endpoint,
rateLimit: endpoint.rateLimit || { requests: 100, window: '1m' },
timeout: endpoint.timeout || 30000,
retries: endpoint.retries || 3
};
});
}
}// Service Worker for offline functionality
self.addEventListener('install', (event) => {
event.waitUntil(
caches.open('WhatsAppFlowHub-v1').then((cache) => {
return cache.addAll([
'/',
'/dashboard',
'/tasks',
'/static/js/bundle.js',
'/static/css/main.css',
'/manifest.json'
]);
})
);
});
self.addEventListener('fetch', (event) => {
event.respondWith(
caches.match(event.request).then((response) => {
// Return cached version or fetch from network
return response || fetch(event.request);
})
);
});
// Push notification handling
self.addEventListener('push', (event) => {
const options = {
body: event.data.text(),
icon: '/icons/icon-192.png',
badge: '/icons/badge-72.png',
actions: [
{
action: 'view-task',
title: 'View Task'
},
{
action: 'dismiss',
title: 'Dismiss'
}
]
};
event.waitUntil(
self.registration.showNotification('WhatsAppFlowHub', options)
);
});// Main App Component with navigation
import { NavigationContainer } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
const Tab = createBottomTabNavigator();
const WhatsAppFlowHubApp = () => {
const [user, setUser] = useState(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
// Initialize app and check authentication
initializeApp();
}, []);
const initializeApp = async () => {
try {
// Check for stored authentication token
const token = await AsyncStorage.getItem('authToken');
if (token) {
const userData = await AuthService.validateToken(token);
setUser(userData);
}
} catch (error) {
console.error('App initialization error:', error);
} finally {
setLoading(false);
}
};
if (loading) {
return <LoadingScreen />;
}
return (
<NavigationContainer>
<Tab.Navigator>
<Tab.Screen
name="Dashboard"
component={DashboardScreen}
options={{
tabBarIcon: ({ color, size }) => (
<Icon name="dashboard" size={size} color={color} />
)
}}
/>
<Tab.Screen
name="Tasks"
component={TasksScreen}
options={{
tabBarIcon: ({ color, size }) => (
<Icon name="tasks" size={size} color={color} />
)
}}
/>
<Tab.Screen
name="Analytics"
component={AnalyticsScreen}
options={{
tabBarIcon: ({ color, size }) => (
<Icon name="chart-bar" size={size} color={color} />
)
}}
/>
<Tab.Screen
name="Settings"
component={SettingsScreen}
options={{
tabBarIcon: ({ color, size }) => (
<Icon name="settings" size={size} color={color} />
)
}}
/>
</Tab.Navigator>
</NavigationContainer>
);
};// Main Flutter app
class WhatsAppFlowHubApp extends StatefulWidget {
@override
_WhatsAppFlowHubAppState createState() => _WhatsAppFlowHubAppState();
}
class _WhatsAppFlowHubAppState extends State<WhatsAppFlowHubApp> {
int _currentIndex = 0;
final List<Widget> _screens = [
DashboardScreen(),
TasksScreen(),
AnalyticsScreen(),
SettingsScreen(),
];
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'WhatsAppFlowHub',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: Scaffold(
body: _screens[_currentIndex],
bottomNavigationBar: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
currentIndex: _currentIndex,
onTap: (index) {
setState(() {
_currentIndex = index;
});
},
items: [
BottomNavigationBarItem(
icon: Icon(Icons.dashboard),
label: 'Dashboard',
),
BottomNavigationBarItem(
icon: Icon(Icons.task_alt),
label: 'Tasks',
),
BottomNavigationBarItem(
icon: Icon(Icons.analytics),
label: 'Analytics',
),
BottomNavigationBarItem(
icon: Icon(Icons.settings),
label: 'Settings',
),
],
),
),
);
}
}// Electron main process
const { app, BrowserWindow, Menu, ipcMain, dialog } = require('electron');
const path = require('path');
class WhatsAppFlowHubDesktop {
constructor() {
this.mainWindow = null;
this.initializeApp();
}
initializeApp() {
app.whenReady().then(() => {
this.createMainWindow();
this.createMenu();
this.setupIpcHandlers();
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
this.createMainWindow();
}
});
}
createMainWindow() {
this.mainWindow = new BrowserWindow({
width: 1200,
height: 800,
minWidth: 800,
minHeight: 600,
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
preload: path.join(__dirname, 'preload.js')
},
titleBarStyle: 'hiddenInset',
show: false
});
// Load the app
if (process.env.NODE_ENV === 'development') {
this.mainWindow.loadURL('http://localhost:3000');
this.mainWindow.webContents.openDevTools();
} else {
this.mainWindow.loadFile(path.join(__dirname, '../build/index.html'));
}
// Show window when ready
this.mainWindow.once('ready-to-show', () => {
this.mainWindow.show();
});
}
createMenu() {
const template = [
{
label: 'File',
submenu: [
{
label: 'New Task',
accelerator: 'CmdOrCtrl+N',
click: () => {
this.mainWindow.webContents.send('menu-new-task');
}
},
{ type: 'separator' },
{
label: 'Export Data',
click: async () => {
const result = await dialog.showSaveDialog(this.mainWindow, {
filters: [{ name: 'JSON Files', extensions: ['json'] }]
});
if (!result.canceled) {
this.mainWindow.webContents.send('menu-export-data', result.filePath);
}
}
}
]
},
{
label: 'View',
submenu: [
{ role: 'reload' },
{ role: 'forceReload' },
{ role: 'toggleDevTools' },
{ type: 'separator' },
{ role: 'resetZoom' },
{ role: 'zoomIn' },
{ role: 'zoomOut' },
{ type: 'separator' },
{ role: 'togglefullscreen' }
]
}
];
const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
}
}
new WhatsAppFlowHubDesktop();{
"manifest_version": 3,
"name": "WhatsAppFlowHub Extension",
"version": "1.0.0",
"description": "Enhance WhatsApp Web with AI-powered task management",
"permissions": [
"activeTab",
"storage",
"notifications",
"background"
],
"host_permissions": [
"https://web.whatsapp.com/*",
"https://api.WhatsAppFlowHub.com/*"
],
"background": {
"service_worker": "background.js"
},
"content_scripts": [
{
"matches": ["https://web.whatsapp.com/*"],
"js": ["content.js"],
"css": ["styles.css"],
"run_at": "document_end"
}
],
"action": {
"default_popup": "popup.html",
"default_title": "WhatsAppFlowHub"
},
"icons": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
}
}// Content script to enhance WhatsApp Web
class WhatsAppEnhancer {
constructor() {
this.messageObserver = null;
this.taskExtractor = new TaskExtractor();
this.init();
}
init() {
// Wait for WhatsApp to load
this.waitForWhatsApp().then(() => {
this.setupMessageObserver();
this.addTaskButtons();
this.setupEventListeners();
});
}
async waitForWhatsApp() {
return new Promise((resolve) => {
const checkWhatsApp = () => {
const chatList = document.querySelector('[data-testid="chat-list"]');
if (chatList) {
resolve();
} else {
setTimeout(checkWhatsApp, 500);
}
};
checkWhatsApp();
});
}
setupMessageObserver() {
const messageContainer = document.querySelector('#main');
if (messageContainer) {
this.messageObserver = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
mutation.addedNodes.forEach((node) => {
if (node.nodeType === Node.ELEMENT_NODE &&
node.querySelector('[data-testid="msg-container"]')) {
this.analyzeNewMessage(node);
}
});
});
});
this.messageObserver.observe(messageContainer, {
childList: true,
subtree: true
});
}
}
async analyzeNewMessage(messageElement) {
const messageText = this.extractMessageText(messageElement);
if (messageText && messageText.length > 10) {
const analysis = await this.taskExtractor.analyzeMessage(messageText);
if (analysis.hasTask) {
this.highlightTaskMessage(messageElement, analysis);
this.showTaskSuggestion(messageElement, analysis);
}
}
}
highlightTaskMessage(element, analysis) {
element.style.borderLeft = '3px solid #007bff';
element.style.backgroundColor = '#f8f9fa';
// Add task indicator
const indicator = document.createElement('div');
indicator.className = 'WhatsAppFlowHub-task-indicator';
indicator.textContent = '๐ Task detected';
indicator.style.cssText = `
font-size: 12px;
color: #007bff;
margin-top: 5px;
padding: 2px 6px;
background: #e3f2fd;
border-radius: 12px;
display: inline-block;
`;
element.appendChild(indicator);
}
showTaskSuggestion(element, analysis) {
// Create floating action button for task creation
const fab = document.createElement('button');
fab.className = 'WhatsAppFlowHub-fab';
fab.innerHTML = '+ Add Task';
fab.style.cssText = `
position: absolute;
right: 10px;
top: 10px;
background: #007bff;
color: white;
border: none;
border-radius: 20px;
padding: 6px 12px;
font-size: 12px;
cursor: pointer;
z-index: 1000;
`;
fab.onclick = () => {
this.openTaskCreationModal(analysis);
};
element.style.position = 'relative';
element.appendChild(fab);
}
}
// Initialize the enhancer
new WhatsAppEnhancer();// Jest unit tests for task extraction
describe('TaskExtractor', () => {
let taskExtractor;
beforeEach(() => {
taskExtractor = new TaskExtractor();
});
describe('extractTasks', () => {
it('should identify tasks with deadlines', () => {
const message = "Please review the document by Friday";
const result = taskExtractor.extractTasks(message);
expect(result.hasTasks).toBe(true);
expect(result.tasks).toHaveLength(1);
expect(result.tasks[0].title).toBe('Review the document');
expect(result.tasks[0].deadline).toMatch(/friday/i);
});
it('should identify task assignments', () => {
const message = "John, can you handle the client presentation?";
const result = taskExtractor.extractTasks(message);
expect(result.hasTasks).toBe(true);
expect(result.tasks[0].assignee).toBe('John');
expect(result.tasks[0].title).toBe('Handle the client presentation');
});
it('should handle multiple tasks in one message', () => {
const message = "Please send the report to Sarah and schedule a meeting with the team for next week";
const result = taskExtractor.extractTasks(message);
expect(result.hasTasks).toBe(true);
expect(result.tasks).toHaveLength(2);
});
});
});# Integration tests for AI pipeline
import pytest
from unittest.mock import Mock, patch
from ai_pipeline.task_extractor import TaskExtractor
from ai_pipeline.models.task_classifier import TaskClassifier
class TestTaskExtractionIntegration:
def setup_method(self):
self.task_extractor = TaskExtractor()
self.task_classifier = TaskClassifier()
@pytest.mark.asyncio
async def test_full_task_extraction_pipeline(self):
"""Test complete task extraction workflow"""
message = "Please review the Q4 budget proposal and send feedback to finance@company.com by December 15th"
# Test classification
classification = await self.task_classifier.classify(message)
assert classification['label'] == 'TASK'
assert classification['confidence'] > 0.8
# Test extraction
extraction_result = await self.task_extractor.extract_tasks(message)
assert len(extraction_result['tasks']) == 1
task = extraction_result['tasks'][0]
assert 'review' in task['title'].lower()
assert 'q4 budget proposal' in task['description'].lower()
assert task['deadline'] == '2023-12-15'
assert 'finance@company.com' in task['stakeholders']
@pytest.mark.asyncio
async def test_multilingual_task_extraction(self):
"""Test task extraction in multiple languages"""
test_cases = [
{
'message': "Por favor, envรญa el informe antes del viernes",
'language': 'es',
'expected_task': 'envรญa el informe'
},
{
'message': "Veuillez terminer le rapport avant jeudi",
'language': 'fr',
'expected_task': 'terminer le rapport'
}
]
for case in test_cases:
result = await self.task_extractor.extract_tasks(case['message'])
assert len(result['tasks']) >= 1
assert case['expected_task'] in result['tasks'][0]['title'].lower()// Playwright E2E tests
const { test, expect } = require('@playwright/test');
test.describe('WhatsAppFlowHub Dashboard', () => {
test.beforeEach(async ({ page }) => {
// Login before each test
await page.goto('/login');
await page.fill('[data-testid="email"]', 'test@example.com');
await page.fill('[data-testid="password"]', 'password123');
await page.click('[data-testid="login-button"]');
await page.waitForURL('/dashboard');
});
test('should display task dashboard', async ({ page }) => {
// Verify dashboard elements
await expect(page.locator('h1')).toContainText('Dashboard');
await expect(page.locator('[data-testid="task-count"]')).toBeVisible();
await expect(page.locator('[data-testid="productivity-chart"]')).toBeVisible();
});
test('should create task from WhatsApp message', async ({ page }) => {
// Navigate to messages
await page.click('[data-testid="nav-messages"]');
// Simulate new WhatsApp message
await page.evaluate(() => {
window.dispatchEvent(new CustomEvent('whatsapp-message', {
detail: {
message: 'Please review the project proposal by tomorrow',
sender: '+1234567890',
timestamp: Date.now()
}
}));
});
// Verify task suggestion appears
await expect(page.locator('[data-testid="task-suggestion"]')).toBeVisible();
// Accept task suggestion
await page.click('[data-testid="accept-task"]');
// Verify task is created
await page.goto('/tasks');
await expect(page.locator('[data-testid="task-list"]')).toContainText('Review the project proposal');
});
test('should sync with external integrations', async ({ page }) => {
// Mock external API responses
await page.route('**/api/integrations/jira/sync', (route) => {
route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({ success: true, synced: 5 })
});
});
// Navigate to integrations
await page.click('[data-testid="nav-integrations"]');
// Trigger sync
await page.click('[data-testid="jira-sync-button"]');
// Verify sync completion
await expect(page.locator('[data-testid="sync-status"]')).toContainText('Synced successfully');
});
});# performance-tests/load-test.yml
config:
target: 'http://localhost:3000'
phases:
- duration: 60
arrivalRate: 5
name: "Warm up"
- duration: 120
arrivalRate: 20
name: "Normal load"
- duration: 60
arrivalRate: 50
name: "Peak load"
scenarios:
- name: "API endpoints"
weight: 70
flow:
- post:
url: "/api/v1/auth/login"
json:
email: "test@example.com"
password: "password123"
capture:
- json: "$.token"
as: "authToken"
- get:
url: "/api/v1/tasks"
headers:
Authorization: "Bearer {{ authToken }}"
- post:
url: "/api/v1/messages/extract"
headers:
Authorization: "Bearer {{ authToken }}"
json:
message: "Please complete the task by tomorrow"
sender: "user@test.com"
- name: "WebSocket connections"
weight: 30
engine: ws
flow:
- connect:
url: "ws://localhost:3000/ws"
- send:
payload: '{"type": "subscribe", "channel": "tasks"}'# docker-compose.prod.yml
version: '3.8'
services:
# Load Balancer
nginx:
image: nginx:alpine
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./ssl:/etc/nginx/ssl
depends_on:
- api-gateway
networks:
- WhatsAppFlowHub-network
# API Gateway
api-gateway:
image: WhatsAppFlowHub/api-gateway:${VERSION}
ports:
- "3000:3000"
environment:
- NODE_ENV=production
- RATE_LIMIT=true
depends_on:
- message-processor
- task-extractor
networks:
- WhatsAppFlowHub-network
deploy:
replicas: 3
update_config:
parallelism: 1
delay: 10s
restart_policy:
condition: on-failure
# Core Services
message-processor:
image: WhatsAppFlowHub/message-processor:${VERSION}
environment:
- DATABASE_URL=${DATABASE_URL}
- REDIS_URL=${REDIS_URL}
networks:
- WhatsAppFlowHub-network
deploy:
replicas: 2
task-extractor:
image: WhatsAppFlowHub/task-extractor:${VERSION}
environment:
- MODEL_PATH=/models
- BATCH_SIZE=32
volumes:
- ai-models:/models
networks:
- WhatsAppFlowHub-network
deploy:
replicas: 2
# Databases
postgres:
image: postgres:15-alpine
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- WhatsAppFlowHub-network
mongodb:
image: mongo:6.0-jammy
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_USER}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASSWORD}
volumes:
- mongodb-data:/data/db
networks:
- WhatsAppFlowHub-network
redis:
image: redis:7-alpine
command: redis-server --requirepass ${REDIS_PASSWORD}
volumes:
- redis-data:/data
networks:
- WhatsAppFlowHub-network
volumes:
postgres-data:
mongodb-data:
redis-data:
ai-models:
networks:
WhatsAppFlowHub-network:
driver: overlay
attachable: true# k8s/namespace.yaml
apiVersion: v1
kind: Namespace
metadata:
name: WhatsAppFlowHub
---
# k8s/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: WhatsAppFlowHub-config
namespace: WhatsAppFlowHub
data:
NODE_ENV: "production"
LOG_LEVEL: "info"
API_VERSION: "v1"
---
# k8s/secret.yaml
apiVersion: v1
kind: Secret
metadata:
name: WhatsAppFlowHub-secrets
namespace: WhatsAppFlowHub
type: Opaque
stringData:
database-url: "postgresql://user:pass@postgres:5432/WhatsAppFlowHub"
jwt-secret: "your-super-secret-jwt-key"
whatsapp-token: "your-whatsapp-business-token"
---
# k8s/deployment-api.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: WhatsAppFlowHub-api
namespace: WhatsAppFlowHub
spec:
replicas: 3
selector:
matchLabels:
app: WhatsAppFlowHub-api
template:
metadata:
labels:
app: WhatsAppFlowHub-api
spec:
containers:
- name: api
image: WhatsAppFlowHub/api:latest
ports:
- containerPort: 3000
env:
- name: NODE_ENV
valueFrom:
configMapKeyRef:
name: WhatsAppFlowHub-config
key: NODE_ENV
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: WhatsAppFlowHub-secrets
key: database-url
resources:
requests:
memory: "256Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "500m"
livenessProbe:
httpGet:
path: /health
port: 3000
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /ready
port: 3000
initialDelaySeconds: 5
periodSeconds: 5
---
# k8s/service-api.yaml
apiVersion: v1
kind: Service
metadata:
name: WhatsAppFlowHub-api-service
namespace: WhatsAppFlowHub
spec:
selector:
app: WhatsAppFlowHub-api
ports:
- protocol: TCP
port: 80
targetPort: 3000
type: ClusterIP
---
# k8s/ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: WhatsAppFlowHub-ingress
namespace: WhatsAppFlowHub
annotations:
kubernetes.io/ingress.class: nginx
cert-manager.io/cluster-issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/rate-limit: "100"
spec:
tls:
- hosts:
- api.WhatsAppFlowHub.com
secretName: WhatsAppFlowHub-tls
rules:
- host: api.WhatsAppFlowHub.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: WhatsAppFlowHub-api-service
port:
number: 80# infrastructure/aws/main.tf
resource "aws_ecs_cluster" "WhatsAppFlowHub" {
name = "WhatsAppFlowHub-cluster"
setting {
name = "containerInsights"
value = "enabled"
}
}
resource "aws_ecs_service" "api" {
name = "WhatsAppFlowHub-api"
cluster = aws_ecs_cluster.WhatsAppFlowHub.id
task_definition = aws_ecs_task_definition.api.arn
desired_count = 3
network_configuration {
security_groups = [aws_security_group.ecs_tasks.id]
subnets = aws_subnet.private.*.id
}
load_balancer {
target_group_arn = aws_lb_target_group.api.arn
container_name = "WhatsAppFlowHub-api"
container_port = 3000
}
depends_on = [aws_lb_listener.api]
}
resource "aws_ecs_task_definition" "api" {
family = "WhatsAppFlowHub-api"
network_mode = "awsvpc"
requires_compatibilities = ["FARGATE"]
cpu = 1024
memory = 2048
execution_role_arn = aws_iam_role.ecs_execution_role.arn
task_role_arn = aws_iam_role.ecs_task_role.arn
container_definitions = jsonencode([
{
name = "WhatsAppFlowHub-api"
image = "WhatsAppFlowHub/api:latest"
essential = true
portMappings = [
{
containerPort = 3000
}
]
environment = [
{
name = "NODE_ENV"
value = "production"
}
]
secrets = [
{
name = "DATABASE_URL"
valueFrom = aws_ssm_parameter.database_url.arn
}
]
logConfiguration = {
logDriver = "awslogs"
options = {
awslogs-group = aws_cloudwatch_log_group.api.name
awslogs-region = var.aws_region
awslogs-stream-prefix = "ecs"
}
}
healthCheck = {
command = ["CMD-SHELL", "curl -f http://localhost:3000/health || exit 1"]
interval = 30
timeout = 5
retries = 3
startPeriod = 60
}
}
])
}# .github/workflows/deploy.yml
name: Deploy WhatsAppFlowHub
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run unit tests
run: npm run test
- name: Run integration tests
run: npm run test:integration
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/test
- name: Run E2E tests
run: npm run test:e2e
- name: Upload coverage reports
uses: codecov/codecov-action@v3
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker images
run: |
docker build -t WhatsAppFlowHub/api:${{ github.sha }} ./services/api
docker build -t WhatsAppFlowHub/message-processor:${{ github.sha }} ./services/message-processor
docker build -t WhatsAppFlowHub/task-extractor:${{ github.sha }} ./services/task-extractor
docker push WhatsAppFlowHub/api:${{ github.sha }}
docker push WhatsAppFlowHub/message-processor:${{ github.sha }}
docker push WhatsAppFlowHub/task-extractor:${{ github.sha }}
deploy-staging:
needs: build
runs-on: ubuntu-latest
environment: staging
steps:
- name: Deploy to staging
run: |
echo "Deploying to staging environment"
# Deployment commands here
- name: Run smoke tests
run: |
echo "Running smoke tests"
# Smoke test commands here
deploy-production:
needs: [build, deploy-staging]
runs-on: ubuntu-latest
environment: production
if: github.ref == 'refs/heads/main'
steps:
- name: Deploy to production
run: |
echo "Deploying to production environment"
# Production deployment commands here
- name: Notify team
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
text: "WhatsAppFlowHub deployment completed successfully!"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}We welcome contributions from the community! Please read our contributing guidelines before submitting pull requests.
# Fork the repository
git clone https://github.com/your-username/WhatsAppFlowHub.git
cd WhatsAppFlowHub
# Install dependencies
npm install
# Setup development environment
cp .env.example .env
# Edit .env with your configuration
# Start development servers
npm run dev
# Run tests
npm run test- Use ESLint and Prettier for JavaScript/TypeScript
- Follow PEP 8 for Python code
- Use conventional commits for commit messages
- Write tests for all new features
- Create a feature branch from
develop - Make your changes with appropriate tests
- Update documentation if needed
- Submit a pull request with detailed description
- Ensure all CI checks pass
- Request review from maintainers
We are committed to providing a welcoming and inclusive experience for all contributors. Please read our Code of Conduct for details.
- โ Basic WhatsApp message scanning
- โ AI-powered task extraction
- โ Core integrations (Jira, Google Calendar, Slack)
- โ Web dashboard
- โ Basic analytics
- ๐ฑ Mobile applications (iOS/Android)
- ๐ค Advanced AI with GPT-4 integration
- ๐ 10+ additional integrations
- ๐ Enhanced analytics and reporting
- ๐ Multi-language support (5 languages)
- ๐ป Desktop application (Electron)
- ๐ Browser extension
- ๐ค Custom AI model training
- ๐ข Enterprise features (SSO, advanced security)
- ๐ Predictive analytics
- ๐ Advanced automation workflows
- ๐ค Voice message processing
- ๐ธ Image and document analysis
- ๐ค Team collaboration features
- ๐ Marketplace for custom integrations
- ๐ Global deployment options
- ๐ฏ Industry-specific solutions
- ๐ง Advanced AI agents for autonomous task management
- ๐ Multi-platform communication hub
- ๐ค Fully autonomous workflow orchestration
- ๐ AR/VR integration for immersive productivity
- ๐ฎ Predictive task creation and smart recommendations
- Up to 100 messages/month
- Basic task extraction
- 3 integrations
- Web dashboard access
- Community support
- Up to 1,000 messages/month
- Advanced AI features
- 10 integrations
- Mobile app access
- Email support
- Basic analytics
- Up to 10,000 messages/month
- Unlimited integrations
- Team collaboration features
- Advanced analytics
- Priority support
- Custom workflows
- Unlimited messages
- Custom integrations
- Advanced security features
- Dedicated support
- SLA guarantees
- On-premise deployment options
- Subscription Revenue: Primary revenue from tiered subscriptions
- Integration Marketplace: Commission from third-party integrations
- Professional Services: Custom implementation and consulting
- Enterprise Licensing: Large-scale enterprise deployments
- API Usage: Pay-per-use API access for developers
- White-label Solutions: Licensed technology for partners
- Documentation: docs.WhatsAppFlowHub.com
- Community Forum: community.WhatsAppFlowHub.com
- Email Support: support@WhatsAppFlowHub.com
- Enterprise Support: enterprise@WhatsAppFlowHub.com
Please report bugs using our GitHub Issues with:
- Detailed description of the issue
- Steps to reproduce
- Expected vs actual behavior
- Environment details (browser, OS, version)
- Screenshots if applicable
Submit feature requests through:
- GitHub Issues with the "enhancement" label
- Community forum feature request section
- Direct feedback through the application
For security-related issues, please email: security@WhatsAppFlowHub.com
This project is licensed under the MIT License - see the LICENSE file for details.
This project uses several open-source libraries and frameworks. See THIRD-PARTY-LICENSES.md for details.
WhatsAppFlowHub - Transforming Conversations into Productivity
Website โข Documentation โข Community โข Twitter
Made with โค๏ธ by the WhatsAppFlowHub Team