# Build Custom App

This step demonstrates step by step process of how you can build custom app in iX Hello that integrates with Salesforce. We'll demonstrate how we can extract contact information from Salesforce account in iX Hello.

Make sure that you've covered all steps of [pre-requisites](https://docs.ixhello.com/ixhc/general/use-cases/contact-finder-with-salesforce/pre-requisites).

1. Create a custom app. Use name of your convenience and use Default as the category.
2. Create a data source. Here, make sure to use the integration connection with Salesforce that you created in the [previous step](https://docs.ixhello.com/ixhc/general/use-cases/contact-finder-with-salesforce/pre-requisites/integrate-salesforce-with-ix-hello).
3. Now, on the method screen, let's create a method that gets contact information from Salesforce.
4. On the Method tab, click on Add New Method and fill in following details.

## Methods

### Method Inputs

| Tab           | Parameter             | Value                                                                               |
| ------------- | --------------------- | ----------------------------------------------------------------------------------- |
| Method Inputs | Method Name           | GetContactMethod                                                                    |
|               | RequestType           | GetSOQLQueryResult                                                                  |
|               | Parameters: SOQLQuery | SELECT Id, FirstName, LastName,Phone FROM Contact WHERE FirstName='{{ContactName}}' |

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FqTkeL4KHEDoPFMyav95t%2Fimage.png?alt=media&#x26;token=86814fa1-4990-4df1-b95e-294238ef3fee" alt=""><figcaption></figcaption></figure>

## Method Output

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FN2ZvZf00rH5vXMVXF8fm%2Fimage.png?alt=media&#x26;token=46dd1944-9d36-4371-a551-ae1ad42f763d" alt=""><figcaption></figcaption></figure>

### Method Result

| Tab           | Parameter                              | Value                                                   |
| ------------- | -------------------------------------- | ------------------------------------------------------- |
| Method Result | Record JsonPath                        | $                                                       |
|               | Valid Result Template                  | {{Records}} How else can I help you?                    |
|               | Record Template                        | You can contact {{FirstName}}-{{LastName}} on {{Phone}} |
|               | Empty Result Template                  | How else can I help you?                                |
|               | Automatically prompt for next question | True                                                    |

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2F8myQ74UQQT5LkZISnTZw%2Fimage.png?alt=media&#x26;token=f46a6cd2-ad4d-4f2c-b449-0f8593ffc4f3" alt="" width="563"><figcaption></figcaption></figure>

Click on Save and Test. It saves the method as well as allows you to test if the method is working correctly.

To test this method, you can provide the first name of the contact you created in Salesforce in[ previous step](https://docs.ixhello.com/ixhc/general/use-cases/contact-finder-with-salesforce/pre-requisites/an-active-salesforce-account).

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FTsJNCUKkrU46q7TXILvQ%2Fimage.png?alt=media&#x26;token=1d365b49-0b8e-4474-99d0-2bab74cc6a70" alt="" width="563"><figcaption></figcaption></figure>

Provide the parameter contact name. Then, click on Method Test, if the provided name exists in Salesforce, the result shall be displayed in Object tab. To view how the app will respond , go to Result tab and click on Results Test.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FvmqWEKVxs7Wwb1kdBCxz%2Fimage.png?alt=media&#x26;token=ae388f98-f994-44da-a9af-be1cd777dee4" alt="" width="563"><figcaption></figcaption></figure>

You've now successfully created and tested a method that reads contact information from your Salesforce account using SOQL query. Now let's set up other steps.

## Intents

On the Intent tab, click on Add New Intent and fill in following details.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FGlRsRvlRyzgMIPUt0nEc%2Fimage.png?alt=media&#x26;token=f6768418-d196-41ee-8e2d-400ab572d8bf" alt="" width="375"><figcaption></figcaption></figure>

## Slots

Next step is to create slots. Slots are used to read user inputs. In  this case we are creating slot to read firstname parameter from the user.

On the Slots tab, click on Create New Slot.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FnINgc0I4LoCt04hblU5e%2Fimage.png?alt=media&#x26;token=7528b879-44d9-4b86-adf9-c45bd6760b36" 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%2F7RXLNeA1NTvsoX68nhjt%2Fimage.png?alt=media&#x26;token=06011df0-83db-4872-a36d-dbd0b07f09e7" alt="" width="375"><figcaption></figcaption></figure>

## Utterances

Utterance are words spoken to launch specific intents. In the top menu tabs, select “**Utterance**” and select “**Create New Utterance**”. Now input or select the following 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%2F5EDqbRkCyMgh1FqNSxUF%2Fimage.png?alt=media&#x26;token=3794628b-9e24-43e6-a24f-035e971c9606" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2F9uHroXUZ9STb4G9PRGHb%2Fimage.png?alt=media&#x26;token=9058d567-d12c-40e9-9b5b-c82e2db7ea53" alt=""><figcaption></figcaption></figure>

## Input

On the Input tab, click on Create New Input and provide following details.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FZthqzMY9V5YNy91TeyUL%2Fimage.png?alt=media&#x26;token=48e229e7-14a3-412c-8705-41d489c200bd" 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%2FdTjg3bQ5MJxgzhXSX3Rx%2Fimage.png?alt=media&#x26;token=9c6fd058-5719-45b4-bc2d-c0f4268a4924" alt="" width="375"><figcaption></figcaption></figure>

Once the Input is created, let's manage parameters for it. Click on Manage Parameters and then Add New Parameter.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FwzjlitN15bUpSggshQDB%2Fimage.png?alt=media&#x26;token=7b494017-6a79-411e-974b-d7d60f183c4f" 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%2FG5QzkOjIiZg5GcxZY09O%2Fimage.png?alt=media&#x26;token=fbeea3e0-1d03-4521-b734-5f344dfcac6b" alt=""><figcaption></figcaption></figure>

Add a parameter corresponding to the slot we created in previous step. Add following details 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%2FpK6C43UCIE7vUFDAM8f5%2Fimage.png?alt=media&#x26;token=966a5d37-5d03-48a6-96bf-1d31d08c80f3" alt="" width="427"><figcaption></figcaption></figure>

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2F0d9FUFB1Lw5kRttgnij8%2Fimage.png?alt=media&#x26;token=5741dfec-e0fc-4053-8c1b-8b75dcc034ab" alt=""><figcaption></figcaption></figure>

## Publish

Now that we've completed all the set-up processes, let's publish this app to Lex.

On the publish tab, click on Add App Publishing.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FFeAc6aSq38B8vmOvMTBx%2Fimage.png?alt=media&#x26;token=83c0d50a-8047-4b53-a449-cdb7575ac140" alt=""><figcaption></figcaption></figure>

**External App Name**: SalesforceTest. (This will be the name of the app in Lex. Therefore, make it unique and different from the names of your other app in Lex.)

**Skill Type**: Search

**Channel**: Amazon Lex

**Optional**: Replace all placeholder values in all “Message”. Uncheck all the settings shown in the second image below.

**Click**: Save.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FODqRw9i2VIIDRdTRaMdk%2Fimage.png?alt=media&#x26;token=55fe5237-93d0-4347-8ffe-c69c6fca71c0" alt="" width="563"><figcaption></figcaption></figure>

Once the publish profile is ready, click on Action button 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%2Fum0U7zp34c3jInGI7dBS%2Fimage.png?alt=media&#x26;token=719181bd-7577-4012-99ca-3b8ebe233fa3" alt=""><figcaption></figcaption></figure>

On the resulting screen, select the Amazon LWA account you want to publish the app to 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%2FEsV9gXbpSiqs5q10K5ME%2Fimage.png?alt=media&#x26;token=dcb34e4d-9f4b-44be-b869-cae5a90e60ab" alt=""><figcaption></figcaption></figure>

If you do not already have, you can click on Add Amazon Account for LWA and proceed from there.

On successful completion, you'll get a message regarding the status of app deployment. You'll also get a step-by-step progress on the app deployment.

On the resulting screen, ensure that a success message shows for the publishing steps before clicking “**Test Lex**”. If success message not shown, click “**Go Back to App Publishing**” to fix any issue shown in publishing result.

<figure><img src="https://1107164708-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M8XHvUsfyTUFLvToHqD%2Fuploads%2FC3w3JcgkCPrKDxG9eQYR%2Fimage.png?alt=media&#x26;token=c9f9281d-b229-4afa-8006-059dd0a7e2d8" alt="" width="563"><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%2FPuDXIsmd60JnRqwWiJWY%2Fimage.png?alt=media&#x26;token=c196217a-a40e-4046-a97e-5438810c191d" alt=""><figcaption></figcaption></figure>

Congratulations!

You have successfully completed building a SalesForce-Custom App.
