I’m trying to implement hand off to human agent, but when i pause conversation. The event pause ALL the bot and not only the single conversation. Any ideas guys? What I need is that RASA acts as a “channel” between the messages of the human agent and the user, but that said conversation did not pause the rest of other users’ requests. make me understand?
Now, I have compiled the problems well so that we can work on this
We have 3problems:
First. For some reason the tracker.update function does not work and only using ConversationPause stops ALL the bot. We must solve that so that it only stops the conversation. It’s key.
Second. the sender_id when connected by channels of the rest api is reduced to “username” so it could not be tracked. Example using Telegram there is no problem, but if there is with WhatsApp Busines for example. This should be a minor problem.
Third. The bot despite being pausing, CONTINUES TO LISTEN and THEN RESPONSES when the action is over. Therefore, in the case of moving a human agent and ending the conversation, then he would respond incorrectly with all the entries.
Hello, I have made some changes to my code and now the first problem is solved. ConversationPause stop just de conversation. I think the third problem could be solved too (i have to create a ConversationResume in the code, i dont know if i must do in the same actions or not). However the second problem I could not solve it, the tracker id shows “username” when connected by rest api.
Thanks
class ActionTalkToHuman(Action):
def name(self):
return "action_talk_to_human"
def run(self, dispatcher, tracker, domain):
response = "Reaching out to a human agent [{}]...".format(tracker.sender_id)
dispatcher.utter_message(response)
ConversationPaused()
#message = ConversationPaused()['event']
message = "pause"
while message == "pause":
url = "https://80f8560f.ngrok.io/" #.format(tracker.sender_id)
req = requests.get(url)
#resp = json.loads(req.text)
if "error" in req:
raise Exception("Error fetching message: " +
repr(resp["error"]))
if message == "pause":
dispatcher.utter_message("Human agent: {}".format(req.text))
break
return [ConversationResumed()]
hi @Nicanor, it looks like in your while loop, it will break out of the loop after the first user request every time. What happens if you remove the break ? You could then add a condition to change the value of message when you actually want to break out of the loop (and hence return [ConversationResumed()])
OK, Well ConversationPause and Resumed are ok. I have to test the code but I think it works. In rasa x when it is pausing, the messages keep coming and listening, when the conversation is resumed rasa will respond late to the messages or not? because the idea is that rasa ignore it
Hi @Nicanor, Were you able to implement human handoff successfully. I am trying the same using WhatsApp channel. Any help is highly appreciated. Thanking in advance.
Hi, @akelad the while loop is running just once. I have removed the break statement a suggested in previous comment but still the while loop gets break. How can i solve this.