I am working on building an alexa skill where the requirement is to fetch the value for previous slot..
User: Alexa,create an appointment
Alexa: please state the subject for appointment
User : subject is {subject}
Alexa: on which day?
User : {Day}
Alexa : Appointment has been created with {subject} on {day}
Final method should fetch values from previous slots(subject and date) and create an appointment. So far i'm able to fetch slot value for current intent...but i would like to fetch the slot value for previous intent and use it in the current method.
*Example
protected SpeechletResponse method1(Intent intent,Session session)throws
Exception{
SpeechletResponse response=null;
Map<String, Slot> slots = intent.getSlots();
Slot example = slots.get(SampleSlot);
String value=example.getValue().toString();
String output="something";
response = SpeechletResponseHelper.getSpeechletResponse(output, reprompt,
true);
return response;
}
protected SpeechletResponse method2(Intent intent,Session session)throws
Exception{
SpeechletResponse response=null;
****How to fetch the slot value used for method1 and use it in method2? ****
response = SpeechletResponseHelper.getSpeechletResponse(xxxx, reprompt,
true);
return response;
}
Is this possible?If so how can i do it?
Thanks and Regards
I used sessions to achieve my query like this....