Adding session attributes in Python for Alexa skills

后端 未结 4 1881
天涯浪人
天涯浪人 2021-01-01 07:21

I have 3 slots (account, dollar_value, recipient_first) within my intent schema for an Alexa skill and I want to save whatever slots a

4条回答
  •  滥情空心
    2021-01-01 08:19

    Take a look at the below:

    account = intent['slots']['account']['value'] 
    dollar_value = intent['slots']['dollar_value']['value'] 
    recipient_first = intent['slots']['recipient_first']['value']  
    
    # put your data in a dictionary
    attributes = { 
        'account':account, 
        'dollar_value':dollar_value, 
        'recipient_first':recipient_first
    }
    

    Put the attributes dictionary in 'sessionAttributes' in your response. You should get it back in 'sessionAttributes' once Alexa replies to you.

    Hope this helps.

提交回复
热议问题