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 Answer
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
answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions