Hi everyone and @Sravan_S@Jason ,
I am using widget chat in a project. It is working fine.
Now the client want to show the timestamp along with the messages.
Is there any way to implement this or if someone has a code to implement this would be highly appreciated?
The timestamp is included in the message data that is returned for each message. You can pull the data out and display it in your widget. An example I use in React is:
@walter.rodriguez Thank you the solution. Appreciate your help.
I found that itβs working great with the message we send, but not working for message we receive.
Is there any solution for it?
Is there a difference in the way you display your sent messages vs your received messages? The previousMessageListQuery should return an array of messages that all have the same data associated with it.
@Tyler, Thank you for your response.
No, I am not doing anything different. What I found is somehow it was applying display: none; on the timestamp div.
I solve this issue by doing some customization in widget.js where we have a for loop for the list of messages. I am using some conditions to figure out if the message should show a time stamp or not by comparing previous and next messages. Passed new variable showTimeStamp in chatSection.createMessageItem using which I am showing the timestamp at certain conditions.
Like if there is a difference of minute in continuous messages then showing the timestamp and if the message sender and next message sender is different then showing timestamp and if next message is null that means itβs a last message then also showing the timestamp.
Added a rapper div and used custom css to show timestamp properly. Attached screenshot of it.