I have an intent-A
which is triggered by some user input. When the response is given to user I have used ConfirmIntent
instead of Close
so that I can switch/chain another intent (lets say intent-B
).
Ideally if user type "yes"
then intent should be triggered and if user type "no"
then it should not. Problem is that intent-B
is being triggered no matter what I type.
I have read about ConfirmIntent
from here, here and here.
Calling Code:
session_attributes = {"confirmationContext": "AutoPopulate"}
return confirm_intent(session_attributes , 'intent-B', slots, 'Do you want to invoke intent-B')
ConfirmIntent Code:
def confirm_intent(session_attributes, intent_name, slots, message):
return {
'sessionAttributes': session_attributes,
'dialogAction': {
'type': 'ConfirmIntent',
'intentName': intent_name,
'slots': slots,
'message': {
'contentType': 'PlainText',
'content': message
}
}
}
In the logs I can see that confirmationStatus': 'Denied'
when I type "no
" but even then intent-B
is being called.
Am I missing something or is it designed this way?
NOTE: For workaround I am adding below code in the DialogCodeHook of intent-B
if 'confirmationStatus' in intent_request['currentIntent'] and intent_request['currentIntent']['confirmationStatus'] == 'Denied':
return close("Ok, let me know if you need anything else.", session_attributes)