Temasys brings WebRTC to your application. So the chat messages that are sent are in real-time. We do not store any of the messages as the communication or user-related data, as we built the platform giving specific importance to user anonymity. If you would like to store history, you should be able to do so on your server and we certainly do not limit that possibility.


For instance, what you can do is every time you get the incomingMessage event which is triggered when a message is received from a Peer, you can capture these messages along with (for eg) an identifier (Eg: Customer/ Agent based on isSelf OR the Peerid depending on your needs) and a timestamp, create a new array and push these to the array.


Here's an example of a function capturing the messages:

function incomingMessage(message, peerId, peerInfo, isSelf) {
chatHistory.push([
isSelf?"customer":"agent",
new Date(),
message.content]);
console.log('received a message from', peerId);
}


If you want to save that, (as an example) you may wish to use the JavaScript function JSON.stringify() to convert it into a string and store that in your preferred location.



If you have any further questions regarding our platform and services, please feel free to reach out to our sales team at sales@temasys.io and we will get back to you as soon as possible