Search code examples
amazon-web-servicestimezoneaws-lambdachatbotamazon-lex

Amazon Lex Initializatoin and time zone issue


Can I declare request attribute "x-amz-lex:time-zone" in lambda initialization to change the time zone of amazon lex chat bot. If can, how should i write?


Solution

  • This is not possible because the "initialization and validation" Lambda Function comes after Lex processes the input, with the time-zone setting already used to format date and time values.

    The other thing to note is that requestAttributes are only used by Lex in the incoming request, not in the response. Here is what is meant when we differentiate between request and response:

    enter image description here


    This is the relevant line in the documentation (emphasis added):

    "A user-defined request attribute is data that you send to your bot in each request. You send the information in the amz-lex-request-attributes header of a PostContent request or in the requestAttributes field of a PostText request."


    So here is where requestAttributes need to be added: enter image description here

    And requestAttributes can only be added by PostContent API or PostText API.