@stephens I may not have articulated my problem correctly.
Here is some context, I want to be able to send a text message message to a user to schedule an appointment with them.
I want to be able to start a new conversation with the rasa server by triggering a custom action (seems like this should be action_session_start
) and also pass data with that action call to personalize the conversation. For example, passing the customer name and scheduling options that they could select from.
I tried starting a conversation by making a call to the action server with action_session_start
and passing the following data:
{
next_action: 'action_session_start',
tracker: {
sender_id: sender_id,
slots: {
"customer_name": "Raj",
"appointment_options": ["Thursday at 10am", "Thursday at 11am"]
}
},
}
The conversation seems like it goes well, but when fetching the tracker and story after the conversation is over, the response are missing data. The story is missing the action_session_start and the tracker has none of the slots set.
Here is my custom action_session_start
action:
class ActionSessionStart(Action):
def name(self) -> Text:
return "action_session_start"
async def run(
self, dispatcher, tracker: Tracker, domain: Dict[Text, Any]
) -> List[Dict[Text, Any]]:
metadata = tracker.get_slot("session_started_metadata")
# Do something with the metadata
print(metadata)
customer_name = tracker.slots["customer_name"]
appointment_option_1 = tracker.slots["appointment_options"][0]
appointment_option_2 = tracker.slots["appointment_options"][1]
dispatcher.utter_message(text=f"Hi {customer_name}, which appointment works for you? Can I suggest the {appointment_option_1} or {appointment_option_2} instead?")
# the session should begin with a `session_started` event and an `action_listen`
# as a user message follows
return [SlotSet("customer_name", tracker.slots["customer_name"]), SessionStarted(), ActionExecuted("action_listen")]
Here is the fetched story:
version: "3.1"
stories:
- story: 59d7af14-8c8b-46f6-b32d-95be3a55b45a
steps:
- intent: user_selected_appointment
user: |-
[Thursday at 10am](appointment)
- action: utter_appointment_selection_confirmed
Slots from the tracker:
"slots": {
"customer_name": null,
"appointment_options": null,
"session_started_metadata": null
},
In the events on the tracker I do see the session_start
and action_listen
event, but the slots are not being set.
Any help as to why the slots are not being set on the tracker and as to why the action is not showing up in the story would be greatly appreciated!