Hello all, I hope you can help me with the following.
I have supergroup channels that are used as the main public channel of our application.
Our application has many instances, each has a list of users defined when the sendbird chat is created and assigned to the instance of our app. We also keep this list open, so more users can be added at any time after the initialisation.
When a user loads our application, the client side code initialises the Sendbird instance and connects to (joins) the assigned Sendbird channel as a member, and can start interacting with other members. They must be able to see all messages and not just the messages that were sent while they are actively on the site, so we enabled the Chat history toggle under Settings/Chat/Channels/Group channels.
Our users typically use the application for a couple of days’ interval. At the end of each day we would like to clear/reset the message list of this channel for the next day, so when they come back to the platform, they would see an empty channel.
The feature used:
Using the Reset Chat History endpoint ([Reset chat history | Chat Platform API | Sendbird Docs](https://Reset Chat history)) with reset_all works great for this purpose.
However, this will only update the messageOffsetTimestamp of the members that are joined members at the time of preforming this action. Users that are added to our user database (and therefore become members of the assigned Sendbird channel) will have their messageOffsetTimestamp set to 0, and will see all the historic messages, including the ones that are before the clear-chat action.
I believe this does not seem like an intentional feature, unless I am doing something wrong of course.
Has anyone faced this issue before? Have you come up with a solution? If this is indeed a bug, where should I file a bug report?
Thanks for your help and insights.
Welcome to sendbird community.
You can turn off the chat history for new a joinee on Sendbird dashboard.
thanks for your answer.
We switched this on deliberately, as we would like users to see the historic messages (so messages from earlier on the day) once after they joined.
The problem we face is when we clear/reset the chat history the members joining after this moment will see all historic messages. We would want them to see only messages after this point (when we trigger the reset chat action).
If we were to switch off the Chat History toggle, this would mean users would only see messages from after the moment they join, so they would not be able to read through earlier messages from that day.
I’ve got this same problem too, have been searching all through the Sendbird docs and community posts for a solution but haven’t found anything!! My situation is exactly as OP has described… I want a new user to see all historic messages when they join, that’s not the problem. The problem is this: when an admin sends a call to clear chat history before the new user joins, the messageOffsetTimestamp metadata for current users in the chat is reset to some timestamp. When a new user joins after the clear chat event though, their messageOffsetTimestamp is still the default and they can see all historic messages.
What I want (and what I think OP wants as well) is the behavior that when a new user joins the chat after a clear chat history event, their messageOffsetTimestamp should match current users’. So it seems to me it is a bug in the API??
After discussing with my team, I confirm the API behaviour is as expected. I can raise a feature request with our engineering team for your use case and update you when I hear back. Please be advised this could take some time.
Hi Pratham, thank you very much!! At the moment I’ve done a workaround where the current channel is archived and new channel is created when reset chat history is used, which is not ideal. I will look forward to updates, no problem