LivePersonInc / node-agent-sdk

LivePerson Agent Messaging SDK for NodeJS
MIT License
49 stars 78 forks source link

ignore previous conversation lines when transferring to a bo #85

Open jasmith-lp opened 5 years ago

jasmith-lp commented 5 years ago

PR function: Example code to ignore previous conversation lines when transferring to a bot, 'unless' the previous agent has NOT read.

Why: Many developers are taking the MyCoolAgent.js as scripture in regards to bot behaviour.

Unfortunately life is not so simple. If we could replace the cognitive ability of the person sitting between a chair and the LiveEngage console in 144 lines then we would all be on universal income and living in the matrix.

This PR is an attempt to add some simple management of what is MVP in regards to the scenario where a bot is transferred an open conversation.

The bot may have originally been a part of the conversation and a human or another bot decided to transfer back, or this is the first time the bot has seen this particular conversation.

Either way things get messy, thus the approach in this PR attempts to simplify the matter to program the MyCoolAgent example to ONLY respond to a consumer message IF the last agent had NOT read any of the messages sent by the consumer.

It is by no means perfect and ideally brands implement some sort of mechanism VIA a cache etc to track read receipts etc (IE state management). But that would be far beyond the scope of this PR.