Building an Alexa skill that uses data from an external API - Dabble Lab #76

Поділитися
Вставка
  • Опубліковано 1 лис 2024

КОМЕНТАРІ • 76

  • @miftahrehman786
    @miftahrehman786 5 років тому +1

    Thanks Steve, This was a beautiful tutuorial and helped me a lot to understand "How to use external API's".

    • @dabblelab
      @dabblelab  5 років тому

      Thanks for the comment Miftah! I'm glad the video was helpful. Be sure to check out the other tutorials on ua-cam.com/users/dabblelab if you have not already. Thanks again!

  • @briantw
    @briantw 3 роки тому +1

    Crapped myself when Alexa spoke. Volume equalisation!

  • @donnamareepakinga1269
    @donnamareepakinga1269 6 років тому

    I think you are great at teaching how to build a new skill. I was able to go from space facts to random quote to bitcoin api very easily! Thanks a million :D

    • @dabblelab
      @dabblelab  6 років тому

      Thanks Donnamaree! That's awesome that you're moving along so quickly. Please post and let us know when you get your skills published. Thanks again!

    • @donnamareepakinga1269
      @donnamareepakinga1269 6 років тому

      Thanks! So you have empowered me to create a super cool skill which I’m getting stuck on. I want to create my own data set using a google sheet but it will have client data on it. How do I make the google sheet public but be able to reassure my customers the data is secure?

    • @dabblelab
      @dabblelab  6 років тому

      I'd take a look at using AirTable.com - it's kind of like using Google Sheets but easier to work with for Alexa skills (in my opinion). You could share the data through the skill without making the data public on the web. From your comment, it seems like that's what you're trying to do right?

    • @donnamareepakinga1269
      @donnamareepakinga1269 6 років тому +1

      Yes. I feel with my new found knowledge anything is possible. That has depended a lot on me working through all of your videos and leaning CLI which fees like a new best friend. I will have a crack at it and let you know how I go. Yay for airtable! Hopefully it’s easy to set up :)

    • @faiziniyazi7662
      @faiziniyazi7662 5 років тому

      he can you help me plz,i am getting an error in the beginning, unknown command

  • @kutticchathan
    @kutticchathan 5 років тому

    Hi, I have been following exactly as suggested, but am getting the following error while deploying.
    [Error]: Get Lambda ARN arn:aws:lambda:eu-west-1:885625664603:function:ask-custom-random-quote-alexa-default failure for custom/default.
    NetworkingError: connect ECONNREFUSED 63.32.73.xxx:443
    Looks like it is expecting the lambda function to be available before deploying. Has the interface moved on? Any suggestions?
    The tutorials are great though!

  • @mufidrazmin8929
    @mufidrazmin8929 4 роки тому +1

    This is really helpful.. Nicely presented as well 👍
    Would you be able to do another video which would describe how we could ask for nested questions.
    Eg: open xyz: brings all the coin details, from that we could ask for a particular one, say bitcoin and ask for subsequent questions on that info.

  • @Folko
    @Folko 6 років тому +1

    Just watched this one and can't wait to give it a shot. Thanks!

    • @dabblelab
      @dabblelab  6 років тому

      You're very welcome Folko! Let me know when you get it going.

  • @harryhudson3328
    @harryhudson3328 5 років тому

    Hi Steve - Another quick question, I have to add an Ocp-Apim-Subscription-Key in a header parameter. Do I pass this parameter as a JSON object with header info in the getRemoteData function eg const getRemoteData = function (url,headerParam)

  • @rayonrails
    @rayonrails 6 років тому +2

    Daniel and Jennifer - I had the same error - I jumped into the AWS Lambda Console and change the function to use Node.js 8.10. Once I did that everything worked. Hope that helps.

    • @ruslanvs
      @ruslanvs 6 років тому +1

      Many thanks, helped a ton

  • @nikhilkumarjha
    @nikhilkumarjha 5 років тому

    @steve Amazing video. I was able to follow up properly and created the skills at my end.
    For my actual work, I need to send the request to a request to SOP/REST and get back some XML result. How would I be able to show the data on Alexa in such a case? Any lead will be appreciated.

    • @dabblelab
      @dabblelab  5 років тому

      Hi Nikhil. I'm glad you liked the video and thanks for the comment! On your question, I would convert the xml to a javascript object and work with the data that way. I've used the 'xml2js' npm module to do this in the past and it works well. Here is a link to it www.npmjs.com/package/xml2js - I hope that is helpful and thanks for watching!

  • @joaquinbeltran1
    @joaquinbeltran1 6 років тому +1

    Hey Steve, is there a way to programmatically call another intent once I receive the data from the API call. I'm getting the device address from the user through an intent and once I get the address, I'm trying to call a different intent that will use that data. Thank you!

    • @SaifAlFalah
      @SaifAlFalah 6 років тому

      Joaquin Beltran why don't you use a function for that?

    • @SuperSukrit
      @SuperSukrit 6 років тому

      Hi Saif, do you have an example of how we can do that?

  • @luizarusso6092
    @luizarusso6092 3 роки тому

    hi! can you please send me the url of the updated video? this one is great but some parts look a bit different now

    • @dabblelab
      @dabblelab  3 роки тому

      Hi! Dabble Lab #215 is the latest we have received. But always make sure you search your topic on our channel in case we release a new one.

  • @danianfocus
    @danianfocus 6 років тому

    Followed along exactly but I get an issue when testing in the developer console. Typing in "open api starter" I get "There was a problem with the requested skill's response." But when I type in one of the samples like "how many people are in space" Alexa responds with the answer. Same thing happens with the random quote and crypto prices.
    Tried to test the function in lambda but it tells me "There is an error in your JSON event. Please correct it before saving."

  • @ShaneWelcher
    @ShaneWelcher 6 років тому

    Sorry for the ignorance, it seems cool to have an a Alexa Skill but what are helpful purposes for business or marketing or is there?

    • @dabblelab
      @dabblelab  6 років тому +1

      Hey Shane! No apology necessary - that's a great question. In my opinion, over the coming years, users/consumers will expect to be able to engage with companies through their digital assistants (Alexa, Google Assistant, Cortana, etc) for everything from getting support to making purchases. It's early days now, but it won't be long before bots and digital assistants are as critical to a company's success as a website or a storefront.

    • @ShaneWelcher
      @ShaneWelcher 6 років тому

      Thank you, I agree but in your examples you show simple one question and answer setups. Is there a way to answer and have it be used as a marketer such as helping a business get noticed or invite the user to a business website or product/service?
      Again, information is great but business needs will be the forefront.
      Thanks again,
      Shane

  • @sukritchakravorty
    @sukritchakravorty 6 років тому +2

    Hey Steve/Dabble Lab, Can you create a video showing how we can use Google Maps API in Alexa?

  • @mda1125
    @mda1125 6 років тому

    I like this one a lot and I used it to pull a random term from my DynamoDB glossary but.. how do you add a second intent that takes a Query from a user to grab a specific term? My API can handle this already at /terms but I am struggling to figure out how to take my intention that lets the user type in or say a query and somehow pass that to the end URL that kicks back a specific term.

    • @dabblelab
      @dabblelab  6 років тому

      Hey Marc, how does the API accept the term? Do you pass it as a querystring parameter or do you do an http post? If the api is public, can you provide the URL endpoint and a curl example of what you're trying to do?

    • @mda1125
      @mda1125 6 років тому

      ​@@dabblelab Here is the main API and if you hit it, it returns a random term from the DataBase.
      6v9vaz5il8.execute-api.us-east-1.amazonaws.com/DEV/
      If you provide a specific term, it will provide that.. 6v9vaz5il8.execute-api.us-east-1.amazonaws.com/DEV/terms/{term_ID}
      So I've used your example but used the Slot of Query which uses Amazon.SearchQuery. I think I've got it right but I'm not passing the variable of what the person types to the end of the string correctly.
      "Ask SKILL NAME to define {Query} should in theory use the specific GET API URL above and attach whatever is said or typed into the Query slot.
      var searchTerm = handlerInput.requestEnvelope.request.intent.slots.Query.value;
      await getRemoteData('6v9vaz5il8.execute-api.us-east-1.amazonaws.com/DEV/term/' + encodeURIComponent(searchTerm))
      As you can see.. at times it does capture the Query into the JSON Alexa simulator but doesn't know what it is. How do I get just that "value" slapped on the end of my /terms API
      slots": {
      "Query": {
      "name": "Query",
      "value": "encryption",

  • @balajinikhil9961
    @balajinikhil9961 4 роки тому

    Sir for your crypto prices skill, the api is no longer working. What is the new publicly available API, please provide

  • @owaiskhanafridi1149
    @owaiskhanafridi1149 6 років тому

    I am using your templates for getting data from an external API. In my case, external API sometimes takes more than 20 - 30 seconds to get the data. I want to prompt a message like "Please wait while your request is being processed" so that customer doesn't leave the session wondering something went wrong. How can I do that ?

    • @dabblelab
      @dabblelab  6 років тому

      Hi Owais. Here is a video that explains how to do "progressive responses" which is a response while something is processing like an API call - ua-cam.com/video/xqzhNSXUvDw/v-deo.html . However, all responses need to be completed within 8 seconds. So, if your API takes 20 - 30 seconds that's not going to finish before the session is ended. So, you'll need to figure out how to get the API to respond faster to make this work.

  • @harryhudson3328
    @harryhudson3328 5 років тому

    Hi Steve - great video . Can you please advise how I would pass a value that I got from an API call to a different intent?

    • @dabblelab
      @dabblelab  5 років тому +1

      Hi Harry - thanks for the nice comment! What I usually do is save any values I need to a session attribute that I can then access an use in other intents. If you're not familiar with using session attributes, here is another tutorial on that topic. ua-cam.com/video/_ygFVmh5gHA/v-deo.html - I hope that helps.

    • @harryhudson3328
      @harryhudson3328 5 років тому +1

      Thanks for the prompt reply - great stuff - I shall have a look at that

    • @dabblelab
      @dabblelab  5 років тому

      You're welcome, Harry. I hope it's helpful.

  • @yashsri1
    @yashsri1 5 років тому +1

    I am getting invalid command error for the ask new command you have used, any help on this?

    • @felixin02
      @felixin02 5 років тому +2

      You need to delete "--template" and just use "ask new --url skilltemplates.com/templates.json"

  • @felixin02
    @felixin02 5 років тому

    Hey Steve, i am trying to do this tutorial using the template command but when i do
    "ask new --template --url skilltemplates.com/templates.json"
    i get
    [Error]: Invalid command. Please run "ask new -h" for help.

    • @felixin02
      @felixin02 5 років тому

      ok, it seems the problem is the --template command, if you just use
      "ask new --url skilltemplates.com/templates.json"
      it works just fine

  • @Gregory.Pacheco
    @Gregory.Pacheco 4 роки тому

    What about authentication with username and password to get a token?

  • @marcomckay3415
    @marcomckay3415 6 років тому

    Smashing videos buddy. I'm thinking of jumping right in and trying to create a skill for a "subjective" question. Would this be possible? I.E. Could the query be "Who is the cheapest rental car company in London" and the answer be a particular one that you specify? Seems a bit cunning but is it possible?
    Thanks

    • @dabblelab
      @dabblelab  6 років тому

      Thanks, Marco! Yes, that is easily doable. Maybe you could also make a skill that lets users rate rental car companies and use the ratings to make the answer a bit less subjective. Anyhow, I hope this helps!

  • @nishithareddy2431
    @nishithareddy2431 4 роки тому +1

    Cannot retrieve the template list at skilltemplates.com/templates.json - Getting this error while I try to fetch the template

    • @dabblelab
      @dabblelab  4 роки тому

      Hi Nishitha. Sorry for the issue. There have been some updates to this tutorial. Here is a link to an updated version of the tutorial and the template. dabblelab.com/templates/alexa-remote-api-skill-template

  • @faiziniyazi7662
    @faiziniyazi7662 5 років тому

    when I am typing in my vsc terminal,
    ask new --template --url skilltemplates.com/templates.json,
    I am getting this error
    [Error]: Invalid command. Please run "ask new -h" for help.

    • @dabblelab
      @dabblelab  5 років тому

      Faizi Niyazi if you use the same command without the -template it should work. Amazon updated the CLI since this video was published. Let me know if that fixes the issue.

  • @8cyl6speed
    @8cyl6speed 5 років тому

    great video i learned a lot

  • @MrPeterreviews
    @MrPeterreviews 5 років тому +1

    Hey Steve, what if the api requires authentication and the use of an API key?

    • @dabblelab
      @dabblelab  5 років тому

      Hey Peter, depending on the API, you'd usually send the API Key with the authentication header in the request. It's fairly straightforward but that might be a good topic for another tutorial.

    • @MrPeterreviews
      @MrPeterreviews 5 років тому

      @@dabblelab Im trying to find out where the username and password would go in your template. Can you offer your input? Im assuming it should go under the getRemotData function. How would that syntax look like?

    • @dabblelab
      @dabblelab  5 років тому

      Hi Peter. I would recommend that you make the username and password environment variable for the lambda function. Here is a link on how to do that docs.aws.amazon.com/lambda/latest/dg/tutorial-env_console.html. Then you can use the variables/values in the Lambda code by doing something like: const username = process.env.USERNAME; Does that make sense?

  • @SuperSukrit
    @SuperSukrit 6 років тому

    @steve I am trying to call two different API 's in my lambda function.
    I am going to use the geolocation of the user and then show him things based on that.
    Can you please help me in how I can call multiple API's in a single lambda function?

    • @dabblelab
      @dabblelab  6 років тому

      Hey Sukrit. Here is another video I did that explains how do do this. ua-cam.com/video/Ze6krw1W-mg/v-deo.html - I hope that helps!

    • @faiziniyazi7662
      @faiziniyazi7662 5 років тому

      can you help me how to create lambda function ?

  • @miguelperera8377
    @miguelperera8377 5 років тому +3

    If you're having trouble with ask new. Remove --template

    • @BobDenny
      @BobDenny 5 років тому +1

      Was just going to post this :-) Thanks!

  • @ArmandoFierroBYRSProd
    @ArmandoFierroBYRSProd 6 років тому

    Hey Steve. What editor are you using?

    • @dabblelab
      @dabblelab  6 років тому

      I'm using Visual Studio Code. It's an Open Source editor from Microsoft. You can get it from code.visualstudio.com.

  • @tonya2183
    @tonya2183 4 роки тому

    Hello I'm trying to apply for AWS free credit and I need to create an Alexa Skill, is it possible to host the backend service in Alexa/AWS so I don't incur in extra charges and Amazon pays for the compute hours, because for this project I will need a cron job a database and web server and of course this won't generate any revenue so I don't want to spend money setting my own server.

    • @dabblelab
      @dabblelab  4 роки тому

      Hi Tony. Since this video was created Alexa-Hosted skills were introduced which allows you to host everything from the Alexa Developer console. Meaning, you don't need an AWS account and it's free. If you head over to dabblelab.com/tutorials you'll find more updated tutorials that cover using Alexa-Hosted skills. I hope that helps!

  • @253rupesh
    @253rupesh 5 років тому +1

    Hi
    I have a secure web api with username and password.
    How can i call this type of web api ?

    • @dabblelab
      @dabblelab  5 років тому

      Hi Rupesh. The answer depends on how your API does authentication. You'd need to find out from the API doc what kind of authentication process is used - usually OAuth or basic authentication. Then you'd use that process to pass an API key or credentials to authenticate. I hope that helps.

    • @nikhilkumarjha
      @nikhilkumarjha 5 років тому

      @@dabblelab What is the syntax for the same? Any links ?

  • @chillySauceMind
    @chillySauceMind 4 роки тому

    can we do post API request in amazon alexa ?

    • @dabblelab
      @dabblelab  4 роки тому

      Hi Karan. Yes, you can. Basically, anything you can do with Node.js/Javascript (or whatever programming language you choose to use) you can do as part of an Alexa skill. I hope that helps and thanks for watching!

  • @yashwantp5260
    @yashwantp5260 6 років тому

    how to do this in windows machine using AWS account?

    • @dabblelab
      @dabblelab  6 років тому +1

      Hi Yashwant. All of the steps are the same on Windows for the most part. You'll just need to install the ASK CLI which works on Windows just fine. I hope that helps.

    • @lucakaiser2193
      @lucakaiser2193 6 років тому

      it is actually the same

  • @TheJenbell81
    @TheJenbell81 6 років тому

    I'm getting the same as Daniel

  • @daliel3710
    @daliel3710 2 роки тому

    Boring