feat(pos): WhatsApp Business API integration — send/receive messages, quotations

Add full WhatsApp Cloud API integration for Nexus POS:
- Service layer (whatsapp_service.py): send text, templates, quotations,
  order confirmations, stock alerts; process incoming webhooks with AI auto-reply
- Blueprint (whatsapp_bp.py): public webhook endpoints for Meta verification +
  incoming messages; authenticated endpoints for send, send-quote, conversations
- Conversation UI (whatsapp.html + whatsapp.js): split-panel messenger with
  conversation list, chat bubbles, send input, quote sending; both themes
- Migration v1.4: whatsapp_messages table with phone/direction/status indexes
- Config: WHATSAPP_TOKEN, WHATSAPP_PHONE_ID, WHATSAPP_VERIFY_TOKEN env vars
- Sidebar: WhatsApp nav item under Gestion with message-bubble icon
- Ready for Meta Business credentials (infrastructure complete, no API keys needed)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-04 02:42:17 +00:00
parent 840790a4d0
commit c645bc03f3
9 changed files with 1451 additions and 0 deletions

View File

@@ -45,6 +45,12 @@ def create_app():
from blueprints.chat_bp import chat_bp
app.register_blueprint(chat_bp)
from blueprints.fleet_bp import fleet_bp
app.register_blueprint(fleet_bp)
from blueprints.whatsapp_bp import whatsapp_bp
app.register_blueprint(whatsapp_bp)
# Health check
@app.route('/pos/health')
def health():
@@ -99,6 +105,14 @@ def create_app():
def pos_reports():
return render_template('reports.html')
@app.route('/pos/fleet')
def pos_fleet():
return render_template('fleet.html')
@app.route('/pos/whatsapp')
def pos_whatsapp():
return render_template('whatsapp.html')
@app.route('/pos/static/<path:filename>')
def pos_static(filename):
return send_from_directory('static', filename)