Add debug logging to inspect raw message structure from webhook

Added logging to output a sample raw message from Make.com webhook to verify if messages have native timestamp fields (Timestamp, Created_At, etc.). This will help identify the correct field name for message timestamps.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
michael 2025-11-18 14:42:33 -06:00
parent 908053def2
commit 83451212da

View file

@ -221,6 +221,17 @@ def get_all_data():
raw_messages = fetch_from_make("messages")
logger.debug(f"Fetched {len(raw_conversations)} conversations and {len(raw_messages)} messages")
# Debug sample message data logging to check for timestamp fields
if logger.level <= logging.DEBUG and raw_messages:
sample_msg = raw_messages[0].copy()
# Mask sensitive data for logging
if 'User_ID' in sample_msg:
sample_msg['User_ID'] = sample_msg['User_ID'][:5] + '...'
if 'Content' in sample_msg:
sample_msg['Content'] = sample_msg['Content'][:20] + '...' if len(sample_msg['Content']) > 20 else sample_msg['Content']
logger.debug(f"Sample raw message from webhook: {json.dumps(sample_msg, indent=2)}")
logger.debug(f"Raw message field names: {list(sample_msg.keys())}")
# Log Assistant_ID field presence in conversations
assistant_id_counts = {