Send message attachments and save chat session

Hello Support team. We want to use the FlashPhoner API to send files. Also, we want to save the chat history, so when user go back to the chat box can read last conversation.
Does the sendMessage method supports file attachments?
What is the best way you recomment to save the chat history?

Thanks for your answer
 

Max

Administrator
Staff member
Atthachments are not currently supported out of the box.
Sure you can try to attach a file and encode it as a text, for example using Base64 then unpack this text on receiver side.
The best way to keep message history is to keep them on your Web server.
To do that you can use REST API hooks.
Please checkout logs/flashphoner_manager.log
URL:http://localhost:9091/EchoApp/sendMessage
Code:
OBJECT:
{
  "nodeId" : "Py2df9UPvS0wTxPYiP81MvaNE0dpcjIV@192.168.1.5",
  "appKey" : "defaultApp",
  "sessionId" : "/9.9.9.9:60376/192.168.1.5:8080",
  "id" : "c99ee3e0-c45a-42e5",
  "from" : "10007",
  "to" : "10001",
  "contentType" : "text/plain",
  "isImdnRequired" : false,
  "body" : "Hey"
}
Therefore you will need your REST application which receives this HTTP/REST request and saves message info in database.
So you will able to save message history. Then you can fetch this information from your database on user connection.
You can also try to keep the history in cookies, but I'm not sure if cookies allow to keep large amount of data.
Here is application management docs.
Here is messaging call flow.
 
Top