question

Narges avatar image
Narges asked

How to convert a text to json intent request?

I need to convert a text stored in a string to an object of Intent Request (json format). like when i use service simulator and it convert the text into the lambda request. How can I do that?

alexa skills kitservice simulator
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Irina Sergienya avatar image
Irina Sergienya answered

Maybe you can provide an example?

I can't understand why you can't just use the created lambda request from service simulator and just replace your text there. Am I missing something?

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jamie Grossman avatar image
Jamie Grossman answered

Well, the request is just JSON. Unless you write it yourself, you should be able to find a bunch of converters online that will do the job for you.

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Narges avatar image
Narges answered

The reason I want to do this is that I want to have a nested intent. here is an example:

AIntent do this {otherIntent}

BIntent do that

CIntent dont do that

user: Alexa, do this do that

--> it passes the "do that" as a slot for AIntent. Now in my AIntent, I want to convert "do that" to an Intent Request associated with BIntent or CIntent.

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jamie Grossman avatar image
Jamie Grossman answered

You cannot nest intents. Ideally, you should handle this on your backend and have your initial intent run intent 2's code after the required parameters are met. In your case, in your first intent, you can check the passed in slot, see if it is equal to 'do that' and then run intent 2 code.

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.