Back at home and inspired from last week! I can’t resist and added some features to my Alexa Skill. At the fly, back from the NAV TechDays 2017 in Antwerp I had some time to think about the interesting session I saw.
First, let me introduce, what I’ve seen, taken and adopted.
During the keynote Vincent Nicolas and Thomas Hejlsberg showed us the power of Cognitive Services. This cool AI technology covers a bunch of interesting things. I believe the highest potential to add value to any modern business software have:
- Vision – the art of image processing algorithms, to categorize, analyses, get information about content and peoples mood from images and videos
- Speech – the power of converting voice into text and understand the content
- Language – the knowledge to translate content into another language
In my very special case, the Amazon Alexa Skill supports a multilingual interface. Unfortunately, almost every content, provided as question or answer must be translated. In my first demo, I have used only the German resources 🙂 for my skill. I know: “What a lazy guy!”
Now it is time to add the Microsoft Translator Service to avoid translation of my Responses, when the user want the content and be “lazier”!
Microsoft Translator Service for Skill Responses
The Microsoft Translator API for text is not so complicated. As prerequisites, you need to add the App to your Azure subscription and get the authentication running. Next step is to add a method to call the service with the right parameters to translate my text. Here is a small snipped of the used Code (right out of the “Danger Zone” for NAV Developers):
How to integrate in the demo skill? I had to add a new Intent. This intent contains a Slot “Language”, use the “LastAnswer” stored in my Alexa Skill Session and call the added Translation Service:
Now my Alexa can repeat the last answer of any Intent into other languages.
Microsoft Graph API
One of the most inspiring sessions was “Creating great APIs” with Anders Larson and Nikola Kukrika. Well, OData and REST are already proved technologies – this sounds not very spectacular – right? So, let’s have a look!
Behind the scenes, Microsoft have added an API calledMicrosoft Graph to the new version of Dynamics 365 Tenerife. Currently the API is available as BETA version. In the future, Microsoft Graph will allow us to access almost every entity in the ERP system. This means, we can read, write, update and delete information with simple http-GET, PUT and POST calls. Furthermore, we can invoke standard Dynamics NAV actions e.g. “Create Invoice” from a “Sales Quote” by using a http-POST request.
The structure of NAV objects is quite simple. We have Entities (e.g. Customers), Sub-Entities (e.g. Sales Lines) and Complex-Types (Address). How a MS Graph API call is built shows the following snippet:
GET …/api/beta/entities[(<ID>)]/[related-entities(<ID>)/…] GET …/api/beta/companies(629259f0-8dbf-445f-a260-ba5b1e02d410)/salesInvoices?$expand=salesInvoiceLines
A NAV Action like Make Invoice can be invoked from the Entity Sales Quote by using a POST call.
Is this everything – No! More, the API can easily be extended by own Entities and Actions. I still can’t wait, until this will be released.
At Friday, we saw the first usage scenario of MS Graph API – the new Business Apps for O365 (coming soon) presented by Ievgenii Korovin, Andreas Moth and Monica Ahuja. Later Nikola told me, its team worked very hard to get this API running for this.
Hands On – Add MS Graph to my Alexa Skill
Enough about the sessions – what benefit can this API add to my skill? This is quite simple, I can avoid extending my Dynamics with Queries and Codeunits. Finally, I can spend more time to get the Skill Intents working and allow Alexa a wider range of covered business cases e.g. “Sales Quotes”, “Item”, “Employees”, …
The first version of the Alexa Skill used a query in an Extension v2, which was registered as the Web Service to get information out of the ERP system. Each part needed to be maintained itself, especially when new fields were needed for the Skill.
The new Intents for my Alexa Skill without extending Dynamics NAV are:
- Navigate to an Entity (e.g. Customer, Item, Sales Quote)
- Select a record on selected Entity (First, Next, Previous, Last)
- Invoke an Action on selected Entity (Create Sales Quote, Make Invoice)
Adding this whole improvement took nearly the same time as to implement the former Intent for “Sales Order” without losing functionality e.g. filtering. Furthermore, now I have the possibility, to create Entities (Sales Quotes for Customers) and invoke actions (Make Invoice).
Ready for the next Level
Cognitive Services powered by Artificial Intelligence and the modern, extendable API Microsoft Graph for the ERP system Dynamics 365 were used in different ways to improve my Alexa Skill. This small example shows, how it is possible to connect different systems and use some of the latest available technologies. The strengths of each single part of the puzzle helps to achieve more for the whole solution. This demonstrate the … #Power-of-Combination
Now I’m looking forward to the Microsoft Dynamics 365 Hackathon 2.0 in Munich. We’ll see what inspire me next…