Add Timestamp field to enriched messages using conversation StartTime fallback

Messages from Make.com webhook have blank timestamp fields, preventing graph aggregation. This fix adds a Timestamp field during message enrichment using the parent conversation's StartTime as a fallback.

Logic:
- First checks if message has native Timestamp field from webhook
- If missing/blank, falls back to parent conversation's StartTime
- Ensures all messages have timestamps for proper date aggregation in VolumeGraph

This fixes the issue where messages mode shows blank graph despite 2473 messages being filtered successfully.

🤖 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:50:16 -06:00
parent 83451212da
commit 421961afc3

View file

@ -294,12 +294,17 @@ def get_all_data():
# Enrich message with parent conversation data
enriched_msg["User_ID"] = parent_conv.get("User_ID")
# CRITICAL: Ensure Assistant_ID is properly propagated
assistant_id = parent_conv.get("Assistant_ID")
enriched_msg["Assistant_ID"] = assistant_id
enriched_msg["Brand_Voice_Setting"] = parent_conv.get("Brand Voice Setting")
# Add timestamp to message - use message's native timestamp if available,
# otherwise fallback to parent conversation's StartTime
enriched_msg["Timestamp"] = msg.get("Timestamp") or parent_conv.get("StartTime")
enriched_messages.append(enriched_msg)
else:
messages_missing_parent += 1