1
votes

I'm new to Alexa Skills but meanwhile I've read tons of information and tutorials.

Fortunately, I'm currently able to create my own custom skill (based on PHP) on my own server and it already works using different intents, utterances, slots etc.. Now, I want Alexa to read a list of items (I send via JSON) in PlainText but I can't find any information how to do this.

I assume there are two options (please correct me if I'm wrong):

  1. Sending a JSON answer including one item - Alexa reads this item - the user says e.g. "next" - Alexa requests my server for the next item - my server sends the next JSON answer ... and so on.

  2. Sending a JSON answer including all items in an array - Alexa reads each item one after another.

I'm not sure which solution is possible and how it can be solved. So, can anyone help me on this or point me to some information?

1
Below answer should help you get with next steps... if you are looking for example on getting json data.. this link should help developer.amazon.com/blogs/alexa/post/…Amod Gokhale

1 Answers

5
votes

Both ways are possible and which one to choose depends on what you are listing.

Using AMAZON.NextIntent

If a single list item include item name and some details about it, then reading out it in one go won't be a good user experience. In this case you can use AMAZON.NextIntent to handle users "next" request.

When the user asks for the list, give the first item in your response and keep a track of the item index in response sessionAttributes. You can also set a STATE attribute too, so that you can check this state in AMAZON.NextIntent handler before you give the next item.

"sessionAttributes": {
    "index": 1,
    "STATE": "LIST_ITEMS"
  }

When the user say "next" check whether the state is LIST_ITEMS and based on the index give the next item from your list. And in sessionAttributes increment the index

More on sessionAttributes and Response Parameters here

Now, if your items are just names then you can read it one after the other.

In both these solutions it is always good to use SSML rather than just PlainText. SSML gives you more control on how your response is spoken.

More on SSML here