Good day.
I must sent answer to the chat to hi message. This is how I do this:
function messengerReady() {
FxoMessenger.on(‘messageReceived’, function (message) {
if (message.text == 'Hi') {
FxoMessenger.sendMessage('Hi! Ask your question please');
}
});
}
It works fine the first time.
But if:
- The user makes refresh.
- Opens the chat again.
- The chat shows all history including “Hi” and “Hi! Ask your question please”
- So, I catch messageReceived event with word Hi again and send “Hi! Ask your question please” the second time.
Is there way to detect that the second “Hi” is just a history? I need to send the message one time per session only.
Thank you in advance,
Serge