Alice Gets Skill

Yandex Alice



This article will focus on Voice User Interface (VUI), and it will also show how you can create an application on Node.js (a skill - in the terminology of the Yandex.Dialogs platform) for Alice’s voice assistant. Using a third-party API, our application will receive quotes from famous people and pass them to Alice, who, in turn, will read them to users. Also, consider one of the few ways to monetize such applications - the creation of a donation button (donation). In general, everyone should be satisfied.



So what are voice interfaces at their core? The fact is that several years ago, technologies reached a level of development at which it became possible to massively use the most natural, natural way of human interaction with a computer - through voice. A number of large IT companies provided the opportunity to develop “voice applications” for third-party developers by creating the appropriate platforms: Alexa (Amazon) , Action on Google , Bixby (Samsung) , Alice (Yandex) . Now these platforms generate a powerful impetus for the widespread dissemination of voice interfaces - from computers and smartphones to household appliances. It seems that in the next few years there will be a radical change in the usual paradigm of human-machine interaction: instead of buttons and toggle switches, all these refrigerators, coffee makers, microwave ovens and irons will be controlled by a human voice.



Today we will focus on Alice, initially oriented towards supporting the Russian language, and already having a very high-quality synthesizer of the human voice. Alice can be called from: Yandex.Browser ; Yandex mobile application with Alice for Android and iOS ; Yandex.Navigator mobile application for Android and iOS ; Yandex.Stations . For skills, Alice has a special catalog where independent developers such as you can publish their applications. And you know, despite the fact that the platform is still in a very young age - Alice is already quite a lot. She literally becomes omnipresent before our eyes! For example, the downloads of the Yandex application with Alice for Android exceeded 100 million, and according to StatCounter , in July 2019, the share of Yandex.Browser in the Russian market amounted to more than 13%. And these are just a couple of examples for illustrative purposes.



Statistics of the share of Yandex.Browser in the Russian market



Therefore, for programmers who keep abreast of innovation, it is time to develop for voice interfaces! Let's start, and we will make a skill that will send requests to the forismatic.com API, extract quotes from the response and the names of their authors, format it all in a suitable form, and send it to Alice. The latter, in turn, (and already without our participation) will pronounce and show these statements to its audience. In addition, we will ask Alice so that for those users who have a screen to display the “ Support the project ” button, when clicked, the user will be redirected to the Yandex.Money service’s page. Thus, people with a good heart and some money can help develop your project.



First, you need to have Node.js installed on your computer with npm , and also (optionally, for testing only) ngrok (also see the spoiler About ngrok below ), and / or you need to have a free or paid ZEIT account (for testing) and deployments; You must also install Now CLI ).



About ngrok
ngrok "breaks the tunnel" from your computer to the Internet, so for the time of testing the local computer becomes a server on the World Wide Web - this is the main convenience and purpose of ngrok . To install ngrok : create a free account on ngrok.com , download the zip archive and unpack it on a local machine, for example, in C: \ Program Files \ ngrok and set the path to this folder in the environment variable path . At the command line or terminal, run the ngrok -v



command to make sure everything works. Then, to associate the local machine with your account in ngrok , we execute the command once: ngrok authtoken YOUR_TOKEN



where YOUR_TOKEN is your unique token that you will find in your ngrok account.



Then on GitHub, clone (or download and then unzip) the alice-tutorial-skill repository, which is an integral part of this article. The code with detailed comments is in the file /api/index.js - you can read it like a musician notes.



After that, enter the directory: cd alice-tutorial-skill



and install the necessary packages: npm install







To test with ngrok :





Ngrok terminal



To deploy or test on ZEIT : on the command line or terminal, in the alice-tutorial-skill directory, run the command: now





Wait a few seconds until the code is uploaded to the server, and then copy the URL in the ZEIT console, and add the path to the api directory (/ api /) at the end of this URL.



Now go to your Yandex account, go to the Yandex.Dialogs console , click the " Create dialogue " tile, and in the pop-up window select the " Skill in Alice " tile, as shown in the screenshot:



Creating a new skill in Alice



In the " Settings " tab, fill in all the necessary fields, and in the " Webhook URL " field, insert the URL generated by ngrok (shown in the example below), or the URL obtained in the ZEIT console (with / api / added at the end):



Webhook



Now go to the Test tab, where you should see something like this:



Testing



That's all, actually! This is exactly how the skill Smart Thoughts published in Alice's catalog is made and works, which you can try. On a smartphone, it will look something like this:



Clever Thoughts



My plans are to write a number of articles on this topic, and the next one will be an article on Alice’s integration with Bitrix24 CRM , which will create commercial skills for placing orders using voice. So, who are interested in subscribing, so as not to miss. And I take my leave of it.



All Articles