Create a BankingBot with English and Spanish support in the Amazon Lex V2 console

TUTORIAL

Module 3: Add Spanish (US) Intents

You will extend your BankingBot to understand Spanish (US) as well, creating some of the same intents and slots as the previous module

What you will accomplish

In this module, we’ll extend your BankingBot to understand Spanish (US) as well, creating some of the same intents and slots as the previous module. As a reminder, an intent is an action that the user wants to perform, and a slot is the input data the bot needs to fulfill the intent. For this lab, we’ll create the following intents:

  • Welcome: greets users.
  • CheckBalance: checks the balance of an account specified by the user and references input data from two slots: accountType and dateofBirth.
  • TransferFunds: transfers funds between accounts and references input data from three slots: sourceAccountType, targetAccountType, and transferAmount.
  • FallbackIntent: provides a default response when no other intent matches the user input data.

 Time to complete

30 minutes

 Requires

Completion of Module 1

Implementation

Step 1: Create the Welcome Intent

Start by creating the Welcome intent. BankingBot is friendly and the Welcome intent provides a simple greeting to users.
In the Amazon Lex console,  navigate to BankingBot > Bot versions > Draft version > All languages > Spanish (US) > Intents.  Select NewIntent.

In the Intent details section, for Intent name, replace NewIntent with Welcome.

In the Sample utterances section, either type or copy/paste the following utterances.

These phrases will trigger the Welcome intent for the BankingBot to respond.

Hola
Necesito ayuda
Me podría ayudar?

In the Closing responses section, for Message, add the following text.

This is the BankingBot's response to the user.

Bienvenido! Puedo ayudarle con tareas como chequear balance o realizar un pago. Cómo puedo ayudarle hoy?

Choose Save intent. Then, choose Build.

Now, test your intent. Choose Test to open a chat window and type hola to your BankingBot.

Congratulations! You've created your first intent.  Lets create the remaining intents.

Step 2: Create the CheckBalance Intent

The CheckBalance intent allows a user to check an account balance. The bot validates the user by requesting their date of birth, then asks which account they want to check. Since this intent requires slots, we will create two custom slot types before defining the intent. Unlike other intents you are creating, this one requires a Lambda function for fulfillment so ensure you’ve completed all tasks in Module 1 before continuing.

Step 2a: Create the custom slot type

In the left navigation pane of the Lex V2 console, navigate to BankingBot > Bot versions > Draft version > All languages > Spanish (US) > Slot types. Choose Add slot type, then choose Add blank slot type.

In the Add blank slot type dialog box, for Slot type name, type accountType. Then, choose Add.

On the Slot types editor page, for Slot value resolution, choose Restrict to slot values.

For Slot type values, add values for Cheques (checking), Ahorro (savings), and Crédito (credit). .You can also add synonyms to the second column to help the bot recognize additional references to the Credit slot.

Choose Save slot type.

Congratulations! You now have your first custom slot type.

Step 2b: Create the intent

Now, create the CheckBalance intent. This intent allows a user to check an account balance. The BankingBot first validates the user by requesting their date of birth and then asks which account they want to check. It uses the accountType custom slot and Lambda function for fulfillment.

In the left navigation pane of the console, navigate to BankingBot > Bot versions > Draft version > All languages > Spanish (US) > Intents. Choose Add intent, then choose Add empty intent.
 

For Intent name, type CheckBalance. Then, choose Add.

In the Sample utterances section, either type or copy/paste the following utterances in the Plain Text tab then choose Save intent.

Cuál es el balance en mi cuenta?
Verificar balance en mi cuenta
Cuál es el balance en la cuenta {accountType}
Cuál es el balance en {accountType}
Cuánto hay en {accountType}
Quiero verificar el balance
Me podría ayudar con el balance de mi cuenta?
Balance en {accountType}

In the Slots section, choose Add slot.

On the Add slot dialog, specify the following:

  • For Name, type accountType.
  • For Slot type, choose accountType.
  • For Prompts, type For Prompts, type Por supuesto. De qué cuenta le gustaría conocer el balance?

Choose Add.

Add the second slot by again selecting Add Slot.   

On the Add slot dialog, specify the following:

  • For Name, type dateofBirth.
  • For Slot type, choose AMAZON.Date.
  • For Prompts, type Por motivos de verificación, compartir su fecha de nacimiento

Choose Add.

Choose Save intent.

Great! You've created the CheckBalance intent and set up two slots: accountType and dateofBirth.

Step 2c: Activate Fulfillment and Test

In the Fulfillment section, toggle the slider to Active.  Choose Save intent.

Choose Build and wait for it to complete.  Now choose Test and test the CheckBalance intent by typing an account type, like Ahorro. It should prompt you for a date of birth and then return a balance.  You can enter any date for testing.  

You can also use the Conversation flow section to view the current state of your conversation flow and links to help quickly locate specific utterances, slots, or prompts

Step 3: Create the TransferFunds Intent

The TransferFunds intent offers the functionality of moving funds from one account to a target account. For this intent, you learn how to create two different slots using the same slot type and how to configure confirmation prompts and declines.

On the Intent editor page, under Intents, choose Add, then choose Add empty intent.

In the Add empty intent dialog box, for Intent name, type TransferFunds. Then, choose Add.

On the Intent editor page, in the Intent details section, for Description, type Help users transfer funds between bank accounts.

In the Sample utterances section, either type or copy/paste the following utterances in the Plain Text tab then choose Save intent.

Quisiera transferir fondos
Puedo realizar una transferencia?
Necesito hacer una transferencia.
Quisiera transferir {transferAmount} desde {sourceAccountType} hacia {targetAccountType}
Puedo transferir {transferAmount} hacia {targetAccountType} ?
Can I transfer {transferAmount} to my {targetAccountType}
Necesito ayuda con una transferencia.
Me ayudaría a realizar una transferencia?
Necesito realizar una transferencia.

In the Slots section, choose Add slot.

On the Add slot dialog, specify the following:

  • For Name, type transferAmount.
  • For Slot type, choose AMAZON.Number.
  • For Prompts, type Qué monto desea transferir?

Choose Add.

Again, choose Add slot.

On the Add slot dialog, specify the following:

  • For Name, type sourceAccountType.
  • For Slot type, choose accountType.
  • For Prompts, type Desde qué cuenta desea iniciar la transferencia?

Choose Add.

Again, choose Add slot.

On the Add slot dialog, specify the following:

  • For Name, type targetAccountType.
  • For Slot type, choose accountType.
  • For Prompts, type Hacia qué cuenta desea realizar la transferencia?

Choose Add.

Expand the Confirmation section and specify the following:

  • For Confirmation prompt, type Entendido. Usted desea transferir {transferAmount} dólares desde la cuenta {sourceAccountType} hacia la cuenta {targetAccountType}. Puedo realizar la transferencia?
  • For Decline response, type No hay problema. La transferencia ha sido cancelada.
  • Toggle the slider to Active  

In the Closing response section, expand Response sent to the user after the intent is fulfilled and under Message Group add the following:

  • For Message, type La transferencia ha sido realizada. {transferAmount} deberían estar disponibles en su cuenta {targetAccountType}.
  • Toggle the slider to Active

Choose Save intent. Then, choose Build.

Step 4: Create the Fallback Intent

The Fallback intent is used when the bot can't understand or identify a specific intent. It serves as a catch-all intent and can guide the user to rephrase their question or provide hints about the commands the bot understands.

On the Intent editor page, under Intents, choose FallbackIntent.

In the Closing response section, expand Response sent to the user after the intent is fulfilled and under Message Group add the following:

  • For Message, type Lo siento, no he entendido. En pocas palabras, podría describer que necesita hacer? Puedo ayudarlo con balance de cuenta, transferir fondos y pagos.
  • Toggle the slider to Active

Choose Save intent. Then, choose Build.

Conclusion

In this module, you configured your BankingBot with the intents for Spanish (US).

In the next module, you will test the configuration.

Test the bot

Was this page helpful?