Restart conversation through Tracker HTTP API

(Scott Tilney) #1

I would like to restart the state of a conversation whenever someone opens our mobile app (slots and dialog state). My plan was make a call to the tracker, to restart it whenever the app opens. POST /conversations/<sender_id>/tracker/events

{
   "event": "restart"
}

The problem with this approach is, it doesn’t put the bot in a listening state. So the first utterance from the user is ignored. It doesn’t register anything until the user utters/types the phrase a second time.

It looks like RASA’s Restarted() function does a reset, then a followup action ACTION_LISTEN

 def apply_to(self, tracker):
        from rasa_core.actions.action import ACTION_LISTEN_NAME
        tracker._reset()
        tracker.trigger_followup_action(ACTION_LISTEN_NAME)

Do I need to do something similar in order to get the same results when performing this action through the Tracker REST API?

I’m thinking of using the following payload: PUT /conversations/<sender_id>/tracker/events

[{
    "event": "restart"
},	
{
    "event": "followup",
    "name": "action_listen"
}
]

My main concern is RASA docs advise agains using PUT in production. Any reason that doing this is unsafe? Or is there a better way to restart the conversation through the Tracker API?

From the docs:

This endpoint should not be used to modify trackers in a production setup, but rather for creating training data.

0 Likes