In a previous article (Developing a Custom Skill for an Alexa Game), we showed you how to build a custom Alexa skill using Backendless and our Amazon Alexa Skill SDK. Now, we are going to show how to make the same game using our Codeless feature – in other words – without any coding!
You can read more about what Codeless is and how it works here.
We previously made a game called Guess My Number that was played using Alexa. We will assume that you are already familiar with previous article, so we will not explain how the logic works but instead will focus on how to implement this logic using Codeless. Also, we assume that you have installed the Amazon Alexa SDK from the Backendless Marketplace in your app.
On the following screenshot, you can see the final look of the API service that we will build during this article.
So, the first function we need to create is the getResponse function. It should accept three optional parameters — speachOutput, reprompt, and shouldEndSession. Go to the functions menu in the Codeless Browser section of Backendless Console and click “Add New”.
Let’s create the same logic as shown in the following screenshots:
Here you can see another custom function that you don’t have yet – getSSMLSpeech. Let’s create it and use it here. Do not forget to save all logic you write by clicking on the green Save button in the top right corner.
Next, we need to create some other handy functions. Replicate the functions below:
(By default, “time to live” is 7200 seconds.)
Note that some functions do not return anything. You can make it by clicking on the gear icon in the top left part of the Function block.
To make it easier to use, we suggest you wrap the Alexa Skill SDK’s verifyRequest function in our custom request. To find “verifyRequest”, use the search box at the top.
And that’s it! We have created all the necessary functions to build our API service. Let’s put it all together.
Go to Browser menu in Codeless section and click `Add New` under the API Services menu.
Now we have an empty service. The first thing we have to do is to verify the request. Then, using the Alexa Skills SDK, obtain intent name and request type, then set result to default response. Next, in the try/catch block, step by step using if/else blocks, check each request with canHandle… functions and if the check passes, set the result to the result of the handle… function. Return the result in the end from the service method.
Now you have complete service without any coding that you may deploy to Backendless and check using one of the Alexa test tools – echosim.io or Test tab in the Amazon Developer Console.
As you can see, it’s pretty easy to build your own custom skills for Alexa with Backendless.
Have fun and Happy Coding!