How to build an Alexa Skill With Xenioo (Part 2)

voice chatbots

In our previous post, we’ve explored the basic concepts behind the creation of a fully functional Alexa skill with Xenioo.

In this second part, we’re going to delve deeper in other parts of advanced skill creation approaching. We will see topics like streaming, state management, and live publishing.

Playing audio

Sending audio to an Alexa device can be done in two ways. You either send a small sample, like a sound effect, or you send a longer and more complex streaming source.

The two options are not mutually exclusive but work very differently.

To send a small sample you can just add an Audio Action to your chatbot specifying the source file.

Leave all fields empty (as there’s no need for any additional information) and check the “Embed in speech encoding if available”.
This way Xenioo will automatically create an SSML audio message with your mp3.

If your audio is long (like for example a song or a podcast) and you also want to give the user the ability to pause, skip ahead or stop you have to go for the second option: audio streaming.

Epicentric is a full streaming platform supporting complex playlists and effects and so playing simple audio wasn’t enough for us.

Streaming your audio

To enable streaming you have first to let Alexa know that your skill will use the Audio Player interface.

This is done by enabling the interface inside the Alexa Developer Console.

alexa skill audio player

As soon as you enable this interface, you’ll notice that your intents are automatically expanded to support standard playlist navigation: play, previous, next, stop and pause.

alexa skill chatbot intents

All of these intents are managed directly using Xenioo AI: just match each intent with the built-in Alexa intent key like we’ve seen in our previous post and Xenioo will automatically build the correct model to manage your player.

If you are building a multi-language skill, make sure to clone all intents in each language you want.

Xenioo will then automatically build an Alexa model for each language.

Working with Alexa States

Another important aspect of working with Alexa audio is responding to state changes during streaming.

Alexa will not only let you know that the audio has started but also when it is nearly finished and when it’s over. When the user stops or pause Alexa will let you know at exactly what position it was stopped and if the playlist needs to be set, renewed or cleared.

All of these events are automatically managed by Xenioo and redirect to your flow so that your chat can act accordingly. The usual approach is still here: remove all the nuisances from your workflow while keeping you in control of everything.

alexa skill chatbot flow

The key actions here are the Control Device State action and the Device State Switch Action. Both these actions will receive a state change from an Alexa device. They can be used to manage your flow accordingly.

Account Linking

Account Linking describes a set of procedures that can be used to link an Alexa skill to a specific account. For example, your user may be using your Alexa skill only with an active subscription to your service.

Once you’ve set up the account linking procedure for your application, you can use the alexa_account_link_token variable anywhere in your flow to identify (or login using your own API) your user.

Please note that although mainly static, the Alexa user-id value may be subject to sudden changes. Do not rely on this value to uniquely identify a user.

Final Publish

After implementing a full streaming skill with all the features we wanted, we are now ready to go live.

Xenioo is currently passing 100% of the routine security checks done by Amazon services. It is perfectly suitable for hosting your most advanced skills.

Building streaming skill? Want to have your own Podcast skill on Alexa? We already built a complete production-ready template covering all we’ve seen in this post for free!

Just join Xenioo and add it to your chatbots collection!

[wpsr_share_icons icons="whatsapp,facebook,twitter,linkedin,email,pdf" icon_size="40px" share_counter="no" icon_shape="drop"]