Open jlguinn opened 7 years ago
Definitely. I think this belongs here, appreciate a PR.
Thanks. Is that something I would do? I'm eager to get involved but a bit of a noob.
Give it a try! See https://github.com/alexa-js/alexa-app/blob/master/CONTRIBUTING.md.
I'll take a stab. I created the fork and now it looks like I have some tuts to catch up on writing tests, but this seems like a good spot for me to get started. Thanks for the link.
I'll add another related case. Only certain characters are allowed to be spoken within SSML responses, and if invalid characters are passed it errors the response. I've run into a number of times when pulling data from other APIs that include user input.
As a (very) rough illustration, I've been using the following RegEx/JavaScript blacklist to filter out some bad characters. It might be worth it to automatically clean the SSML code to make sure it will be valid, perhaps with a good whitelist.
It would likely be optional or a secondary function such as .validatedSay()
, given there are a variety of ways to either substitute or remove the text. Would maybe be best as an add-on library even.
Example:
text = (text || '').replace(/[^\w\s/<>.,-"']/gi, '').replace('&', 'and').replace('=', 'equals').replace('@', 'at');
Not sure if this belongs here or in alexa-app-server.
I spent the last three and a half weeks discovering/troubleshooting the 24k response size limit. Could warnings be thrown in the console so developers would have some clue that the same code will fail on an Alexa device?
https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-interface-reference
Response Format
This section documents the format of the response that your service returns. The service for an Alexa skill must send its response in JSON format.
Note the following size limitations for the response:
outputSpeech
response cannot exceed 8000 characters.card
cannot exceed 8000 characters. This includes thetitle
,content
,text
, and image URLs.smallImageUrl
orlargeImageUrl
) cannot exceed 2000 characters.token
included in anaudioItem.stream
for theAudioPlayer.Play
directive cannot exceed 1024 characters.url
included in anaudioItem.stream
for theAudioPlayer.Play
directive cannot exceed 8000 characters.If your response exceeds these limits, the Alexa service returns an error.