3

I am creating a custom skill for Alexa Echo with my existing service.
The service has lots of functionality in it which serves a different purpose.
I want my skill to serve all these functionalities.

All the services are HTTPS POST service which accepts JSON RAW body request and provides result in JSON.

Q1. Can I use each functionality from my skill like a separate intent?
Q2. Should I use Lambda or I can directly hit my services?
Q3. If Lambda is used, can I construct the desired payload and send to my service and fetch and parse my response?
Q4. Using Lambda a paid service?
Q5. Can same be done directly without using Lambda? If yes how?
Q6. Are there any video tutorials for both approaches?

johndoe
  • 4,387
  • 2
  • 25
  • 40
Abhinav Tyagi
  • 5,158
  • 3
  • 30
  • 60

1 Answers1

5

Q1. Can I use each functionality from my skill like a separate intent?

An intent is a spoken phrases. It it makes sense for each function of your service to be asked for separately, then sure, split it up that way. You should really come up with your audio model first. Then fit your service to the audio model. That will give you the most intuitive design.

Q2. Should I use Lambda or I can directly hit my services?

Read the docs. Alexa can talk to a Lambda endpoint or a HTTPS endpoint. If your services has a HTTPS endpoint with the rather specific requirements Alexa has, you can use it directly if you follow their protocol. Since their requirements are rather cryptic, most people use Lambda to proxy to their services.

Q3. If Lambda is used, can I construct the desired payload and send to my service and fetch and parse my response?

Lambda is just code. You can do anything in it that you can do with code. So, sure, you call call into anything. However, you do have a strict time budget. Whatever you do need to return before Alexa times out. You only have about 6-8 seconds, so you need to manage what you do carefully.

Q4. Using Lambda a paid service?

Lambda has a very generous free tier. Something like 100,000 requests. Alexa tends to be very low volume. If you get a few hundred requests a day you are doing well. So you are unlikely to blow through your free tier.

Q5. Can same be done directly without using Lambda? If yes how?

It doesn't matter if you use Lambda or HTTPS. Both have the same interface. It's just that you control your hardware back end for HTTPS and have more flexability.

Q6. Are there any video tutorials for both approaches?

It's not really the sort of thing that lends itself well to video. But here is a video I've done of a presentation on general design and development for Alexa.

Joseph Jaquinta
  • 2,118
  • 17
  • 15
  • Thanks a lot... I will surely look into your suggestions :) – Abhinav Tyagi Aug 02 '16 at 12:24
  • Hi Joseph, can you share some example on how I can POST RAW body data to a web service and receive the service response? – Abhinav Tyagi Aug 04 '16 at 08:57
  • Here is the canonical example of using a Lambda Proxy: https://forums.developer.amazon.com/questions/8155/how-to-use-aws-lambda-as-a-proxy-for-non-ssl-serve.html Unfortunately it has been a bit mangled by the new forum format. But if you paste the code into a formatter that should make it clearer. – Joseph Jaquinta Aug 04 '16 at 12:02
  • Anything in Java? I have created a hello world using Node.JS but wants to use Java as its my preferred language. Can't find any steps for setting up environment for Java !! – Abhinav Tyagi Aug 05 '16 at 06:32
  • If you want to develop in Java on Lambda, here is my guide: https://github.com/jjaquinta/EchoProofOfConcepts/tree/master/jo.echo.lambda I don't recommend it. Better off developing a normal servlet on a web server, then using the cut and paste proxy above to get past the SSL restrictions. That's what I do for my 10+ skills. – Joseph Jaquinta Aug 05 '16 at 12:13
  • Yes I followed that but a bit confusing... I also followed java sdk samples and was able to built a maven project hello world. But I get 61000 timeout error while creating the lambda function :( – Abhinav Tyagi Aug 05 '16 at 14:40
  • Using Java for Lambda is a bit tricky. Being an experienced developer helps. It's not the sort of thing I would start on. Also, it is very limited. The JVM is recycled after each Lambda call, so you can't run things in the background or cache objects. This is why I don't recommend it. – Joseph Jaquinta Aug 05 '16 at 17:23
  • Humm... I am not JavaScript guy. So understanding node js and lambda framework is a bit time consuming. And I have to have a working prototype in two working days :( – Abhinav Tyagi Aug 05 '16 at 17:27