# App Templates

## **Objective**

This document will help you to create an App using an App Template for Amazon Lex using the iX Hello platform.

Before setting up a custom app, you should have Amazon, Lex, and iX Hello accounts. For steps to create these accounts, click [here](https://docs.ixhello.com/ixhc/channels/amazon/create-amazon-developer-account), [here](https://docs.ixhello.com/ixhc/apps/lex-publishing-auto-manual), and [here](https://docs.ixhello.com/ixhc/general/ix-hello-create-account-original) respectively. Next, you need to have you Amazon security profile setup. For detailed steps to do this, click [here](https://docs.ixhello.com/ixhc/apps/lex-publishing-auto-manual).

## **Steps**

1. Import App template
2. Publish App to Lex
3. Activate app
4. Test the app

## **Import App Template**

Download the following template file content, copy and it in notepad and save as a JSON file.

{% file src="<https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FDN5Xs3qOKWDMSWDlHuDU%2FContact%20finder%20Rest%20API%20template.json?alt=media&token=714017b1-b6a8-460a-a1fe-cf0b78fca163>" %}

<div align="left"><figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FycM6RX6AXh0x5NPhDtvk%2Fimage.png?alt=media&#x26;token=11c03ba3-79fd-438b-94fe-4ea1ca3824c8" alt="" width="563"><figcaption></figcaption></figure></div>

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FaEA66fHVpeJkInNUfhQn%2Fimage.png?alt=media&#x26;token=29fe491f-1c93-481b-87dc-ce6db20aa741" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FGa8xeOd76N7C3BdiqrAU%2Fimage.png?alt=media&#x26;token=f9252149-02ff-47b8-841a-ebbcece3937f" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FXqrVN8zQxY8jm4xaSEnG%2Fimage.png?alt=media&#x26;token=0d0dd858-96bf-4228-aeda-aa5757a080f7" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2F45W7q7nezlIiaTMv7BAY%2Fimage.png?alt=media&#x26;token=1406a638-8556-4c03-9ea4-888525c78e1b" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2Fxz90OAvXxF5Qr1AHV06B%2Fimage.png?alt=media&#x26;token=a70b9b99-adf7-4e3e-b10c-3fc4474e7f60" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FSZBdI6pGT4tpbncGUO4J%2Fimage.png?alt=media&#x26;token=9cc12e6d-93db-4036-9a9c-cc4c22fcf0e3" alt=""><figcaption></figcaption></figure>

1. Download the following template file content, copy and it in notepad and save as a JSON file.

{% file src="<https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FZqQsF7emIUNOzB3a0BuW%2FContact%20finder%20Rest%20API%20template.json?alt=media&token=bcbc683c-8943-436a-a798-099991d02fb8>" %}

2. On the left panel, open **Apps**, then **App Templates**, and select **Import Templates**.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FLIsKIQS3IOeDj2kS3Cag%2FappImport2.png?alt=media&#x26;token=ebcf79ec-36d5-4d90-9c63-4fb607254d62" alt=""><figcaption></figcaption></figure>

3. Import the downloaded template from Step 1 above. Provide a **Template Name** and click on **Save**.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FhKE48GLvRIYTDZpGEMjr%2FimportRetailjson.png?alt=media&#x26;token=7613a9f1-b646-4c2a-8ffc-ad659cd27db2" alt=""><figcaption></figcaption></figure>

4. After the template has been successfully imported, you can see it under Apps > App Templates.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2F5ZqLAeF3gJwVdWJDbLjA%2FRemoveName22.png?alt=media&#x26;token=bb415cd6-590f-43b1-9511-f52dd4d26ab3" alt=""><figcaption></figcaption></figure>

5. On the new row, click on **Create App** to create the new App from the imported template.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FYPg3XhrLQsF4hUX3VE90%2FCreateRetailApp.png?alt=media&#x26;token=e366ef96-e6d4-4912-a602-9ce42fcf5bd8" alt=""><figcaption></figcaption></figure>

6. Fill in **App Name**, a short description of the app (optional), and click on **Create App**. The Selected Template field is already populated.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FODrp5qoKKi9ndNK8VE3j%2Frestoredtemplate.png?alt=media&#x26;token=3b242b6e-75ad-47d3-98f0-5b00b323980d" alt=""><figcaption></figcaption></figure>

7. You can expect following message after successful app creation. Close the Success window.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FyPGlcCNHapAmCgxb7O90%2FAppSuccess2.png?alt=media&#x26;token=689058ba-40a3-4fe9-85ad-53a94fdb8b8e" alt=""><figcaption></figcaption></figure>

8. Click on **View App** at the top of the page. A list of the Custom Apps will appear. Open the newly created App by clicking on the Name.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2F7RTNzpm2we6dxc3lXt1S%2FNewREtailAppCreated.png?alt=media&#x26;token=2b87cd36-5e31-42bb-ba38-44e385dd0ea3" alt=""><figcaption></figcaption></figure>

## **Publish App to Lex**

1. Go to the Publish Tab. You can now publish the App to multiple iX Hello supported channels. Here, we are going to publish the app to Amazon Lex.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FDzRlUebN9z5ZI2sOOB7J%2FremoveName.png?alt=media&#x26;token=fa72073d-fda8-42c3-926a-da5bddbebeb8" alt=""><figcaption></figcaption></figure>

2. Select the Amazon LWA account to publish the app and click on **Publish to Lex.**

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FcBxqbJJjveJGs9UnibVU%2FPublishtoAlexa2.png?alt=media&#x26;token=194ebd5c-2b77-448a-aa97-e53feaf23fdf" alt=""><figcaption></figcaption></figure>

3. The following success message shall appear.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2Fho22mejXRz0vcD9NihxE%2Fimage.png?alt=media&#x26;token=c49316cd-9ec9-4021-89a0-8cd721df51d7" alt=""><figcaption></figcaption></figure>

4. Select the Amazon LWA account to publish the app and click on ‘Publish to Lex’.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FNq9w0Bmtqw7lAfGWdwH8%2Fimage.png?alt=media&#x26;token=44c548ba-5a3f-48cc-8069-d574f2753975" alt=""><figcaption></figcaption></figure>

<div align="left"><figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FqejUJhAs1nGxkg1DqwqJ%2Fimage.png?alt=media&#x26;token=f8288246-0a16-486c-aba3-1b4cf1aa2a98" alt="" width="563"><figcaption></figcaption></figure></div>

5. Click on Go to Lex app in Step 11 or Login to “developer.amazon.com” and choose the link “Lex”.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2Fn80Xx0WxUefmZYQEsODZ%2Fimage.png?alt=media&#x26;token=5289efdb-75cc-4a99-8ea3-3cf55b4bc18f" alt=""><figcaption></figcaption></figure>

Once clicked on "**Test Lex Bot**", you will be redirected to App Publishing screen, and the Test Bot will appear at the right corner showing the App name along with the welcome message:

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2F4pbDdbZw0vWO3PzhVBhE%2Fimage.png?alt=media&#x26;token=449ef943-e16f-43a8-856c-2d7f4e7bedbb" alt=""><figcaption></figcaption></figure>

Query the bot with the Utterance "Find contact for person" and then provide the contact-name of whom you would like to see the phone number, for ex: type Leanne Graham. Bot will provide the response with the full name and the phone number.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2F4FJi1wVOYHUcnN4bUrTv%2Fimage.png?alt=media&#x26;token=8cf3062c-0c02-43db-9b32-68dfd79ae8e6" alt=""><figcaption></figcaption></figure>

Congratulations!

You have successfully completed Publishing an app using App Templates on Lex.
