Digital Developer Conference: Cloud Security 2021 -- Build the skills to secure your cloud and data Register free

Modernize a legacy application with digital decoupling

Note: This code pattern uses the classic Watson Assistant experience. After October 8, 2021, all instances (except the standard plan) can switch between the classic and new Watson Assistant experiences by going to the upper-right corner of the Watson Assistant screen and clicking the Manage icon.

Manage icon


Cloud modernization at scale can be disruptive, and clients prefer to start the journey that incrementally transitions them to reach digital maturity. This can be made possible by developing a co-existing layer that operates alongside the core business application and database. Digital decoupling can also be seen as a coexistence layer that helps clients to incrementally transition to the future state with minimal or no disruption to the existing technology stack. There are numerous use cases that can be made possible using the decoupling layer, including the customer empowerment and smart front-office application.


In this developer code pattern, we will take the scenario of a telecom company that provides mobile network services. The company has a legacy application with a number of functional modules for customer information management, mobile plan management, inventory management, and billing. The telecom company now wants to build a new system of engagement with an interactive chatbot for the customers. In the new chatbot, the customers can query for billing information, data usage, and get plan recommendations. It is proposed to build this new chatbot using new the technologies and capabilities of IBM Cloud Pak for Data — without disrupting the existing legacy system. The legacy system uses a Db2 database and is the system of record. The new chatbot system uses a PostgreSQL database. A subset of data needed by the chatbot system is replicated to the PostgreSQL database using IBM DataStage.

When you have completed this code pattern, you will understand how to:

  • Create DataStage flows for data replication using IBM Cloud Pak for Data
  • Create a chatbot using Watson Assistant
  • Create IBM Cloud Functions in Watson Assistant to query databases



  1. The employee performs one of many actions, such as creating a new mobile plan, entering new customer information, or generating billing information.
  2. The data is stored in the Db2 database.
  3. DataStage reads the data from the Db2 database.
  4. DataStage replicates the data in the PostgreSQL database.
  5. A customer queries for billing information, data usage, and recommendations through the chatbot.
  6. The Watson Assistant chatbot invokes IBM Cloud Functions for the queries.
  7. IBM Cloud Functions queries PostgreSQL for data, processes the data, and returns the response to Watson Assistant.


Ready to get started? Check out the README for detailed instructions on how to:

  1. Create an instance of Db2 database
  2. Clone the repo
  3. Build and deploy the legacy application
  4. Set up legacy database
  5. View sample data
  6. Log in to IBM Cloud Pak for Data SaaS and Create Services
  7. Get credentials of PostgreSQL database
  8. Set up PostgreSQL database
  9. Import the project in IBM Cloud Pak for Data
  10. Set up chatbot application
  11. Analyze the results