Fireworks from Sber in Yandex.Cloud





In September 2020, Sberbank simply renamed itself Sberbank (the so-called rebranding), and, to celebrate, launched its own platform of voice assistants called Salyut . A feature of Salut is the presence of three voice assistants at once for the choice of users: Sber - a man, the style of addressing "you", Athena - a woman, also addresses "you", and Joy - a girl with a friendly "you".



Sberbank (the bank, not its namesake - a voice assistant) opened this platform for third-party developers, inviting them to make applications for it, the so-called. smartups - an analogue of the skills of Alice's voice assistant, and establishing a competition for them with a very generous prize fund. In this tutorial, we will look at how to make a smart-up on Node.js , place its code in Yandex.Cloud (using functions), and, finally, create a project in Salyut , go through moderation there, and publish our smart-up so that it becomes public.



And we will do a smart-up under the code name "Smart Thoughts" . My favorite topic since this is the third article. Before that there were: Alice acquires a skill (about "Smart Thoughts" for Alice ), and Building a Telegram bot in Yandex.Cloud (about creating @SmartThoughtsBot - a bot with the same mundane name). So here's the plan for today:



  1. , . .
  2. ., — .. serverless.
  3. SmartApp Studio — - , , — .
  4. , — .. .
  5. , . . , .


1.



Clone the GitHub repository , go to the root of the project, and install the dependencies as shown below:



Required software
, (.. ) Node.js ( 10), npm ( Node.js) Git. - — , . , . Visual Studio Code.



git clone https://github.com/stmike/smart-thoughts-salute.git





cd smart-thoughts-salute





npm install







The code for this smartup is written using the open SmartApp API and the Yandex Cloud Functions specification , which I am sure you will want to get acquainted with. After deployment, something like this this project will look like for you.



Smartup code



Note that the code is riddled with comments like Sumerian cuneiform tablets. I think that it is more convenient to read various explanations in the context of the code than to look at the code and the text of the article one by one. Make some changes to the project, for example, to the file / src / lexicon-formal - where the phrases of the smartup with the address to "you" for Sberbank and Athens are collected , or to the file / src / lexicon-unformal - where the phrases with the reference to " you "for Joy... After that, create a ZIP archive and include: the index.js file , the src files directory, and the node_modules directory . We will soon upload this archive to Yandex.Cloud.



2. Yandex.Cloud



Go to Yandex.Cloud. If you are not yet familiar with it, follow the instructions there to create your billing account and other initial settings. In my article Alice in the country of Bitrix, I have already dealt with all this in detail, therefore, in order not to repeat myself here, I refer readers who need more information on this topic to this article. So, in Yandex.Cloud, select the Cloud functions on the left in the menu , and click the Create function button . The function creation page will open.



Function creation



Fill in the Name and Description fields and click on the Create button . The New Function Wizard will now start.



Language selection



Select Node.js 10thversion, and also uncheck the Add files with code examples checkbox . Click the Continue button .



Filling in function fields



In this step of the wizard, select the options and fill in the fields shown in the screenshot as follows:



  1. Select the ZIP archive tab .
  2. Click the Select file button, and select the ZIP archive with our smartup that we recently created on your local machine .
  3. In the Entry Point field, enter index.skill . Here index stands for the filename and skill is the name of the module in our index file .
  4. 7, 7 ( — 3 ).
  5. .


In a few seconds, a new function will be generated and you will be taken to the Overview page .



New function created



Here you need to turn on the Public function switch to ON , i.e. make it so that Salute can call her without any problems. Keep the link for the call and the function identifier secret, since anyone can call the public function, and you will pay. Write down the Calling Link on your cuff - we will need it very soon.



3. Creation of a project for Salut



Salut projects are created using SmartApp Studio .

Enter this studio if you already have a Sber ID , or register otherwise. Registration is a trivial process, we will not dwell on this. But I will note an important feature: it is carried out using a Russian mobile phone number, and if you do not have this (Russian number, mobile phone, or none of the above), registration, as I understand it, will not work. We entered. In my account, we see the already created and so far the only smart-up, the code and method of creating which I am sharing with you here today. Button Explore Documentation



Login to Smartup Studio with Sber ID



you will probably need it first, but for the purposes of this article, we will still click on Create Smartup now .



List of smartups



The image shows that under the name of the smartup there are inscriptions Webhook and Launched . The first inscription says that our application is running on a third-party service (we have it Yandex.Cloud ), and the second - that the application has been published (I would have written it instead of "Launched"). Let's move on to creating our own smartup. Enter the name (you cannot duplicate, so choose your own, for example, "Wise Phrases"). Then select the Chat App (yes, there is also a Canvas App type and the plans, apparently, a Native App , but today we will be doing it withChat App , as it is easier to manufacture, and read about the other types in the documentation ).



Choosing the type of smartup



Then, in the Select tool section of the page , select There is a ready-made application (and this is absolutely true), and in the Webhook field , insert the Link to call our function in Yandex.Cloud , which you recently recorded on your cuff.



Webhook input



And finally, click on the Create smart-up button , after which a new project will be generated, and on the Settings pageyou should see something similar to the one below. Add a description, fill in other fields, and feel free to send your new smartup for moderation. But know: if they do not accept it because of the same type with the existing application, I refuse to bear any responsibility for this. However, in any case - whether they will accept it or not, whether you submitted a smartup for moderation or not - your own smartup will already work in your account from that moment on! But more on that below.



Moderation



Please also note that there is a badge soon at the top of the Catalog tab... If you try to place the icon and screenshots of the smartup, nothing will work. When I submitted my smart-up for moderation in the first half of November 2020, after it was accepted, an employee (perhaps this is also a moderator rolled into one) asked me to send an icon by mail, but did not say anything for the screenshots. But he said that soon this state of affairs will change, and everything will work fully. We'll hope.



Smartup catalog



4. Testing



It's time to test our smartup in action. Install the SBER Salute mobile application for Android or SBER Salute for iOS . This application is mainly intended to control the SberBox set-top box , but even without a set-top box, it can fully communicate with voice assistants and run third-party smart-phones. To do this, open the SBER Salute application on your smartphone , log in with your SBER ID - exactly the ID under which you are logged into SmartApp Studio ! Click at the bottom on the round icon symbolizing the voice assistant and listen to his greeting ( Sber is selected as the default assistant there.). Then say "Turn on ..." or "Start ..." and say the name you gave your smartup. I repeat: you can test your unpublished smart-ups if the Sber ID with which you entered the SBER Salyut mobile application is the same as the Sber ID with which you entered SmartApp Studio when you created your smart-up. If you haven't created anything of your own yet, but you already want to see what the program code that is offered to you here actually produces, tell the assistant: "Turn on Smart Thoughts." This will launch a simple smartup that will allow you to chat a little with it. Please note that in Saluteit is not necessary to say the words "smartup" or "skill", as is necessary when communicating with Alice, for example: "Turn on smartup Smart Thoughts", or "Run the skill Smart Thoughts." These words can be omitted here, which makes communication with the voice assistant more natural and therefore pleasant.



Clever thoughts launched



When you have a little chat with Sberbank (assistant), say: "Call Athena." And then: "Call Joy." Make sure that each of them has a different style of communication: some - for "you", and some - for "you". This means that your smartup (or Clever Thoughts ) correctly processes this "feature" of Saluta .



5. Conclusion



It is obvious (at least to me) that the Salyut platform is still in childhood or, at best, adolescence. If we compare the same Clever Thoughts - here and Alice's - Alice will be "cooler" - there is also music and pictures. All this is not available in Salute . They say that for now. And this seems to be true - with great energy and pressure they took up voice assistants! In addition, Salyut provides unusually active and operational support for independent developers - often just in real time in the SmartApp Studio Community & Support Telegram channel . I suspect that Sberbank(the bank) set a goal to become number one in the market niche of voice assistants in the very near future in Russia. Therefore, if you understand what the so-called. "Windows of opportunity" and a little adventurous in nature - you can connect to the process. Working for Salute is still difficult, but already real.



That's all for today. More materials follow. Whoever is interested in reading this - subscribe to notifications about new publications. You can subscribe on this site (the Subscribe button below), or on the Telegram- channel IT Tutorial Zakhar , or on the community of the same name on VK , or Twitter @mikezaharov .



All Articles