Here we will create a Lambda function that has some Python code to detect
the intent name (
and to return static values based on the AccountType (checking, saving) or
LoanType (car, home) included in the intent.
In a real world example we would need to first authenticate the user using account linking and would write codes to do database queries for individual’s account balances. In this lab, as we only focus on the development of Alexa skill instead of a fulfilled backend application, we will simply hard code account balances and leave the database combination part to your own exploration. We will also cover the account linking part in lab2.
Go to AWS Lambda Console
Click on the orange Create function button, If you have not created any Lambda function before, you may see the Get Started page
Select Author from scratch option
Let’s give our function the name of
bot-personal-assistant. Feel free to choose
a different name.
Choose Python 2.7 as the Runtime
Under Permission*, select Create new role from AWS policy templates.
bot-personal-assistant-lambda-role for role name and leave the policy
Click Create Function button
Scroll down to the integrated Cloud9 editor on the Lambda console.
Download the lambda function code lex-lambda-personal-banker.py. Copy and paste the code into the inline editor (while making sure to overwrite/delete any template code that is already in the code box). Take a few minutes to review the code. Please note if you named your intents differently, you will have to update the dispatch method accordingly.
We are not going to configure any trigger now, so click ‘Save’ on the top right hand corner of the page. You should see a message like this.
If lambda alerts any errors, please check the python codes’s indents.