Alexa Lambda function to get user's full name










3















Using the Alexa Custom skills, and AWS Lambda Functions, I want to be able to just get the user's name from their account. I already set up permissions and account linking and verified that it works. However, there are no resources available for python 3.6 methods for retrieving the actual user info.



There is this page which has the method I need to use (get_profile_name()):
https://github.com/alexa/alexa-skills-kit-sdk-for-python/blob/master/docs/en/SERVICE_CLIENTS.rst#upsserviceclient



However, it does not give me info on how I can access that method inside a Lambda Function.



My main function runs from:



def lambda_handler(event, context):


Event only has the JSON from the user input from the custom Alexa skill, which does not include a name, so I'm stuck on how to access anything that has the get_profile_name()



The only example I can possibly find is from this:
https://forums.developer.amazon.com/questions/181267/new-sdk-and-python-36-progressive-response-sample.html



which uses



handler_input.service_client_factory.get_profile_name()



But I cannot figure out how the handler_input is different from my "event"



I figured it would be simple to just get a name, but this is pretty complex. Has anyone done this before?










share|improve this question


























    3















    Using the Alexa Custom skills, and AWS Lambda Functions, I want to be able to just get the user's name from their account. I already set up permissions and account linking and verified that it works. However, there are no resources available for python 3.6 methods for retrieving the actual user info.



    There is this page which has the method I need to use (get_profile_name()):
    https://github.com/alexa/alexa-skills-kit-sdk-for-python/blob/master/docs/en/SERVICE_CLIENTS.rst#upsserviceclient



    However, it does not give me info on how I can access that method inside a Lambda Function.



    My main function runs from:



    def lambda_handler(event, context):


    Event only has the JSON from the user input from the custom Alexa skill, which does not include a name, so I'm stuck on how to access anything that has the get_profile_name()



    The only example I can possibly find is from this:
    https://forums.developer.amazon.com/questions/181267/new-sdk-and-python-36-progressive-response-sample.html



    which uses



    handler_input.service_client_factory.get_profile_name()



    But I cannot figure out how the handler_input is different from my "event"



    I figured it would be simple to just get a name, but this is pretty complex. Has anyone done this before?










    share|improve this question
























      3












      3








      3


      1






      Using the Alexa Custom skills, and AWS Lambda Functions, I want to be able to just get the user's name from their account. I already set up permissions and account linking and verified that it works. However, there are no resources available for python 3.6 methods for retrieving the actual user info.



      There is this page which has the method I need to use (get_profile_name()):
      https://github.com/alexa/alexa-skills-kit-sdk-for-python/blob/master/docs/en/SERVICE_CLIENTS.rst#upsserviceclient



      However, it does not give me info on how I can access that method inside a Lambda Function.



      My main function runs from:



      def lambda_handler(event, context):


      Event only has the JSON from the user input from the custom Alexa skill, which does not include a name, so I'm stuck on how to access anything that has the get_profile_name()



      The only example I can possibly find is from this:
      https://forums.developer.amazon.com/questions/181267/new-sdk-and-python-36-progressive-response-sample.html



      which uses



      handler_input.service_client_factory.get_profile_name()



      But I cannot figure out how the handler_input is different from my "event"



      I figured it would be simple to just get a name, but this is pretty complex. Has anyone done this before?










      share|improve this question














      Using the Alexa Custom skills, and AWS Lambda Functions, I want to be able to just get the user's name from their account. I already set up permissions and account linking and verified that it works. However, there are no resources available for python 3.6 methods for retrieving the actual user info.



      There is this page which has the method I need to use (get_profile_name()):
      https://github.com/alexa/alexa-skills-kit-sdk-for-python/blob/master/docs/en/SERVICE_CLIENTS.rst#upsserviceclient



      However, it does not give me info on how I can access that method inside a Lambda Function.



      My main function runs from:



      def lambda_handler(event, context):


      Event only has the JSON from the user input from the custom Alexa skill, which does not include a name, so I'm stuck on how to access anything that has the get_profile_name()



      The only example I can possibly find is from this:
      https://forums.developer.amazon.com/questions/181267/new-sdk-and-python-36-progressive-response-sample.html



      which uses



      handler_input.service_client_factory.get_profile_name()



      But I cannot figure out how the handler_input is different from my "event"



      I figured it would be simple to just get a name, but this is pretty complex. Has anyone done this before?







      python python-3.x aws-lambda alexa alexa-skill






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 '18 at 5:11









      FishyFishy

      165




      165






















          2 Answers
          2






          active

          oldest

          votes


















          0














          Please see the Alexa Customer Profile API documentation to get customers' name, email address and phone number.



          This documentation details the request process -- here's an example from this documentation to get the phone number:

          Host: api.amazonalexa.com
          Accept: application/json
          Authorization: Bearer MQEWY...6fnLok
          GET https://api.amazonalexa.com/v2/accounts/~current/settings/Profile.name



          Note you must obtain an access token to use as part of the request (how to obtain a token is also detailed on that page).



          If the ASK Python SDK does not contain built-in support for the Alexa Customer Profile API it seems that you can just create a RESTful request as detailed.






          share|improve this answer






























            0














            Your code need to have handler classes for your skill's intents with two methods:



            can_handle(self, handler_input)


            and



            handle(self, handler_input)


            This is how you get the handler_input via parameter.



            There's a similar example here but to retrieve the address.






            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%2f53274213%2falexa-lambda-function-to-get-users-full-name%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              0














              Please see the Alexa Customer Profile API documentation to get customers' name, email address and phone number.



              This documentation details the request process -- here's an example from this documentation to get the phone number:

              Host: api.amazonalexa.com
              Accept: application/json
              Authorization: Bearer MQEWY...6fnLok
              GET https://api.amazonalexa.com/v2/accounts/~current/settings/Profile.name



              Note you must obtain an access token to use as part of the request (how to obtain a token is also detailed on that page).



              If the ASK Python SDK does not contain built-in support for the Alexa Customer Profile API it seems that you can just create a RESTful request as detailed.






              share|improve this answer



























                0














                Please see the Alexa Customer Profile API documentation to get customers' name, email address and phone number.



                This documentation details the request process -- here's an example from this documentation to get the phone number:

                Host: api.amazonalexa.com
                Accept: application/json
                Authorization: Bearer MQEWY...6fnLok
                GET https://api.amazonalexa.com/v2/accounts/~current/settings/Profile.name



                Note you must obtain an access token to use as part of the request (how to obtain a token is also detailed on that page).



                If the ASK Python SDK does not contain built-in support for the Alexa Customer Profile API it seems that you can just create a RESTful request as detailed.






                share|improve this answer

























                  0












                  0








                  0







                  Please see the Alexa Customer Profile API documentation to get customers' name, email address and phone number.



                  This documentation details the request process -- here's an example from this documentation to get the phone number:

                  Host: api.amazonalexa.com
                  Accept: application/json
                  Authorization: Bearer MQEWY...6fnLok
                  GET https://api.amazonalexa.com/v2/accounts/~current/settings/Profile.name



                  Note you must obtain an access token to use as part of the request (how to obtain a token is also detailed on that page).



                  If the ASK Python SDK does not contain built-in support for the Alexa Customer Profile API it seems that you can just create a RESTful request as detailed.






                  share|improve this answer













                  Please see the Alexa Customer Profile API documentation to get customers' name, email address and phone number.



                  This documentation details the request process -- here's an example from this documentation to get the phone number:

                  Host: api.amazonalexa.com
                  Accept: application/json
                  Authorization: Bearer MQEWY...6fnLok
                  GET https://api.amazonalexa.com/v2/accounts/~current/settings/Profile.name



                  Note you must obtain an access token to use as part of the request (how to obtain a token is also detailed on that page).



                  If the ASK Python SDK does not contain built-in support for the Alexa Customer Profile API it seems that you can just create a RESTful request as detailed.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 15 '18 at 13:04









                  eebbeseneebbesen

                  3,79873361




                  3,79873361























                      0














                      Your code need to have handler classes for your skill's intents with two methods:



                      can_handle(self, handler_input)


                      and



                      handle(self, handler_input)


                      This is how you get the handler_input via parameter.



                      There's a similar example here but to retrieve the address.






                      share|improve this answer



























                        0














                        Your code need to have handler classes for your skill's intents with two methods:



                        can_handle(self, handler_input)


                        and



                        handle(self, handler_input)


                        This is how you get the handler_input via parameter.



                        There's a similar example here but to retrieve the address.






                        share|improve this answer

























                          0












                          0








                          0







                          Your code need to have handler classes for your skill's intents with two methods:



                          can_handle(self, handler_input)


                          and



                          handle(self, handler_input)


                          This is how you get the handler_input via parameter.



                          There's a similar example here but to retrieve the address.






                          share|improve this answer













                          Your code need to have handler classes for your skill's intents with two methods:



                          can_handle(self, handler_input)


                          and



                          handle(self, handler_input)


                          This is how you get the handler_input via parameter.



                          There's a similar example here but to retrieve the address.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 16 '18 at 0:31









                          GermanGerman

                          7,20142746




                          7,20142746



























                              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.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53274213%2falexa-lambda-function-to-get-users-full-name%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







                              這個網誌中的熱門文章

                              How to read a connectionString WITH PROVIDER in .NET Core?

                              Node.js Script on GitHub Pages or Amazon S3

                              Museum of Modern and Contemporary Art of Trento and Rovereto