Arif Rahman
← All projects
06 · 2025 · Personal AWS projectCompleted

Amazon Lex — Banking Chatbot with Custom Slots

Built "BB, the Banking Bot" in Amazon Lex — from a first welcome intent and tuned fallback handling through to a CheckBalance intent with a custom accountType slot and date-of-birth verification before any balance is returned.

Problem
Customers word banking questions in endless ways, and balances must never be shown unverified.
AWS services
Amazon LexIAM
Result
Two intents, a custom slot with synonyms, and date-of-birth verification before any balance.

Architecture

Amazon Lex — banking bot conversation flowA customer message reaches the Lex bot, which classifies intent with a 0.40 confidence threshold. Greetings go to WelcomeIntent; balance questions go to CheckBalance, which elicits the account type and verifies date of birth before returning a balance. Low-confidence input falls back to escalating rephrase prompts. Step 1: The customer asks in their own words, e.g. “What's my savings balance?” Step 2: Lex classifies the intent. Below 40% confidence it asks the customer to rephrase. Step 3: CheckBalance elicits the account type: Checking, Savings or Credit, with synonyms like “visa” or “amex”. Step 4: A dateOfBirth slot verifies identity before anything sensitive is shared. Step 5: Only then is the balance returned.Amazon Lex · English (US)122< 0.402345Customertyped or spokenBB, the Banking Botthreshold 0.40WelcomeIntentbranded greetingCheckBalance{accountType}Fallbackescalating promptsaccountTypecustom slot + synonymsdateOfBirthAMAZON.DateBalance replyonly after DOB checkIAM rolebasic permissions
Amazon Lex — banking bot conversation flow · scroll sideways to see it allOpen full-size SVG
  1. Step 1: The customer asks in their own words, e.g. “What's my savings balance?”
  2. Step 2: Lex classifies the intent. Below 40% confidence it asks the customer to rephrase.
  3. Step 3: CheckBalance elicits the account type: Checking, Savings or Credit, with synonyms like “visa” or “amex”.
  4. Step 4: A dateOfBirth slot verifies identity before anything sensitive is shared.
  5. Step 5: Only then is the balance returned.
Confidence threshold tuned
0.40
Welcome + CheckBalance
2 intents
Account type + DOB verification
2 slots

Why it matters

Shifts repetitive greeting and balance enquiries to secure self-service. The bot handles two core intents, captures account context and checks date of birth before it returns anything sensitive.

The problem in detail

Bank customers ask the same handful of questions in endlessly different wording. A rigid command-driven bot fails on typos and natural phrasing, and a bot that answers balance questions without verifying identity is a security problem.

What I built

  1. 01

    Created the Lex bot from scratch with an IAM role carrying basic permissions, then added English (US) with a chosen voice.

  2. 02

    Set the intent classification confidence threshold to 0.40, so the bot only answers when it is at least 40% sure it understood.

  3. 03

    Built a WelcomeIntent with multiple greeting utterances and a friendly branded response.

  4. 04

    Replaced Lex's random fallback retries with ordered, escalating prompts — "Hmm, could you try rephrasing that?", then "In a few words can you repeat your query?" — so failed turns feel human rather than repetitive.

  5. 05

    Added a CheckBalance intent trained on natural phrasing such as "What's my {accountType} balance?" and "How much is in my {accountType}?".

  6. 06

    Created a custom accountType slot type with Checking, Savings and Credit values, plus synonyms (visa, mastercard, amex, american express) so real-world wording resolves correctly.

  7. 07

    Configured slot elicitation order and prompts, escalating from "Which account — Checking or Savings?" to a clarifying retry.

  8. 08

    Added a dateOfBirth slot using AMAZON.Date as a verification step before any balance is disclosed.

  9. 09

    Tested end to end in the Lex test window and used Inspect to confirm slot values and intent fulfilment in the JSON input/output.

Evidence

01 / 08
Stage 01 — adding English (US) to the bot with a chosen voice and the intent classification confidence threshold set to 0.40.

Stage 01 — adding English (US) to the bot with a chosen voice and the intent classification confidence threshold set to 0.40.