Hi,
I am trying to handoff the conversation to the human agent. I have implemented a custom action to hand off the conversation to human agent. The handoff request is going fine. After that I am returning ConversationPaused(), which is successfully pausing the conversation.
Now the issue is, after this any message the user is sending, is reaching NLU but not the action server at all, and since it does not reach action server, I am unable to route those to the human agents.
Below is the human handoff action -
class ActionHumanHandoff(Action):
def name(self) -> Text:
return "action_human_handoff"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
response = "Reaching out to a human agent."
dispatcher.utter_message(response)
logger.debug(tracker.is_paused())
try:
events = tracker.current_state()['events']
# logger.debug(events)
url = "http://<host>:<port>/handoff"
api_call_headers = {'Content-Type': 'application/json'}
req_data = {}
req_data['sender_id'] = tracker.sender_id
req_data['isPaused'] = tracker.is_paused()
req_data['channel'] = tracker.get_latest_input_channel()
req_data['latest_events'] = json.dumps(tracker.events_after_latest_restart())
req_data['intent'] = tracker.get_intent_of_latest_message()
req_data['latest_msg'] = json.dumps(tracker.latest_message)
request_data = json.dumps(req_data)
api_call_response = requests.post(url, headers=api_call_headers, verify=False, data=request_data)
resp_json = api_call_response.json()
except:
logger.debug(resp_json)
return [ConversationPaused()]
I am using rasa==2.8.12, rasa-sdk==2.8.2. The channels are - webexteams and rest.
Btw, I am successfully able to unpause the conversation later using Rasa & Rasa Pro Documentation, which I will still leverage once the agent or user decides to finish the conversation.
Thanks!