6. Export the Bot to Alexa Skills Kit

In this step, you will learn how to export the Lex configuration file into a JSON file and use the same file for Alexa skill development.

Export the Bot to Alexa Skills Kit

  1. Go to AWS Lex Console

  2. Click on the Left Arrow on the top left corner

  3. Select your bot and click on Action

  4. Click on Export

  5. Choose the bot version and platform as Alexa Skills Kit(ASK). Click on Export, save the file

  6. Unzip the downloaded file and you will get the .json file. This will be used for Alexa Skill later. You can also export it as Lex format. The exported file can be used to replicate the same bot in another account.

Note: You could use json formatter to convert the file to standard indented json if the file’s original indents is not perfect

Import Lex Intents to Alexa Voice Interface

  1. Go to the Alexa Developer Console

  2. If you don’t already have an account, you will be able to create a new one for free. Note it’s not the same account for amazon.com. Sign in with your developer account

  3. From the Alexa Skills Console select the Create Skill button near the top-right of the list of your Alexa Skills.

  4. Input Skill Name, Personal Banker. This is the name that will be shown in the Alexa Skills Store, and the name your users will refer to. Also change the locale if so desired. Click Next to continue

  5. Select the Custom button for the model to add to your skill and choose Provision your own to host your skill’s backend resources. Select the Create Skill button at the top right.

  6. Choose “Hello World Skill” as the template to start. Click Choose

  7. You can choose to build the Interaction Model for your skill by adding intents, slots and other attributes manually, which we have already done in Lex. So instead, we are going to re-use our Lex intents, slots.

  8. On the left hand navigation panel, under the Interaction Model, select the JSON Editor tab. In the textfield provided, replace code line 5 to 23 with the code in the zip file exported from Lex. Follow the instruction below.

    • Select code line 18 to 30, delete it and replace it with the info below.

    • Open the .json file you export from Lex in a text edit file. Copy the 3 Intents in the ‘Intent’.

    • Paste it back to the Alexa console after line 18.

    • Select the highlighted part below. Copy it.

    • Delete types part and paste the json you copied in the last step here .

    • Input a invocation name personal banker as shown below.

    • If you find it is hard to follow, replace the entire code in the textfield provided with alexa-developer-console-personal-banker.json. Then you can skip subsequent jump to step 7: Create an Alexa Lambda function.

  9. Click on Save Model and then Build Model. You should notice that Intents and Slot Types will auto populate based on the JSON Interaction Model that you have now applied to your skill

Validation & Next step

If your interaction model builds successfully, proceed to the next step. If not, you should see an error. Try to resolve the errors.

In our next step of this lab, we will be creating our Lambda function in the AWS developer console, but keep this browser tab open, because we will be returning here.