My quick attempt at programming an Alexa skill to send 2 person codes.
Getting an Alexa skill "certified" by Amazon can be tricky because they are very picky about how skills interact with the user. They have a very specific "voice style guide" you must follow to pass their certification. So, I wanted to make sure my idea of sending "codes" to Alexa would pass their process .
For my test, I created a new command for the "Ask Magic History skill" to reply with a "random card" It does that, but it also includes a secret two person code in which you can tell Alexa what "random" card you would like returned. (F.Y.I. Alexa can already select a random playing card for you without any skill enabled. Just ask "Alexa, give me a random playing card.")
Here are the basics of my "random card" Alexa skill.
* To really get a random card:
Magician: Alexa, ask Magic History to select a random card for me
Alexa: three of clubs
Magician: Alexa, ask Magic History to select a random card for me
Alexa: eight of spades
* To tell Alexa to send a specific card using a secret code (As mentioned earlier, loosely based on Harry Lorayne's "Codecto"):
Magician: Alexa, ask Magic History to name a playing card for me
Alexa: nine of hearts
Magician: Alexa, ask Magic History to name a playing card for me
Alexa: nine of hearts
Magician: Alexa, ask Magic History to choose a random playing card
Alexa: ace of spades
Magician: Alexa, ask Magic History to select a random card
Alexa: king of diamonds
Warning: You sometimes need to speak slowly and pause between each word (working on ways to fix this).
You can probably figure out the basics here, but contact me if you have the skill enabled and want to know the full code to get any card.
I submitted this initial version to Amazon and it got "certified"!!
This may have gotten through easier because it's an update to an existing skill, rather then a new one. I did find some problems, so an update is currently going through certification again now.
Programming a skill in Alexa to use the "2 person code" was a bit difficult, because I think Amazon uses "fuzzy logic" to parse what the user says in order to determine what routine in your program to call. Also, I could not find a way to get back the "exact phrase" the user said. Only parts of the phrase I specifically identified before hand. This may have been complicated a bit by all the other commands I've created in the skill. It may be a bit easier if this skill was only doing this one thing
This was just a basic test to see how hard it would be. But, I think I can use this skill "as is" since I don't believe users will notice the slightly different phrasings. Users are probably already used to Alexa being smart enough to typically figure out how to respond even though you say things slightly different each time.
But, now that I have the basics for sending/receiving a 2 person code with Alexa, it would seem to open up some possibilities. Obviously, it would be better to send the code to Alexa in a command prior to revealing the answer. But It's fairly easy to save information during a "session" and respond with that information later. I've already done that with other skills.
If you have any specific ideas, let me know!
I had fun and learned quite a bit doing this.
For more info on the "Ask Magic History" Alexa skill see:
http://geniimagazine.com/wiki/index.php ... ic_HistoryTo get notified when "Ask Magic History" updates with new functions, follow "MagicPedia" on twitter.