Create a banking chatbot


Built for developers familiar with JavaScript and Node.js interested in making a web UI chatbot with artificial intelligence abilities, this code pattern uses the IBM Watson Node.js SDK to include conversation interaction, anger detection, natural language understanding, and answer discovery. Answers are discovered from a collection of FAQ documents. Built as a fictional financial institution, this app calls out to simple banking services code as an example of how to include external business data in a conversation response.


In this pattern, you create a chatbot using Node.js and IBM Watson Assistant. The flow is enhanced by using Watson Natural Language Understanding to identify entities and Watson Tone Analyzer to detect customer emotions. For FAQs, a call to the Watson Discovery service uses passage retrieval to pull answers from a collection of documents.

When you complete this pattern, you will understand how to:

  • Create a chatbot that converses through a web UI using Watson Assistant and Node.js
  • Use Watson Discovery with passage retrieval to find answers in FAQ documents
  • Use Watson Tone Analyzer to detect emotion in a conversation
  • Identify entities with Watson Natural Language Understanding

The code pattern lets you choose how to deploy the application, using IBM Cloud or IBM Cloud Pak for Data.


create banking chatbot flow chart

  1. The FAQ documents are added to the Watson Discovery collection.
  2. The user interacts with a chatbot through the app UI.
  3. User input is processed with Tone Analyzer to detect anger. An anger score is added to the context.
  4. User input is processed with Natural Language Understanding. The context is enriched with detected entities and keywords (for example, a location).
  5. The input and enriched context is sent to Watson Assistant, which recognizes intent, entities, and dialog paths. It responds with a reply, an action, or both.
  6. Optionally, a requested action is performed by the app. This action might include looking up additional information from bank services to append to the reply or using Discovery to reply with an answer from the FAQ documents.


Ready to put this code pattern to use? Complete details on how to get started running and using this application are in the file.