Search code examples
aws-lambdaslackamazon-lex

Validate the user input


I have a slack chat bot built using Amazon lex. Added this to a private channel. Now I want my bot to respond to messages that start with '@bot'. How can I do this validation in Lex? Now, this bot responds to all messages in the channel. I think, If we can catch a particular intent then it can be done in the lambda function. I don't know how to validate if it cannot catch an intent.


Solution

  • Amazon says they are working on a catch-all solution for messages. Until they complete this, there is a work-around. It will probably involve a bit of work.

    1. Create an intent slot of type AMAZON.StreetAddress or similar. Let's name it catchall
    2. Add {catchall} as a Sample Utterance.
    3. Enable the Intialization and validation code hook and configure it to call your Lambda function.
    4. Parse event.inputTranscript in Lambda and do whatever you want. This is where things get complicated but it does function.