Creating an alexa skill with APL. I have some uses of AnimateItem in the apl document I'm sending. If the output speech is very long, the whole animation renders. If it is short, it ends right as the speech ends. Is this intended? I want to render the whole animation.
"onMount": [
{
"type": "AnimateItem",
"easing": "ease-out",
"duration": 3000,
"value": {
"property": "opacity",
"from": 0,
"to": 1
}
},]
I noticed this in the response json
"timeoutType": "SHORT"
Could this have something to do with it?
Related
I want to have a personal greeting (mp3) in my Alexa Skill Launch Intent and start and audio stream directly when the first mp3 is finished. I tried it with responsebuilder and addaudioplayerplaydirective. But you can add only directive to a response, but I have 2 files to play after another. Does anyone have an idea how to solve this?
AudioPlayer is more ideal for long-form audio like meditations or songs. Once your skill starts the audio player, the custom skill sessions ends and your users can't do what they could normally do while in your skill.
It sounds more like you just want to play some shorter audio clips to greet your users. If that's the case and your audio files meet the requirements, APL for Audio, may be a better solution for you.
Here's an example directive your skill can include in its response to play two audio files, one after another, then have Alexa say something.
{
"type": "Alexa.Presentation.APLA.RenderDocument",
"token": "developer-provided-string",
"document": {
"type": "APLA",
"version": "0.91",
"mainTemplate": {
"parameters": [
"payload"
],
"item": {
"type": "Sequencer",
"items": [
{
"type": "Audio",
"source": "soundbank://soundlibrary/ui/gameshow/amzn_ui_sfx_gameshow_intro_01",
"filters": [
{
"type": "Volume",
"amount": "20%"
},
{
"type": "FadeIn",
"duration": 1000
}
]
},
{
"type": "Audio",
"source": "soundbank://soundlibrary/alarms/beeps_and_bloops/bell_01"
},
{
"type": "Speech",
"content": "Hello world!"
}
]
}
}
}
}
If what you really need is the AudioPlayer, have your skill issue a directive to start the first clip. Then add a handler to your skill to capture the PlaybackNearlyFinishedRequest event. In that, your handler should return another directive to queue up the next audio clip.
I'm new to developing skills with Alexa. I've followed the Build Multi-turn Skills Tutorial with Alexa Conversations tutorial up to module 3.
Because I want to develop a skill only for German users I've altered the language settings in the Alexa developer console of my skill to only support German language.
I change the APLA code in the tutorial with the APLA with the "edit audio response" to this:
{
"type": "APLA",
"version": "0.8",
"mainTemplate": {
"parameters": [
"payload"
],
"item": {
"type": "Selector",
"strategy": "randomItem",
"items": [
{
"type": "Speech",
"contentType": "text",
"when": "${environment.alexaLocale == 'de-DE'}",
"content": "Willkommen bei meiner App"
},
{
"type": "Speech",
"contentType": "text",
"when": "${environment.alexaLocale == 'de-DE'}",
"content": "Willkommen."
},
{
"type": "Speech",
"contentType": "text",
"when": "${environment.alexaLocale == 'en-US'}",
"content": "Welcome."
}
]
}
}
}
At the bottom of the console I see that my locale is set to German but when I preview the APL above the audio player always says "Welcome." with the English voice, the other two options are never triggered. What am I missing here?
The audio response tool doesn't take in account the language of the website.
There are no ways to test the condition environment.alexaLocale in this tool.
To test it, update the code of your skill and test it either on the test tabyour skill in the developer console or directly on a real device. Just tested with your code, it works perfectly. Just not on the audio tool.
I am using nodejs and below are the data returned from Google Book API. I wanted to access the information "Authors" from the data which is under a square bracket, however I am not able to access it. I tried a couple of methods but still fail to access them.
{
"kind": "books#volumes",
"totalItems": 42,
"items": [
{
"kind": "books#volume",
"id": "TpuJxgEACAAJ",
"etag": "kFhVXIpo2Aw",
"selfLink": "https://www.googleapis.com/books/v1/volumes/TpuJxgEACAAJ",
"volumeInfo": {
"title": "The Guardians",
"authors": [
"John Grisham"
],
"publisher": "Random House Large Print",
"publishedDate": "2019-10-15",
"description": "The suspense never rests in John Grisham's pulse-pounding new legal thriller. The latest novel from the New York Times #1 bestselling author moves at breakneck speed, delivering some of his most inventive twists and turns yet. In the small north Florida town of Seabrook, a young lawyer named Keith Russo was shot dead at his desk as he worked late one night. The killer left no clues behind. There were no witnesses, no real suspects, no one with a motive. The police soon settled on Quincy Miller, a young black man who was once a client of Russo's. Quincy was framed, convicted, and sent to prison for life. For twenty-two years he languished in prison with no lawyer, no advocate on the outside. Then he wrote a letter to Guardian Ministries, a small innocence group founded by a lawyer/minister named Cullen Post. Guardian handles only a few innocence cases at a time, and Post is its only investigator. He travels the South fighting wrongful convictions and taking cases no one else will touch. With Quincy Miller, though, he gets far more than he bargained for. Powerful, ruthless people murdered Keith Russo, and they do not want Quincy exonerated. They killed one lawyer twenty-two years ago, and they will kill another one without a second thought.",
"industryIdentifiers": [
{
"type": "ISBN_10",
"identifier": "0525639381"
},
{
"type": "ISBN_13",
"identifier": "9780525639381"
}
],
"readingModes": {
"text": false,
"image": false
},
"pageCount": 480,
"printType": "BOOK",
"categories": [
"Fiction"
],
"maturityRating": "NOT_MATURE",
"allowAnonLogging": false,
"contentVersion": "preview-1.0.0",
"panelizationSummary": {
"containsEpubBubbles": false,
"containsImageBubbles": false
},
"imageLinks": {
"smallThumbnail": "http://books.google.com/books/content?id=TpuJxgEACAAJ&printsec=frontcover&img=1&zoom=5&source=gbs_api",
"thumbnail": "http://books.google.com/books/content?id=TpuJxgEACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api"
},
"language": "en",
"previewLink": "http://books.google.com.my/books?id=TpuJxgEACAAJ&dq=the+guardian+inauthor:john+grisham&hl=&cd=1&source=gbs_api",
"infoLink": "http://books.google.com.my/books?id=TpuJxgEACAAJ&dq=the+guardian+inauthor:john+grisham&hl=&source=gbs_api",
"canonicalVolumeLink": "https://books.google.com/books/about/The_Guardians.html?hl=&id=TpuJxgEACAAJ"
},
"saleInfo": {
"country": "MY",
"saleability": "NOT_FOR_SALE",
"isEbook": false
},
"accessInfo": {
"country": "MY",
"viewability": "NO_PAGES",
"embeddable": false,
"publicDomain": false,
"textToSpeechPermission": "ALLOWED",
"epub": {
"isAvailable": false
},
"pdf": {
"isAvailable": false
},
"webReaderLink": "http://play.google.com/books/reader?id=TpuJxgEACAAJ&hl=&printsec=frontcover&source=gbs_api",
"accessViewStatus": "NONE",
"quoteSharingAllowed": false
},
"searchInfo": {
"textSnippet": "In the small north Florida town of Seabrook, a young lawyer named Keith Russo was shot dead at his desk as he worked late one night."
}
}
]
}
Below is how I try to access:
const volumeInfo.authors = body.items[0].volumeInfo.authors;
The nodejs will crash under body.items[0] when I run it. I also try to get the keys underneath "items" but it will flag errors.
Have you tried parsing the response into JSON using JSON.parse method?
I have developed an app and it is functioning properly, however when it comes to designing, i am unable to achieve what is given in the example despite of doing the same code in the example. I want to achieve this design where image is in the center with title above and description down but what I am getting is this, side image, side title and description down. Please let me know how to achieve that. Here is my sample of my code
"response" : {
"outputSpeech" : {
"type" : "SSML",
"ssml" : "<speak>Hello,welcome!</speak>"
},
"card": {
"type": "Standard",
"title": "My Title",
"text": "My description",
"image": {
"smallImageUrl": "small image with the width 720 and height 480",
"largeImageUrl": "large image with the width 1200 and height=800"
}
},
"reprompt": {
"outputSpeech": {
"type": "SSML",
"ssml": "<speak>I am waiting for your command!!</speak>"
}
},
"shouldEndSession" : false
}
It looks like Amazon has changed the Standard Card layout. Images are now shrinked and pushed to the left. The examples shown in current documentation on Cards have the new layout. The blog post you are referring is more than one and half years old
Can we use Rest API instead of using Lambda. The reason im asking is because we got the request, we know what alexa accepts as a response, and we know that it is a POST. So connect all of these into REST API. The reason im asking is that the whole project is based in Jax-RS, so we want to have it all in one place, wihtout using lamda or anything. Not that lamda isn't that great.
So the request that alexa passes to Lambda is:
{
"session": {
"sessionId": "SessionId.a82f0b92-3650-4d45-8f12-e030ffc10894",
"application": {
"applicationId": "amzn1.echo-sdk-ams.app.8f35038e-13ac-4327-8e4f-e5df52dc1432"
},
"attributes": {},
"user": {
"userId": "amzn1.ask.account.AFP3ZWPOS2BGJR7OWJZ3DHPKMOMNWY4AY66FUR7ILBWANIHQN73QGGUEQZ7YXOLC7NYVD3JPUAHAGUS4ZFXJ6ZMS4EHO2CJFPWFLWLYZLDP7S227ADI54A2ZMLZLDO5CXSIB47ELNY54S2M7FDNJFHTSU67B7HB3UZUN6OUUR5BYS3UBRSIPBG4IWRLHUN36NXDYBWUM3NMQZRA"
},
"new": true
},
"request": {
"type": "IntentRequest",
"requestId": "EdwRequestId.bfdb3c27-028b-4224-977a-558129808e9a",
"timestamp": "2016-07-11T17:52:55Z",
"intent": {
"name": "HelloWorldIntent",
"slots": {}
},
"locale": "en-US"
},
"version": "1.0"
}
Response:
{
"version": "1.0",
"response": {
"outputSpeech": {
"type": "PlainText",
"text": "Hello World!"
},
"card": {
"content": "Hello World!",
"title": "Greeter",
"type": "Simple"
},
"shouldEndSession": true
},
"sessionAttributes": {}
}
Sure you can. In fact, when you are creating your skill in the Alexa Developer Portal, you have that option. The caveat is that you will need to manage your own TLS certificate and will have to make sure that the latency/responsiveness is decent based on the location of your users.
If you would like to explore this further, you can use Amazon's Java code examples. They can be found at: https://github.com/amzn/alexa-skills-kit-java.
You can definitely set up a RESTful service API for use with Alexa.
And, if you set it up in Azure, you don't even need to create your own certificate.
You can use a rest api as the endpoint for alexa skills. The apis will be invoked in the following manner
[Configured_URL]>/**alexa/[intent]**
Where [Configured_URL] - is the url endpoint configured in amazon site for invoking
[intent] - is the name of the intent
You should host your service accordingly
https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/developing-an-alexa-skill-as-a-web-service
https://iwritecrappycode.wordpress.com/2016/04/01/create-an-alexa-skill-in-node-js-and-hosting-it-on-heroku/