Message:

Subscribe rss
Blog categories
All | Backendless features
Developing an Alexa skill without writing any code – Part 2 (Intents and Slots)
December 21, 2017 by markpiller

This is Part 2 of the article about developing an Amazon Alexa skill without any coding. In Part 1 you learned the following:

  • How to create a Codeless API Service responsible for handling Amazon Alexa requests. The service completely removes the need for adding AWS Lambda functions, it also runs without any cost in the free plan of Backendless.
  • How to use the Backendless SDK for Alexa to send a response back to Alexa from a custom skill.
  • How to create a basic Alexa Skill and test it from the Amazon developer console.
  • How to invoke the skill on Alexa, process the invocation in your Codeless Backendless API service and get a response back on Alexa.

In this part of the article, you will learn the following:

  • Creating voice interaction model with “slots” – special placeholders for the “dynamic” parts of the requests for your skill
  • Processing slots in the Codeless API service in Backendless.
  • Executing codeless logic to do something useful and generate a meaningful response.

It is recommended (more like required) to go through Part 1 just so you have the basic environment setup. Also, make sure to watch the “Developing an Alexa Skill without any coding” video which shows the entire process in action.

Interaction Model Slots

  1. To get started, login to your Amazon Developer Portal account. Locate the skill you created in Part 1 and click the “edit” link.
  2. Click the “+ Add” button next the Intents menu to create a new custom intent.
  3. Type in Table and click the Create custom intent button.
    creating new custom intent - Developing an Alexa skill without writing any code – Part 2 (Intents and Slots)
  4. Add the following sample utterances:

    The word in the parenthesis is the slot name –  "TableName". So what is a slot? From the video, you might remember I was asking Alexa:

    “how many objects are in the Users table”

    The name of the table here is a dynamic part, I could have asked about the Person table or any other table for that matter. Slots in the intent schema is what makes it possible. Think about slots as the arguments for an intent.

  5. As you entered the utterances listed in the previous step, the TableName slot is automatically created:
    tablename slot alexa - Developing an Alexa skill without writing any code – Part 2 (Intents and Slots)
  6. A slot must have a slot type. Think about it as a “dictionary” of all the words which can be put into the slot in the sample utterances. In my demo the slot may have the names of some data tables such Users, Person, Order, etc. To define these we should create a custom slot type. To do that, click the “+ Add” button next to the Slot Types menu:
    adding slot type - Developing an Alexa skill without writing any code – Part 2 (Intents and Slots)
  7. Enter BackendlessTable  for the custom slot type name and click the Create custom slot type button.
    backendlesstable custom slot type - Developing an Alexa skill without writing any code – Part 2 (Intents and Slots)
  8. Enter the following values as the slot values:

  9. Once the slot type values are added, return to the TableName slot definition and select the newly created slot type:
    slottype in slot definition - Developing an Alexa skill without writing any code – Part 2 (Intents and Slots)
  10. Click the Save Model button and then the Build Model button at the top of the screen. The next step is to add the logic for processing the requests on the Backendless side.

API Service for the Alexa Skill

  1.  In part 1 you already created a basic service for the Alexa skill. The service returned a constant string value. The logic to handle a request with dynamic parts (slots) is quite different. To locate the existing method, expand the AlexaService  node and click the handleRequest  method:
    handle request method - Developing an Alexa skill without writing any code – Part 2 (Intents and Slots)
  2. Remove any codeless blocks you already had in the method as you’d be starting with a blank logic. Compose the logic as shown below. Make sure to use the blocks from the AlexaUtils service, which contains the functionality provided by the Backendless SDK for Alexa:
    alexa skill codeless complete - Developing an Alexa skill without writing any code – Part 2 (Intents and Slots)
  3. Click the DEPLOY MODEL button when you are done. Once the service is deployed, you can test your Amazon Alexa skill. To do this, simply ask:

    where super demo  is the skills’ invocation name configured in Amazon Developer Portal (see the Information section)

Happy Codeless Coding!

Share this post
Tweet about this on TwitterShare on FacebookGoogle+