Email Field from Slack to AWS Lamba












1














{
"messageVersion": "1.0",
"invocationSource": "DialogCodeHook",
"userId": "xxx",
"sessionAttributes": {
"currentReservation": ""
},
"requestAttributes": {

},
"bot": {
"name": "BookTrip",
"alias": "shoping",
"version": "7"
},
"outputDialogMode": "Text",
"currentIntent": {
"name": "Shoping",
"slots": {
"offer": "Yes",
"email_address": null
},
"slotDetails": {
"offer": {
"resolutions": [
{
"value": "Yes"
}
],
"originalValue": "Yes"
},
"email_address": {
"resolutions": ,
"originalValue": null
}
},
"confirmationStatus": "None"
},
"inputTranscript": "<mailto:xxx.20@gmail.com|xxx.20@gmail.com>"
}


When bot asks for email address. User entered xxx.20@gmail.com for the email_address slot.



But when the request comes from the slack, it is not coming in the slot.



Any suggestions or a solution is appreciated.










share|improve this question



























    1














    {
    "messageVersion": "1.0",
    "invocationSource": "DialogCodeHook",
    "userId": "xxx",
    "sessionAttributes": {
    "currentReservation": ""
    },
    "requestAttributes": {

    },
    "bot": {
    "name": "BookTrip",
    "alias": "shoping",
    "version": "7"
    },
    "outputDialogMode": "Text",
    "currentIntent": {
    "name": "Shoping",
    "slots": {
    "offer": "Yes",
    "email_address": null
    },
    "slotDetails": {
    "offer": {
    "resolutions": [
    {
    "value": "Yes"
    }
    ],
    "originalValue": "Yes"
    },
    "email_address": {
    "resolutions": ,
    "originalValue": null
    }
    },
    "confirmationStatus": "None"
    },
    "inputTranscript": "<mailto:xxx.20@gmail.com|xxx.20@gmail.com>"
    }


    When bot asks for email address. User entered xxx.20@gmail.com for the email_address slot.



    But when the request comes from the slack, it is not coming in the slot.



    Any suggestions or a solution is appreciated.










    share|improve this question

























      1












      1








      1







      {
      "messageVersion": "1.0",
      "invocationSource": "DialogCodeHook",
      "userId": "xxx",
      "sessionAttributes": {
      "currentReservation": ""
      },
      "requestAttributes": {

      },
      "bot": {
      "name": "BookTrip",
      "alias": "shoping",
      "version": "7"
      },
      "outputDialogMode": "Text",
      "currentIntent": {
      "name": "Shoping",
      "slots": {
      "offer": "Yes",
      "email_address": null
      },
      "slotDetails": {
      "offer": {
      "resolutions": [
      {
      "value": "Yes"
      }
      ],
      "originalValue": "Yes"
      },
      "email_address": {
      "resolutions": ,
      "originalValue": null
      }
      },
      "confirmationStatus": "None"
      },
      "inputTranscript": "<mailto:xxx.20@gmail.com|xxx.20@gmail.com>"
      }


      When bot asks for email address. User entered xxx.20@gmail.com for the email_address slot.



      But when the request comes from the slack, it is not coming in the slot.



      Any suggestions or a solution is appreciated.










      share|improve this question













      {
      "messageVersion": "1.0",
      "invocationSource": "DialogCodeHook",
      "userId": "xxx",
      "sessionAttributes": {
      "currentReservation": ""
      },
      "requestAttributes": {

      },
      "bot": {
      "name": "BookTrip",
      "alias": "shoping",
      "version": "7"
      },
      "outputDialogMode": "Text",
      "currentIntent": {
      "name": "Shoping",
      "slots": {
      "offer": "Yes",
      "email_address": null
      },
      "slotDetails": {
      "offer": {
      "resolutions": [
      {
      "value": "Yes"
      }
      ],
      "originalValue": "Yes"
      },
      "email_address": {
      "resolutions": ,
      "originalValue": null
      }
      },
      "confirmationStatus": "None"
      },
      "inputTranscript": "<mailto:xxx.20@gmail.com|xxx.20@gmail.com>"
      }


      When bot asks for email address. User entered xxx.20@gmail.com for the email_address slot.



      But when the request comes from the slack, it is not coming in the slot.



      Any suggestions or a solution is appreciated.







      aws-lambda slack aws-lex






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 12 at 9:52









      Ch V Kishore

      1338




      1338
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Lex is not able to recognize the input as an email because Slack is wrapping the actual input with <mailto:...|...>. You can see the input that Lex is provided in the inputTranscipt value of the event.



          I'm assuming you have Lex connected directly to Slack, and that you are using a Lambda Function.



          In Lambda, you will have to parse the inputTranscript and fill the slot yourself. You can try something like this (Node.js):



          var userInput = event["inputTranscript"];

          var email = userInput .split("|");
          email = email[1].replace(">","");

          console.log(email);
          event["currentIntent"]["slots"]["email_address"] = email;


          You should only do the above after user inputs their email. It will take the whole input from Slack, including the mailto: wrapper tag and split that in half as an array. Then it takes the second half and removes the ">" at the end. You should then be left with the pure email, as the user had originally input it. Then set that in the slot. As you pass the slots back to lex in the response, Lex will then recognize the email_address slot as filled.



          You may have to process the inputTranscript often like this. I have found that keeping track of the last elicited slot in a sessionAttribute helps me determine where in the conversation I need to parse the input in specific ways.






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53259585%2femail-field-from-slack-to-aws-lamba%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Lex is not able to recognize the input as an email because Slack is wrapping the actual input with <mailto:...|...>. You can see the input that Lex is provided in the inputTranscipt value of the event.



            I'm assuming you have Lex connected directly to Slack, and that you are using a Lambda Function.



            In Lambda, you will have to parse the inputTranscript and fill the slot yourself. You can try something like this (Node.js):



            var userInput = event["inputTranscript"];

            var email = userInput .split("|");
            email = email[1].replace(">","");

            console.log(email);
            event["currentIntent"]["slots"]["email_address"] = email;


            You should only do the above after user inputs their email. It will take the whole input from Slack, including the mailto: wrapper tag and split that in half as an array. Then it takes the second half and removes the ">" at the end. You should then be left with the pure email, as the user had originally input it. Then set that in the slot. As you pass the slots back to lex in the response, Lex will then recognize the email_address slot as filled.



            You may have to process the inputTranscript often like this. I have found that keeping track of the last elicited slot in a sessionAttribute helps me determine where in the conversation I need to parse the input in specific ways.






            share|improve this answer


























              0














              Lex is not able to recognize the input as an email because Slack is wrapping the actual input with <mailto:...|...>. You can see the input that Lex is provided in the inputTranscipt value of the event.



              I'm assuming you have Lex connected directly to Slack, and that you are using a Lambda Function.



              In Lambda, you will have to parse the inputTranscript and fill the slot yourself. You can try something like this (Node.js):



              var userInput = event["inputTranscript"];

              var email = userInput .split("|");
              email = email[1].replace(">","");

              console.log(email);
              event["currentIntent"]["slots"]["email_address"] = email;


              You should only do the above after user inputs their email. It will take the whole input from Slack, including the mailto: wrapper tag and split that in half as an array. Then it takes the second half and removes the ">" at the end. You should then be left with the pure email, as the user had originally input it. Then set that in the slot. As you pass the slots back to lex in the response, Lex will then recognize the email_address slot as filled.



              You may have to process the inputTranscript often like this. I have found that keeping track of the last elicited slot in a sessionAttribute helps me determine where in the conversation I need to parse the input in specific ways.






              share|improve this answer
























                0












                0








                0






                Lex is not able to recognize the input as an email because Slack is wrapping the actual input with <mailto:...|...>. You can see the input that Lex is provided in the inputTranscipt value of the event.



                I'm assuming you have Lex connected directly to Slack, and that you are using a Lambda Function.



                In Lambda, you will have to parse the inputTranscript and fill the slot yourself. You can try something like this (Node.js):



                var userInput = event["inputTranscript"];

                var email = userInput .split("|");
                email = email[1].replace(">","");

                console.log(email);
                event["currentIntent"]["slots"]["email_address"] = email;


                You should only do the above after user inputs their email. It will take the whole input from Slack, including the mailto: wrapper tag and split that in half as an array. Then it takes the second half and removes the ">" at the end. You should then be left with the pure email, as the user had originally input it. Then set that in the slot. As you pass the slots back to lex in the response, Lex will then recognize the email_address slot as filled.



                You may have to process the inputTranscript often like this. I have found that keeping track of the last elicited slot in a sessionAttribute helps me determine where in the conversation I need to parse the input in specific ways.






                share|improve this answer












                Lex is not able to recognize the input as an email because Slack is wrapping the actual input with <mailto:...|...>. You can see the input that Lex is provided in the inputTranscipt value of the event.



                I'm assuming you have Lex connected directly to Slack, and that you are using a Lambda Function.



                In Lambda, you will have to parse the inputTranscript and fill the slot yourself. You can try something like this (Node.js):



                var userInput = event["inputTranscript"];

                var email = userInput .split("|");
                email = email[1].replace(">","");

                console.log(email);
                event["currentIntent"]["slots"]["email_address"] = email;


                You should only do the above after user inputs their email. It will take the whole input from Slack, including the mailto: wrapper tag and split that in half as an array. Then it takes the second half and removes the ">" at the end. You should then be left with the pure email, as the user had originally input it. Then set that in the slot. As you pass the slots back to lex in the response, Lex will then recognize the email_address slot as filled.



                You may have to process the inputTranscript often like this. I have found that keeping track of the last elicited slot in a sessionAttribute helps me determine where in the conversation I need to parse the input in specific ways.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 13 at 3:57









                Jay A. Little

                1,3351418




                1,3351418






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53259585%2femail-field-from-slack-to-aws-lamba%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Florida Star v. B. J. F.

                    Error while running script in elastic search , gateway timeout

                    Adding quotations to stringified JSON object values