So with a recent office purchase of an Amazon Echo, I decided to take on the development of an interactive program that could be invoked via Alexa. The program would tell anyone who asks Alexa who is currently, or is going to be, out of the the office in the coming weeks.
Custom Alexa commands are known as skills. They are invoked by a series of trigger words that allow Alexa to map the request to a skill, potentially passing parameters from the request to that skill. For example, if a user says: "Alexa, ask Bob's Motors for today's bargains".
"Alexa" triggers the speech recognition. "ask" tells Alexa it is about to be told the name of a skill to invoke then the rest of the command identifies the parameters to pass to the skill which in the above case would be today as a date (more on this in a minute) and "bargains".
Therefore, the first step was to create an Alexa skill that could be used to find out who was on holiday. The standard use should return which colleagues are away on the current date. We can then allow further options of asking for a different date or date range.
Using the amazon developer console and knowing that my endpoint required a date range to check for holidays, I created an intent using the interaction builder. The interaction builder receives phrases from the user that contains the date range.
For example, a colleague saying "Alexa, ask Rock Solid Holidays who's away this week" would trigger the skill. The intent would select "this week" as the date range and pass it onto the endpoint. This also allows the program to be called without a date range, enabling the phrase to be shortened by defaulting to return the holidays for the current day.
I wanted to keep the full phrase as short as possible to reduce user error when invoking the skill. I settled on "Alexa, Ask rock solid holidays who's away" with a few variations to allow for different ways of invoking the date intent. This allows the adding of the additional parameter of a date range such as “tomorrow” or “this week” to the end of the phrase, if the user wants the holidays for a range other than the current day.
It may be possible to expand the skill’s use in the future to allow for public use. But that would require some form of account linking to obtain the HR API info relevant to the user. All in all, the skill fulfils its purpose and is a great addition to the office!
More information on the specific formats that can be passed as an intent are shown on the Amazon developer site
In order to activate the skill through Alexa, the skill has to be invoked using one of the supported phrases to begin a conversation.