microscopic-airport-67304
06/05/2025, 2:22 PMtall-airline-16756
06/05/2025, 2:22 PMtall-airline-16756
06/05/2025, 2:22 PMtimestamp property that records when a chat message was sent. Additionally, there is an optional editTimestamp property that records when a message was edited. These timestamps are part of the ChatMessage interface structure, which also includes other properties like message content and attached files.
Sources: ChatMessage | LiveKit JS Client SDK - v2.8.1microscopic-airport-67304
06/05/2025, 2:22 PMtall-airline-16756
06/05/2025, 2:23 PMsession.history. Each item in the history is a ChatMessage object, which includes properties like role, text_content, and interrupted. If you want to include timestamps for each message, you can access the timestamp property of each ChatMessage object. This will allow you to print the time when each message was sent.
For example, you can modify your loop to include:
for item in session.history.items:
if item.type == "message":
content = item.text_content.replace('\n', '\n')
text = f"{item.role}: {content} (Timestamp: {item.timestamp})"
if item.interrupted:
text += " (interrupted)"
print(text)
This will display the timestamp for each message in your chat history.
Sources: Events and error handling | LiveKit Docs | Workflows | LiveKit Docs | Session recording and transcripts | LiveKit Docsmicroscopic-airport-67304
06/05/2025, 2:24 PMtall-airline-16756
06/05/2025, 2:25 PMChatMessage object in your implementation does not have a timestamp attribute. This could be due to a version mismatch or a different implementation of the ChatMessage class in your environment.
To resolve this, please check the following:
• Ensure that you are using the latest version of the LiveKit SDK, as the timestamp attribute is expected to be part of the ChatMessage class.
• Verify the structure of the ChatMessage object in your environment by inspecting its attributes or referring to the documentation for your specific SDK version.
• If the timestamp attribute is not available, you may need to manually add timestamps when messages are created or use an alternative method to track message times.
If you continue to encounter issues, please let me know, and I can assist further.
Sources: livekit.rtc.chat API documentation | ChatMessage | LiveKit JS Client SDK - v2.8.1