{"id":31632744,"url":"https://github.com/ultra2000/pdfbot","last_synced_at":"2026-05-18T06:09:23.908Z","repository":{"id":318029580,"uuid":"1050785457","full_name":"Ultra2000/pdfBot","owner":"Ultra2000","description":"Bot WhatsApp intelligent pour traiter et manipuler des fichiers PDF via une interface conversationnelle intuitive.","archived":false,"fork":false,"pushed_at":"2025-10-04T15:17:43.000Z","size":1806,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-04T17:27:19.943Z","etag":null,"topics":["bot","compression","ocr","ocr-recognition","pdf","security","traduction","whatsapp-bot"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ultra2000.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-05T00:02:04.000Z","updated_at":"2025-10-04T15:17:47.000Z","dependencies_parsed_at":"2025-10-08T22:48:35.704Z","dependency_job_id":null,"html_url":"https://github.com/Ultra2000/pdfBot","commit_stats":null,"previous_names":["ultra2000/pdfbot"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Ultra2000/pdfBot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ultra2000%2FpdfBot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ultra2000%2FpdfBot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ultra2000%2FpdfBot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ultra2000%2FpdfBot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ultra2000","download_url":"https://codeload.github.com/Ultra2000/pdfBot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ultra2000%2FpdfBot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33167431,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T05:43:36.989Z","status":"ssl_error","status_checked_at":"2026-05-18T05:43:19.133Z","response_time":71,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","compression","ocr","ocr-recognition","pdf","security","traduction","whatsapp-bot"],"created_at":"2025-10-06T23:03:57.835Z","updated_at":"2026-05-18T06:09:23.881Z","avatar_url":"https://github.com/Ultra2000.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🤖 WhatsApp PDF Bot\n\nBot WhatsApp intelligent pour traiter et manipuler des fichiers PDF via une interface conversationnelle intuitive.\n\n![Version](https://img.shields.io/badge/version-1.0.0-blue.svg)\n![Laravel](https://img.shields.io/badge/Laravel-12.0-red.svg)\n![Python](https://img.shields.io/badge/Python-FastAPI-green.svg)\n![License](https://img.shields.io/badge/license-MIT-green.svg)\n\n## 🎯 Fonctionnalités\n\n### 📄 Traitement PDF Avancé\n- **Compression** : Réduction de taille (modes WhatsApp/impression/équilibré)\n- **Conversion** : PDF ↔ Word/Excel, PDF → Images\n- **OCR** : Extraction de texte depuis PDF scannés\n- **Résumé** : Génération automatique de résumés (court/moyen/détaillé)\n- **Traduction** : Traduction multilingue du contenu\n- **Sécurisation** : Protection par mot de passe + watermarks\n\n### 💬 Interface WhatsApp\n- Menu interactif avec options numérotées (1-6)\n- Support des fichiers PDF jusqu'à 16MB\n- Réponses en temps réel avec statuts de progression\n- Compatible Twilio et Meta WhatsApp Cloud API\n\n### 🎛️ Administration\n- Dashboard Filament PHP complet\n- Monitoring des tâches et statistiques\n- Gestion des utilisateurs et permissions\n- Interface de surveillance Horizon (queues Redis)\n\n## 🏗️ Architecture\n\n```\n┌─────────────────┐    ┌──────────────────┐    ┌─────────────────┐\n│   WhatsApp API  │───▶│  Laravel Backend │───▶│ Python Service  │\n│ (Twilio/Meta)   │    │   + Filament     │    │   (FastAPI)     │\n└─────────────────┘    └──────────────────┘    └─────────────────┘\n                              │\n                              ▼\n                    ┌──────────────────┐\n                    │  Redis + Horizon │\n                    │     (Queues)     │\n                    └──────────────────┘\n                              │\n                              ▼\n                    ┌──────────────────┐\n                    │   S3/MinIO       │\n                    │  (Stockage)      │\n                    └──────────────────┘\n```\n\n### Composants\n- **Backend** : Laravel 12 + Filament PHP + TailwindCSS\n- **Microservice** : Python FastAPI pour traitement PDF\n- **Queues** : Redis + Laravel Horizon\n- **Stockage** : S3/MinIO avec URLs signées temporaires\n- **WhatsApp** : Support Twilio et Meta WhatsApp Cloud API\n\n## 🚀 Installation\n\n### Prérequis\n- PHP 8.2+\n- Composer\n- Node.js 18+\n- Python 3.8+\n- Redis\n- SQLite ou MySQL\n\n### 1. Backend Laravel\n\n```bash\n# Cloner et installer les dépendances\ngit clone \u003crepository-url\u003e\ncd pdf-bot\ncomposer install\nnpm install\n\n# Configuration\ncp .env.example .env\nphp artisan key:generate\nphp artisan storage:link\n\n# Base de données\nphp artisan migrate\nphp artisan db:seed --class=AdminSeeder\n\n# Assets\nnpm run build\n```\n\n### 2. Microservice Python\n\n```bash\n# Aller dans le dossier du microservice\ncd services/pdf_microservice\n\n# Créer environnement virtuel\npython -m venv venv\n\n# Activer l'environnement (Windows)\nvenv\\Scripts\\activate\n\n# Installer les dépendances\npip install -r requirements.txt\n```\n\n### 3. Services\n\n```bash\n# Terminal 1 - Laravel\nphp artisan serve --host=0.0.0.0 --port=8000\n\n# Terminal 2 - Python Microservice\ncd services/pdf_microservice\nvenv\\Scripts\\activate\npython main.py\n\n# Terminal 3 - Horizon (queues)\nphp artisan horizon\n\n# Terminal 4 - ngrok (webhook public)\nngrok http 8000\n```\n\n## ⚙️ Configuration\n\n### Variables d'environnement (.env)\n\n```bash\n# Application\nAPP_NAME=\"WhatsApp PDF Bot\"\nAPP_ENV=local\nAPP_DEBUG=true\nAPP_URL=https://your-ngrok-url.ngrok.app\n\n# Base de données\nDB_CONNECTION=sqlite\n# ou MySQL : DB_CONNECTION=mysql, DB_HOST, DB_PORT, etc.\n\n# Redis (Queues)\nREDIS_HOST=127.0.0.1\nREDIS_PASSWORD=null\nREDIS_PORT=6379\nQUEUE_CONNECTION=redis\n\n# Provider de messagerie (twilio ou meta)\nMESSAGING_PROVIDER=meta\n\n# Twilio WhatsApp (Legacy)\nTWILIO_SID=your_account_sid\nTWILIO_AUTH_TOKEN=your_auth_token\nTWILIO_WHATSAPP_NUMBER=whatsapp:+14155238886\n\n# Meta WhatsApp Cloud API (Recommandé)\nWHATSAPP_TOKEN=your_permanent_access_token\nWHATSAPP_PHONE_ID=your_phone_number_id\nWHATSAPP_VERIFY_TOKEN=your_custom_verify_token\nWHATSAPP_APP_SECRET=your_app_secret\nWHATSAPP_API_VERSION=v18.0\n\n# Microservice Python\nPDF_MICROSERVICE_URL=http://localhost:8001\nPDF_MICROSERVICE_TIMEOUT=60\nPDF_MICROSERVICE_ENABLED=true\n\n# Stockage S3/MinIO\nFILESYSTEM_DISK=s3\nAWS_ACCESS_KEY_ID=your_access_key\nAWS_SECRET_ACCESS_KEY=your_secret_key\nAWS_DEFAULT_REGION=us-east-1\nAWS_BUCKET=pdf-bot-storage\nAWS_USE_PATH_STYLE_ENDPOINT=false\n\n# MinIO local (optionnel)\n# AWS_ENDPOINT=http://localhost:9000\n# AWS_USE_PATH_STYLE_ENDPOINT=true\n```\n\n### Configuration WhatsApp\n\n#### Option 1 : Meta WhatsApp Cloud API (Recommandé)\n\n1. **Créer une app Meta** : https://developers.facebook.com/\n2. **Ajouter WhatsApp Business** product\n3. **Configurer webhook** :\n   - URL : `https://your-ngrok-url.ngrok.app/api/meta/webhook`\n   - Verify Token : votre `WHATSAPP_VERIFY_TOKEN`\n   - Fields : `messages`\n4. **Récupérer les tokens** : Access Token, Phone Number ID, App Secret\n\n#### Option 2 : Twilio (Sandbox)\n\n1. **Compte Twilio** : https://console.twilio.com/\n2. **WhatsApp Sandbox** : Try it out \u003e Send a WhatsApp message\n3. **Configurer webhook** : `https://your-ngrok-url.ngrok.app/api/webhook/whatsapp`\n\n## 📱 Utilisation\n\n### Interface Utilisateur\n\n1. **Rejoindre le bot** (si Twilio) :\n   ```\n   Envoyer \"join \u003cyour-sandbox-code\u003e\" au numéro Twilio\n   ```\n\n2. **Envoyer un PDF** :\n   - Joindre un fichier PDF via WhatsApp\n   - Le bot affiche automatiquement le menu\n\n3. **Menu interactif** :\n   ```\n   🤖 PDF reçu ! Choisissez votre action :\n   \n   1️⃣ Compresser le PDF\n   2️⃣ Convertir (PDF → Word/Image)\n   3️⃣ OCR (Extraire le texte)\n   4️⃣ Résumer le contenu\n   5️⃣ Traduire le texte\n   6️⃣ Sécuriser avec mot de passe\n   \n   💬 Tapez le numéro de votre choix (1-6)\n   ```\n\n4. **Recevoir le résultat** :\n   - Le bot traite le PDF via le microservice Python\n   - Vous recevez le fichier traité + confirmation\n\n### Dashboard Admin\n\n- **URL** : http://localhost:8000/admin\n- **Identifiants par défaut** :\n  - Email : `admin@pdf-bot.local`\n  - Mot de passe : `password`\n\n### Monitoring Horizon\n\n- **URL** : http://localhost:8000/horizon\n- Surveillance des queues Redis en temps réel\n- Statistiques de performance des jobs\n\n## 🔧 API\n\n### Endpoints Python Microservice\n\n```\nGET  /                     # Health check\nPOST /compress            # Compression PDF\nPOST /convert             # Conversion PDF\nPOST /ocr                 # OCR extraction\nPOST /summarize           # Résumé automatique  \nPOST /translate           # Traduction\nPOST /secure              # Sécurisation\n```\n\n### Documentation API\n- **Swagger** : http://localhost:8001/docs\n- **ReDoc** : http://localhost:8001/redoc\n\n## 🧪 Tests\n\n```bash\n# Tests Laravel\nphp artisan test\n\n# Tests du microservice Python\ncd services/pdf_microservice\npython -m pytest\n\n# Test webhook (simulation)\nphp artisan tinker\n\u003e\u003e\u003e app(\\App\\Services\\WhatsApp\\WhatsAppService::class)-\u003ehandleTextMessage('whatsapp:+1234567890', 'test')\n```\n\n## 📊 Monitoring\n\n### Logs\n```bash\n# Logs Laravel\ntail -f storage/logs/laravel.log\n\n# Logs Python\ntail -f services/pdf_microservice/app.log\n```\n\n### Métriques disponibles\n- Nombre de documents traités\n- Temps de traitement moyen\n- Taux d'échec des jobs\n- Utilisation des ressources\n\n## 🔒 Sécurité\n\n- ✅ Validation des webhooks (signature HMAC)\n- ✅ Limitation de débit (rate limiting)\n- ✅ Validation MIME et tailles de fichiers\n- ✅ URLs signées temporaires (1h)\n- ✅ Chiffrement des données sensibles\n- ✅ Nettoyage automatique des fichiers temporaires\n\n## 🐛 Résolution de problèmes\n\n### Problèmes courants\n\n**1. Webhook non accessible**\n```bash\n# Vérifier ngrok\ncurl -I https://your-ngrok-url.ngrok.app/api/meta/webhook\n\n# Vérifier les logs\nphp artisan log:show\n```\n\n**2. Microservice Python non accessible**\n```bash\n# Tester le microservice\ncurl http://localhost:8001/\n\n# Redémarrer si nécessaire\ncd services/pdf_microservice\nvenv\\Scripts\\activate\npython main.py\n```\n\n**3. Jobs bloqués**\n```bash\n# Relancer Horizon\nphp artisan horizon:terminate\nphp artisan horizon\n```\n\n**4. Limite Twilio atteinte**\n```bash\n# Passer à Meta ou attendre 24h\n# Voir MESSAGING_PROVIDER=meta dans .env\n```\n\n### Logs utiles\n```bash\n# Logs complets\nGet-Content storage/logs/laravel.log -Tail 50\n\n# Erreurs uniquement  \nGet-Content storage/logs/laravel.log | Select-String \"ERROR\"\n\n# Filtrer par job\nGet-Content storage/logs/laravel.log | Select-String \"CompressPdfJob\"\n```\n\n## 🚀 Déploiement\n\n### Docker Compose (En développement)\n\n```yaml\n# docker-compose.yml à venir\n# Services : app, nginx, redis, minio, pdf_service\n```\n\n### Production\n- Utiliser un vrai serveur S3 (pas MinIO local)\n- Configurer un domaine permanent (pas ngrok)\n- Activer la mise en cache Redis\n- Configurer les backups de base de données\n- Monitorer avec New Relic/Sentry\n\n## 🤝 Contribution\n\n1. Fork le projet\n2. Créer une branche feature (`git checkout -b feature/nouvelle-fonctionnalite`)\n3. Commit (`git commit -am 'Ajouter nouvelle fonctionnalite'`)\n4. Push (`git push origin feature/nouvelle-fonctionnalite`)\n5. Créer une Pull Request\n\n## 📄 Licence\n\nCe projet est sous licence MIT. Voir le fichier `LICENSE` pour plus de détails.\n\n## 🆘 Support\n\n- **Documentation** : Voir ce README\n- **Issues** : Créer un ticket GitHub\n\n---\n\n**Fait avec ❤️ par Fréjus BOURAIMA pour simplifier le traitement de PDF via WhatsApp**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fultra2000%2Fpdfbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fultra2000%2Fpdfbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fultra2000%2Fpdfbot/lists"}