# Banking

## Template overview

This chatbot can help users check their account balance, card limit, report a card as lost or stolen,  and find the office closest to them.&#x20;

Let's dive into how you can adapt this template for your business!

{% hint style="info" %}
Make sure to always [update the NLP](https://docs.chatlayer.ai/understanding-users/natural-language-processing-nlp#updating-the-nlp) after loading a template!
{% endhint %}

## How to customize this template

This template only uses [this Airtable database](https://airtable.com/shr9h2cv6y5LzTr5q) to search for records. Learn how to set up your own Airtable integration [here](https://docs.chatlayer.ai/integrations/app-integrations/airtable?q=airtabe).

{% hint style="info" %}
Using another service to store your data? You can link any type of database to this bot, as long as it has an API. Read more about  our API integrations [here](https://docs.chatlayer.ai/integrateandcode/custom-back-end-integrations/integrations-101).&#x20;
{% endhint %}

### Flow: General

#### Block: Introduction

In the introduction message, you can change the Botbank image to your own business logo. Make sure that the Quick Reply buttons cover your bot's use cases.

#### Block: Not Understood

This Block uses a [Not Understood Counter](https://docs.chatlayer.ai/tips-and-best-practices/not-understood-bot-dialog/not-understood-counter?q=not+under) to create a better user experience and make the bot feel more natural. Have fun with it so that it matches your bot's persona!

#### Block: Anything Else

This Block is where the conversation ends up when a flow is over. For instance, when the user is done checking their account, they will be asked if there is anything else that can be done to help them.&#x20;

### Flow: Check account

This flow captures two use cases: checking an account balance, and checking a card limit. A spreadsheet for Accounts and another for Cards were created in an [Airtable base](https://airtable.com/shr9h2cv6y5LzTr5q/tblpP867BDn6KHPXK/viwC9GRRqh8qMslvC?blocks=hide) that was made by using the  [Airtable App integration](https://docs.chatlayer.ai/integrations/app-integrations/airtable-app-integration).

On the one hand, if users ask to check their card limit, and they get a different response depending on what card type they choose. Card types are defined under the `cardtype` contextual entity in the NLP section. This flow is triggered either by a Quick Reply button or by the `Card.Limit` intent.

![View of the Cards table from the Airtable database used for this template. Learn how to set up your own here. ](https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FxhH3vAc4o0PcLYUAOXaq%2FScreenshot%202022-07-28%20at%2010.14.53.png?alt=media\&token=917e29af-0c01-4a8a-8ac4-8e1d321a3809)

On the other hand, if users ask to check their account balance, they can choose to check their current account or savings account. Those are defined under the `accounttype` contextual entity. This flow is triggered either by a Quick Reply button or by the `Check.Balance` intent. Once the balance is checked, the user is asked if they want to make a money transfer from that account. This redirects us to the `Transfer money` flow where a `Is account known?` Go-To block checks that the `accounttype` variable is already filled before proceeding to the money transfer.

![View of the Accounts table from the Airtable database used for this template. Learn how to set up your own here.](https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FsBpBTLRq5Z9hoyKzxZy2%2FScreenshot%202022-07-28%20at%2010.15.01.png?alt=media\&token=d618fb96-44ff-4da8-a9e7-ecbb868e0cd1)

### Flow: Transfer money

In this flow, users can make a one-time money transfer, or create a standing order.

#### Block: One-time transfer

Here, the bot first asks the amount to transfer, from which account, and finally the bank account number of the recipient. These values are stored as:

`amount` : the amount to be transferred

`accounttype` : the account from which the money is transferred

`IBAN` : the recipient's account number

To check that the bank account corresponds to a correct IBAN format, we use a Condition block that verifies if the `IBAN` exists. To do so, the bot checks that the entered IBAN  matches the IBAN Regex pattern. In short, it verifies whether this is a valid IBAN. To see this pattern and adapt it to your needs, you can go in the Entities tab > Match Entities > `@IBAN.`

#### Block: Standing order

To set up a standing order, the bot first asks the user how often the payment should occur. This is stored under the`frequency`variable. After that, it asks for the the start and end date. To check if the user's input is a valid date, we check if the value matches "date" before saving it as the variables `startDate` and `endDate`. Here users can also add a reference in their transfer, stored under the `reference` variable.

### Flow: Report lost card

This flow allows users to report their card as lost or stolen. They are immediately redirected to external links to help block the card, after which they're asked if they want to order a new card. This flow is triggered by either a Quick Reply button or the `Lost.Or.Stolen.Card` intent.

To find the nearest office locations, the conversation is steered to the Office locations flow.

#### Block: Report lost card

You can customize the external links to redirect your users to your website and/or phone number.&#x20;

{% hint style="info" %}
In the Action block *clear address*, the bot deleted the variable `user_address` because the user wants to correct their address by entering a new one. We need to clear the old variable in order to save a new one.
{% endhint %}

### Flow: Office locations

This flow is triggered when we want to show the user the office that is the closest to them. For the sake of this template, addresses are predefined within the block, but you customize yours following the [Find Nearest Location Template](https://docs.chatlayer.ai/tips-and-best-practices/bot-templates/use-case-templates/template-find-nearest-location) that uses Google Maps.

![View of the Office Locations table from the Airtable database used for this template. Learn how to set up your own here.](https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FAi6LPCj2TnsvU8gpnaOR%2FScreenshot%202022-07-28%20at%2010.14.45.png?alt=media\&token=2f1c54fe-907e-4e6e-b505-2fc0c17e1ffb)

### Flow: Random questions

In this flow are grouped all blocks meant to answer random questions like: *Which cards do you offer?, How are you?, Who built this?, ...* All those blocks are triggered by intents so that the bot can answer those at any time in the conversation. Make sure that you foresee many of them whilst building your bot so that the conversation flows smoothly!
