How Does Google Assistant Development Differ From Amazon Alexa
By SG Digital on 2/12/2018
These apps consume knowledge-bases via custom RESTful services (known as endpoints). In this post I will outline the key differences between Google Assistant and Alexa app development, which I hope you find useful!
If you have any questions about Digital Assistant and Smart App development then please get in touch.
Request and Response Shapes
As you would expect, Request and Response Json data shapes (sent to and from your endpoints) are different between DialogFlow and Amazon. Plan for this by incorporating a mapping layer in your software to map onto a common object model before processing the requests.
Male and Female Voices on Alexa
Out of the box, you can only use a female voice for your Alexa digital assistant - something which caught me out when I wrote a male agent for Google and then ported to Alexa, only to find I had to change its sex! You can however use a Text to Speech AWS service called Polly, and wrap your responses in structured speech markup language (SSML), specifying a Polly voice to use.
User Utterances and Intent Selection Confidence Scores
With each request passed to your endpoint, DialogFlow provide what the user has spoken (user 'utterance') together with how confident they are on their selection of intent. The confidence score ranges from 0 to 1 (1 being the most confident). These two pieces of information can be used to perform extra enhanced NLP checking in your own logic i.e. you can apply logic to challenge and maybe reduce the confidence score before you provide your response. Unfortunately Amazon do not provide this information in Alexa requests so you are at the mercy of their NLP.
DialogFlow has an inbuilt concept of context, allowing you to easily interpret user utterances within the context of the current conversation. If you want this power with Alexa then you are going to have to code your own.
Alexa has a concept of required slots, together with prompts to ask users to provide the relevant information to fill them, however, you are going to have to code your endpoint to check for missing slot parameters and prompt Alexa to enter into dialog with the user. None of this with DialogFlow! You can specify required slots and prompts and DialogFlow does the rest, only calling your endpoint once it has all the required information. You can also delegate slot filling to your endpoint should you choose, so the best of both worlds!
In DialogFlow for Google Assistant, you have the option on an intent by intent basis to provide your answer using a custom endpoint, or from within DialogFlow. With Alexa you have no choice, all answers must be provided via your endpoint. In reality this means you have to do some coding if you want to write an Alexa skill, whereas with Google you can in theory write an app with zero coding.
Within DialogFlow you can handle some of the 'standard' intents such as Welcome, Default Fallback, Cancel, Stop etc without code. In Alexa, all these have to be catered for within your endpoint.
The endpoint you provide for your digital assistant app has to be served over https for both Google Assistant and Alexa apps, but that is where the similarities end. Amazon expect your endpoint to do a LOT of security checks to determine the request is definitely from them, which makes for some quite complex coding (if using say c#). Definitely not something for beginners I'm afraid!
Intent Naming Convention
Alexa Intent names can only contain the letters A-Z and a-z only, together with underscores. If you plan to keep your intents common across DialogFlow and Alexa then keep this in mind when choosing your naming convention.
One of the key features of DialogFlow for the Google Assistant is the ability to 'chain' Intents together to build quite complex conversational interactions. You might have your agent ask a question, and then branch to another question depending on their answer to the first. This is very difficult to achieve with Alexa, and forget using a GUI, this all has to be done in your endpoint code.
DialogFlow Export for Alexa
DialogFlow offer an 'integration' for Alexa, but in my experience its not worth using. Instead I would write your own code to query the DialogFlow API and build the Alexa app Json. This proves invaluable if you plan to keep the two digital assistant platforms in step. Allow enough time in your sprints to write this integration, mine took 3 - 4 weeks to code, but will save time in the long run.
You Say Google, I Say Alexa
And there you have it! These are the main differences I encountered between Alexa and Google Assistant app development.