feat: MercadoLibre integration + inventory bulk publish + WhatsApp bridge fixes
- Add MercadoLibre OAuth, listings, orders, webhooks and category search - New marketplace_external_bp.py, meli_service.py, marketplace_external_service.py - New marketplace_external.html/js with ML management UI - Inventory: bulk publish to ML with category autocomplete, listing type and shipping selectors - Inventory: new .btn--meli styles, select/label CSS fixes - WhatsApp bridge: rate limiting, 440/515/408 error handling, stale watchdog - DB migration v3.4_meli_integration.sql for marketplace_listings, orders, sync_queue - Add Celery tasks for ML sync and webhook processing - Sidebar: MercadoLibre navigation link
This commit is contained in:
@@ -105,6 +105,7 @@ def process_incoming(webhook_data):
|
||||
# - For 'text' messages → conversation or extendedTextMessage
|
||||
# - For 'image'/'video' → the caption (may be empty)
|
||||
# - For 'audio' → empty (filled in later by Whisper transcription)
|
||||
# - For 'location' → synthetic text with coordinates
|
||||
if media_kind == 'text':
|
||||
text = (
|
||||
message.get('conversation', '')
|
||||
@@ -114,6 +115,10 @@ def process_incoming(webhook_data):
|
||||
else:
|
||||
text = media_caption
|
||||
|
||||
# Location fields (from bridge classification)
|
||||
latitude = data.get('latitude')
|
||||
longitude = data.get('longitude')
|
||||
|
||||
return {
|
||||
'phone': phone,
|
||||
'jid': remote_jid,
|
||||
@@ -125,4 +130,20 @@ def process_incoming(webhook_data):
|
||||
'media_mimetype': media_mimetype,
|
||||
'is_voice_note': is_voice_note,
|
||||
'push_name': push_name,
|
||||
'latitude': latitude,
|
||||
'longitude': longitude,
|
||||
}
|
||||
|
||||
|
||||
def send_image(phone, caption, base64_image, bridge_url=None):
|
||||
"""Send an image message via the Baileys bridge."""
|
||||
url = _get_url(bridge_url)
|
||||
try:
|
||||
return requests.post(
|
||||
f'{url}/send-image',
|
||||
headers=HEADERS,
|
||||
json={'phone': phone, 'caption': caption, 'base64': base64_image},
|
||||
timeout=15
|
||||
).json()
|
||||
except Exception as e:
|
||||
return {'error': str(e)}
|
||||
|
||||
Reference in New Issue
Block a user