# Amazon Lambda: iX Hello Integration

### Objective <a href="#toc48572865" id="toc48572865"></a>

This guide will help you to quickly connect to Amazon Lambda and create various methods to execute Lambda functions and get the function output. The purpose is to demonstrate how easy it is to integrate Amazon Lambda to the iX Hello platform.

### Pre-requisites <a href="#toc48572866" id="toc48572866"></a>

* **An active AWS Account**

You should have an active AWS Account. If you do not have it, you can create an AWS account at <https://portal.aws.amazon.com/billing/signup#/start>

*AWS Accounts Include 12 Months of Free Tier Access*

* **At least one Lambda Function**

If you do not have any Lambda function, you can follow this document on how to create a lambda function. Or for detail information, you can run through this [Run a Serverless "Hello, World!"](https://aws.amazon.com/getting-started/hands-on/run-serverless-code/) tutorial.

If you would like to refer to the introduction video of Lambda, you can watch this getting started video at <https://youtu.be/eOBq__h4OJ4>

* **Access Key, Secret access key and AWS Region Name**\
  To be able to connect to Amazon Lambda from the iX Hello platform, one IAM user is required, and user should have permissions to view and execute Amazon Lambda functions. It is recommended to have IAM policy named *AWSLambdaFullAccess* be assigned to the user.

For more information on creating IAM users and assigning policies, refer to the AWS official documentation <https://aws.amazon.com/premiumsupport/knowledge-center/create-access-key/>

You can also refer to the simplified iX Hello documentation at <https://docs.ixhello.com/aws-iam-users>

* **An iX Hello Account**

For steps to create an iX Hello account, follow the steps at <https://docs.ixhello.com/general/ixhello-create-account>

### Steps <a href="#toc48572867" id="toc48572867"></a>

To proceed with these steps, you should have all the pre-requisites satisfied. If you are missing something, please go back and make sure you satisfy all of them. For this particular demo, we strongly suggest that you create a lambda function as guided in this document.

Once done, you are ready to get started using iX Hello platform with Amazon Lambda.

### Step 1 Connect to Amazon Lambda

Login to the iX Hello at  [https://bots.ixhello.com](https://bots.ixhello.com/)

To Configure Lambda, browse to: Integration > Connect System > Add New Connection in the iX Hello platform and select options as shown below.

<figure><img src="/files/SwLiNJyqtBl37QIS8rbl" alt="" width="563"><figcaption></figcaption></figure>

Once you click on “Next” button, you will be redirected to the configuration screen where you need to provide connection information as shown below.

![](/files/Wi57v2IKIeukWjpEjNaQ)

If you do not have this information ready, please refer to the pre-requisites #3

The table below explains each of the inputs shown on this screen.

| Input                 | Information                                                      |
| --------------------- | ---------------------------------------------------------------- |
| Service Instance Name | You can give any value of your choice.                           |
| Consumer Key          | This is your AWS Access key ID                                   |
| Consumer Secret       | This is your AWS Secret access key                               |
| Region                | AWS Region Name. Your Lambda functions should be in this region. |

Fill the required information and click on “Validate and Save Settings” button, this will validate the details and if it is correct, integration will be saved, and you will be redirected to the integrations listing page as shown below.

<figure><img src="/files/U5nWt8WqNVxq1T7vGeuB" alt=""><figcaption></figcaption></figure>

### Step 2 Create an App for Amazon Lambda <a href="#toc48572869" id="toc48572869"></a>

To create a skill, browse to Apps > Custom Apps and click on New Custom App button as shown below.

<figure><img src="/files/goQBY2DOSqan1tdzp9Ta" alt=""><figcaption></figcaption></figure>

You should see a small popup as shown below.

<figure><img src="/files/1MIdG0g3q2V1WBHxCMVH" alt="" width="563"><figcaption></figcaption></figure>

| Input           | Information                            |
| --------------- | -------------------------------------- |
|                 |                                        |
| Name            | You can give any value of your choice. |
| Custom App Type | Select Search                          |
| Category        | Default                                |

Click on save, this will create an app and you should see a screen as shown below,

<figure><img src="/files/vkozRRj6ymwHp5m4NvzN" alt=""><figcaption></figcaption></figure>

This shows that an app is successfully created, and you have various options like setup data sources. This is explained in next step.

### Step 3 Create a Data Source <a href="#toc48572870" id="toc48572870"></a>

To follow this step, make sure you have completed above Step 2. If not, please go back and do it.

A Data Source connects the app with the Lambda integration we did in Step #1. Once you have a skill created, you can go to Data Sources by clicking on “Data Sources” tab.

Now you should see screen as shown below.

<figure><img src="/files/xfVIk6rSpDQNXonN6T7r" alt=""><figcaption></figcaption></figure>

To create a data source, click on ‘Create New Data Source’ button and you should see a popup screen as shown below

<figure><img src="/files/Ct1MxahnXPhDRNpb3hXW" alt="" width="563"><figcaption></figcaption></figure>

Give a name of your choice and make sure you select the Lambda integration that you have created in Step 1 and click on Save.

Once a data source is created, you are ready to start creating various methods.

### Step 4 Create Methods to fetch the data from Amazon Lambda <a href="#toc48572871" id="toc48572871"></a>

To use this step, make sure you have completed previous step. If not go back and complete it.

Methods allows you to execute the Lambda function. To access the methods, click on the “Methods” tab which is next to the “Data Sources” tab.

<figure><img src="/files/01aUEs6JOPSrJRiBtV9r" alt=""><figcaption></figcaption></figure>

As of the publication date of this document, the iX Hello platform supports following Lambda methods,

1. Get Functions
2. Execute Function

Depending on requirement, you will have to use an appropriate method, this document will explain each of these methods with an example.

Let’s start with a use case.

### **Scenario/ Use Case (Contact Finder):** <a href="#toc48572872" id="toc48572872"></a>

You have a Lambda function which takes name as an input, searches for the contact information for the provided name and returns phone number as an output.

You want to find Phone Number of your friend Rose. For this, you can use ExecuteFunction method as explained below.

### Method: ExecuteFunction <a href="#toc48572873" id="toc48572873"></a>

This method requires two parameters as explained below.

#### Parameters: <a href="#toc48572874" id="toc48572874"></a>

| Parameter    | Sample Value                                                                                                          | Info                                       |
| ------------ | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
|              |                                                                                                                       |                                            |
| FunctionName | <p>ContactFinder</p><p>(<em>Select from the drop-down list: the one you created in the prerequisite section)</em></p> | Lambda function name.                      |
| Version      | <p>Select Lambda Function Version.</p><p>The default is $LATEST</p>                                                   | The version of the Lambda Function         |
| Payload      | { "name": "rose" }                                                                                                    | Input parameter(s) for the Lambda Function |

Other than these two parameters, you need to provide the following standard inputs

| Parameter             | Info                                                                                                                                                                                                                                                                                                                                                                                                                           |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|                       |                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Method Name           | <p>ExecuteMethod</p><p>You can give any name. This name will be displayed in the methods list.</p>                                                                                                                                                                                                                                                                                                                             |
| Request Type          | <p><strong>ExecuteMethod</strong></p><p>This is the method that you are using</p>                                                                                                                                                                                                                                                                                                                                              |
| Parameters            | As explained in the previous table                                                                                                                                                                                                                                                                                                                                                                                             |
| Result Type           | <p>Record (Auto Selected)</p><p>It indicates that the method can return one or more records</p>                                                                                                                                                                                                                                                                                                                                |
| Record JsonPath       | <p>Each method returns data in json format and to pick any specific information from the json, we need to specify the <em>Record JsonPath</em> so iX Hello platform will pick that data in consideration while displaying results.</p><p>Example: $.\[\*]</p><p>This selects all the records that is returned.</p>                                                                                                             |
| Result Template       | <p>Let’s assume that the following json represents one record.</p><p>{</p><p>"name": "Rose",</p><p>"phone": "(512) 757-6001",</p><p>"country": "USA"</p><p>}</p><p>Now, you want to select name, then you can provide <em>Record Template</em> as</p><p><strong>Phone number of {{Name}} is {{phone}}</strong></p><p>Note:</p><p>Anything written in between {{ }} is represented as a json field and it’s case-sensitive.</p> |
| Empty Result Template | Sorry, the record could not be found. How else can I help you?                                                                                                                                                                                                                                                                                                                                                                 |

<figure><img src="/files/1NLXToZQ8mShCqnuQyOk" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/eXzkZgc5R87dUfVfDE8X" alt=""><figcaption></figcaption></figure>

Now, you can save and test the method to see the method is able to fetch data from Lambda function.

<figure><img src="/files/XT3Z3gQMB975ZuQ8wub9" alt=""><figcaption></figcaption></figure>

#### Sample Response: (Dependent on Lambda Function output)

{\
&#x20;  "name": "Rose",\
&#x20;  "phone": "(512) 757-6001",\
&#x20;  "country": "USA"\
}

### Method: GetFunctions <a href="#toc48572876" id="toc48572876"></a>

This method returns all the available Lambda functions in your account for the given Region.

#### Parameters: Not required <a href="#toc48572877" id="toc48572877"></a>

| Parameter             | Info                                                                                                                                                                                                                                                                                                               |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|                       |                                                                                                                                                                                                                                                                                                                    |
| Method Name           | <p>GetFunctions</p><p>You can give any name. This name will be displayed in the methods list.</p>                                                                                                                                                                                                                  |
| Request Type          | <p><strong>GetFunctions</strong></p><p>This is the method that you are using</p>                                                                                                                                                                                                                                   |
| Parameters            | As explained in the previous table                                                                                                                                                                                                                                                                                 |
| Result Type           | <p>Records (Auto Selected)</p><p>It indicates that the method can return one or more records</p>                                                                                                                                                                                                                   |
| Record JsonPath       | <p>Each method returns data in json format and to pick any specific information from the json, we need to specify the <em>Record JsonPath</em> so iX Hello platform will pick that data in consideration while displaying results.</p><p>Example: $.\[\*]</p><p>This selects all the records that is returned.</p> |
| Result Template       | <p><strong>Here are the available functions: {{functionName}}</strong></p><p>Note:</p><p>Anything written in between {{ }} is represented as a json field and it’s case-sensitive.</p>                                                                                                                             |
| Empty Result Template | Sorry, the record could not be found. How else can I help you?                                                                                                                                                                                                                                                     |

<figure><img src="/files/KAbRllNAGhblN7nxcC6V" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/OT9XLOfkFLI45b1ZJFOS" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/cMjVKjCuvs4GJEj19B7J" alt=""><figcaption></figcaption></figure>

#### Sample Response: <a href="#toc48572878" id="toc48572878"></a>

\[\
&#x20;  {\
&#x20;     "CodeSha256": "Zoi4TT7+rac74irUovU5MfPzU8fxnRmdZQbujxkvU78=",\
&#x20;     "CodeSize": 380,\
&#x20;     "DeadLetterConfig": null,\
&#x20;     "Description": "",\
&#x20;     "Environment": null,\
&#x20;     "FunctionArn": "arn:aws:lambda:us-east-2:939063855410:function:ContactFinder",\
&#x20;     "FunctionName": "ContactFinder",\
&#x20;     "Handler": "lambda\_function.lambda\_handler",\
&#x20;     "KMSKeyArn": null,\
&#x20;     "LastModified": "2020-08-07T20:41:58.491+0000",\
&#x20;     "LastUpdateStatus": null,\
&#x20;     "LastUpdateStatusReason": null,\
&#x20;     "LastUpdateStatusReasonCode": null,\
&#x20;     "Layers": \[],\
&#x20;     "MasterArn": null,\
&#x20;     "MemorySize": 128,\
&#x20;     "RevisionId": "4d001c08-5bdc-48de-b7c6-ec5bd3d85f5c",\
&#x20;     "Role": "arn:aws:iam::9390636344510:role/Role\_Lambda",\
&#x20;     "Runtime": {\
&#x20;        "Value": "python3.8"\
&#x20;     },\
&#x20;     "State": null,\
&#x20;     "StateReason": null,\
&#x20;     "StateReasonCode": null,\
&#x20;     "Timeout": 3,\
&#x20;     "TracingConfig": {\
&#x20;        "Mode": {\
&#x20;           "Value": "PassThrough"\
&#x20;        }\
&#x20;     },\
&#x20;     "Version": "$LATEST",\
&#x20;     "VpcConfig": null\
&#x20;  }\
]

### Create Intents

1. Now Create Intents for each method:

Fill the following details:

| <ol><li>Name: ExecuteIntent</li></ol>                                                                                                                                        |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Intent Type: Search                                                                                                                                                          |
| Intent Action: Execute Method                                                                                                                                                |
| Data Source: Lambda DS                                                                                                                                                       |
| Data Source Method: ExecuteMethod                                                                                                                                            |
|                                                                                                                                                                              |
| <ol><li>Name: GetFunctionsIntent</li></ol><p>Intent Type: Search</p><p>Intent Action: Execute Method</p><p>Data Source: Lambda DS</p><p>Data Source Method: GetFunctions</p> |

<figure><img src="/files/o58Rvnq49Lk7n5ZQAaTl" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="/files/JYQU7d40F3fYqog3dWNz" alt="" width="563"><figcaption></figcaption></figure>

### Create Utterances

1. Create Utterances to invoke the intent. Utterances are short keywords that are used to invoke the intents created. In the Utterances tab, make sure that the correct intent is selected in the drop down. Click on Create New Utterances and provide details as shown below:

For example, if you are going to create utterance for GetFunctionsIntent, make sure the intent is selected, Click on Create New Utterance and fill the details and Save.

![](/files/jgT8WeS5Tngn6UIuseeE)

A sample utterance for ExecuteIntent is also shown below.

<figure><img src="/files/aokMLX16P7sJQyO3Sbhc" alt=""><figcaption></figcaption></figure>

### Create Inputs

1. Now create Input for the intents:

| <ol><li>Name: ExecuteInput</li></ol><p>Custom App: Lambda</p><p>Custom Intent: ExecuteIntent</p><p>Data Source : Lambda DS</p><p>Data Source Method: ExecuteMethod</p>          |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <ol><li>Name: GetFunctionsInput</li></ol><p>Custom App: Lambda</p><p>Custom Intent: GetFunctionsIntent</p><p>Data Source : Lambda DS</p><p>Data Source Method: GetFunctions</p> |

<figure><img src="/files/0DmxSfdnJUDxSmoun5xw" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="/files/XHQY1kesYl0wX4QpR0zf" alt="" width="563"><figcaption></figcaption></figure>

### Create Publish Profile and Publish

1. Now that all components of the app have been set, let us create publish profile and publish the app to Lex Bot.
2. Go to the publish tab and click on Add App Publishing.

![](/files/UZI2txeMFMnFMfOf7Tjo)

1. Fill in the following details in the resulting screen.

| External App Name: Lambda                                                              |
| -------------------------------------------------------------------------------------- |
| Skill Type: Search                                                                     |
| Channel: Amazon Lex                                                                    |
| Version: Lex V1                                                                        |
| Messages: All Messages shall be auto-populated. You can add/ edit them if not present. |
| Click on Save.                                                                         |

<figure><img src="/files/YCmZ1LfLUOUqbdCQIDnx" alt=""><figcaption></figcaption></figure>

1. Once saved, now you can click on the Actions to Publish to the selected Channel i.e. Lex in our case.

<figure><img src="/files/UbRRXHb0sw63EC6F4Y9G" alt=""><figcaption></figcaption></figure>

1. You will be directed to following screen, where you can select the Lex Account to which you want to deploy the bot.

<figure><img src="/files/YKunGln87bomdpgyDLQi" alt=""><figcaption></figcaption></figure>

1. Click on Publish to V2 and on success you’ll get following screen. You can now click on Go to Lex Skill and test the bot in the Amazon Lex Chatbot.
2. Here are some sample results:

<figure><img src="/files/9aerb5wTt4nVEAVNKDs2" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="/files/7C28To7XBZ8BzvE1UryE" alt="" width="563"><figcaption></figcaption></figure>

Congratulations, you’ve successfully completed iX Hello integration with Amazon Lambda.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ixhello.com/ixhc/connections/amazon/amazon-lambda/amazon-lambda-create-lambda-function/amazon-lambda-ix-hello-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
