Lex v2 Session Attributes

0

I must be missing something simple, however I'm finding that in Lex v2 as part of my slot fulfillment section I'm trying to set a session attribute that contains the value of the slot. I'm using the syntax example of [sessionattribute] = {slot}, however it appears that instead of substituting the slot value it's assigning the literal value of {slot} to the attribute. My slot name is MemberNumber, my actual syntax is [MySessionAttribute] = {MemberNumber}. When I test the Lex bot and inspect the values I see "MySessionAttribute" : {MemberNumber} rather than the actual "ABC123" value I filled the slot with. NOTE: I do not have Slot Obfuscation enabled. Also, I have verified that the slot is filled properly since once it returns to my Connect flow I am able to look at $.Lex.Slots.MySessionAttribute and get the valid "ABC123" value.

  • I'm not sure what programming language you are using or this is in a JSON, but if this is in a JSON object and the slot name is MemberNumber, it should be in the following format

    "sessionAttributes": {
                    //        "Another slot name": "slot_value",
                   "MemberNumber": "ABC123"
     },
    
  • Thanks for the info - for clarification I'm working within a new Lex bot and drilling down into one intent and the fulfillment section, under Advanced Options. I'm able to reference the slot in a success message where I can say "I got a member number of {MemberNumber}" which works fine and would play the slot value itself, however right below that in the editor where you can set the slot values or session attributes I'm setting [MyAttribute] = {MemberNumber} and the slot value does not get properly substituted, instead I simply get the literal text value of {MemberNumber} instead of what I entered for the slot itself.

  • Have you tried using {intent.slot} notion instead of just {slot} ?

已提问 1 年前1020 查看次数
1 回答
0

Here is the doc I am referencing: https://docs.aws.amazon.com/lexv2/latest/dg/paths-setting-values.html

To set the value of the session attribute named MemberNumber to ABC123:

[MemberNumber] = "ABC123"
profile picture
已回答 1 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则