I want to access the slot value '{cityName}' in my Lambda Function. I am using ASK-SDK. What is the python code or syntax to do so?
The above method is correct but it did not work for me.
Another answer to the above question is as follows:
item, is_resolved = util.get_intent_(slots=handler_input.request_envelope.request.intent.slots)
and then define function get_intent_ as follows:
import random
import six
from ask_sdk_core.handler_input import HandlerInput
from ask_sdk_core.utils import is_request_type
def get_intent_(slots):
item = []
resolved_item = None
for _,slot in six.iteritems(slots):
if slot.value is not None:
resolved_item = slot.value
if resolved_item is not None:
return resolved_item, True
else:
return resolved_item, False
This method looks complicated but it is a good practice to define a function and call it.