diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
new file mode 100644
index 00000000..0e4da042
--- /dev/null
+++ b/.github/workflows/codeql-analysis.yml
@@ -0,0 +1,67 @@
+# For most projects, this workflow file will not need changing; you simply need
+# to commit it to your repository.
+#
+# You may wish to alter this file to override the set of languages analyzed,
+# or to provide custom queries or build logic.
+#
+# ******** NOTE ********
+# We have attempted to detect the languages in your repository. Please check
+# the `language` matrix defined below to confirm you have the correct set of
+# supported CodeQL languages.
+#
+name: "CodeQL"
+
+on:
+ push:
+ branches: [ master, *release-*, RELEASE*, develop ]
+ pull_request:
+ # The branches below must be a subset of the branches above
+ branches: [ master ]
+ schedule:
+ - cron: '38 8 * * 3'
+
+jobs:
+ analyze:
+ name: Analyze
+ runs-on: ubuntu-latest
+
+ strategy:
+ fail-fast: false
+ matrix:
+ language: [ 'java', 'javascript' ]
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
+ # Learn more:
+ # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v2
+
+ # Initializes the CodeQL tools for scanning.
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v1
+ with:
+ languages: ${{ matrix.language }}
+ # If you wish to specify custom queries, you can do so here or in a config file.
+ # By default, queries listed here will override any specified in a config file.
+ # Prefix the list here with "+" to use these queries and those in the config file.
+ # queries: ./path/to/local/query, your-org/your-repo/queries@main
+
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
+ # If this step fails, then you should remove it and run the build manually (see below)
+ - name: Autobuild
+ uses: github/codeql-action/autobuild@v1
+
+ # âšī¸ Command-line programs to run using the OS shell.
+ # đ https://git.io/JvXDl
+
+ # âī¸ If the Autobuild fails above, remove it and uncomment the following three lines
+ # and modify them (or add more) to build your code if your project
+ # uses a compiled language
+
+ #- run: |
+ # make bootstrap
+ # make release
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v1
diff --git a/.gitignore b/.gitignore
index 5c2027f4..2111c54c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,8 +39,9 @@ hs_err_pid*
.classpath
.project
.settings/
-.mvnw/
+.mvnw
target/
+*.mvn
# Logs
logs
@@ -189,4 +190,7 @@ $RECYCLE.BIN/
*.msp
# Windows shortcuts
-*.lnk
\ No newline at end of file
+*.lnk
+
+mvnw.cmd
+.mvn/
\ No newline at end of file
diff --git a/CODEOWNERS b/CODEOWNERS
index a65942fc..44b27814 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -1 +1 @@
-* @egovernments/services-pr-reviewer
+* @egovernments/services-pr-reviewer @talele08 @kavi-egov
diff --git a/README.md b/README.md
index 23e64b89..5cec672b 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,10 @@
-# egov-java-template
-template
+DIGIT eGovernance Platform Services
+
+DIGIT (Digital Infrastructure for Governance, Impact & Transformation) is India's largest platform for governance services. Visit https://doc.digit.org for more details.
+
+DIGIT platform is microservices based API platform enabling quick rebundling of services as per specific needs. This repository contains various infra, governance and municipal focused micro services.
+
+This is a Core services repo that lays down the basic platform.
+
+License
+DIGIT is released under MIT License
diff --git a/build/build-config.yml b/build/build-config.yml
index 81eac9d3..9e7bc633 100644
--- a/build/build-config.yml
+++ b/build/build-config.yml
@@ -8,13 +8,13 @@
# -
# -
config:
- - name: "builds/core-services/egov-accesscontrol"
+ - name: "builds/digit-impel-builds/core-services/egov-accesscontrol"
build:
- work-dir: "egov-accesscontrol"
image-name: "egov-accesscontrol"
dockerfile: "build/maven/Dockerfile"
- - name: "builds/core-services/egov-common-masters"
+ - name: "builds/digit-impel-builds/core-services/egov-common-masters"
build:
- work-dir: "egov-common-masters"
image-name: "egov-common-masters"
@@ -22,7 +22,7 @@ config:
- work-dir: "egov-common-masters/src/main/resources/db"
image-name: "egov-common-masters-db"
- - name: "builds/core-services/egov-data-uploader"
+ - name: "builds/digit-impel-builds/core-services/egov-data-uploader"
build:
- work-dir: "egov-data-uploader"
image-name: "egov-data-uploader"
@@ -30,7 +30,7 @@ config:
- work-dir: "egov-data-uploader/src/main/resources/db"
image-name: "egov-data-uploader-db"
- - name: "builds/core-services/egov-enc-service"
+ - name: "builds/digit-impel-builds/core-services/egov-enc-service"
build:
- work-dir: "egov-enc-service"
image-name: "egov-enc-service"
@@ -38,7 +38,7 @@ config:
- work-dir: "egov-enc-service/src/main/resources/db"
image-name: "egov-enc-service-db"
- - name: "builds/core-services/egov-filestore"
+ - name: "builds/digit-impel-builds/core-services/egov-filestore"
build:
- work-dir: "egov-filestore"
image-name: "egov-filestore"
@@ -46,7 +46,7 @@ config:
- work-dir: "egov-filestore/src/main/resources/db"
image-name: "egov-filestore-db"
- - name: "builds/core-services/egov-idgen"
+ - name: "builds/digit-impel-builds/core-services/egov-idgen"
build:
- work-dir: "egov-idgen"
image-name: "egov-idgen"
@@ -54,7 +54,7 @@ config:
- work-dir: "egov-idgen/src/main/resources/db"
image-name: "egov-idgen-db"
- - name: "builds/core-services/egov-indexer"
+ - name: "builds/digit-impel-builds/core-services/egov-indexer"
build:
- work-dir: "egov-indexer"
image-name: "egov-indexer"
@@ -62,7 +62,7 @@ config:
- work-dir: "egov-indexer/src/main/resources/db"
image-name: "egov-indexer-db"
- - name: "builds/core-services/egov-localization"
+ - name: "builds/digit-impel-builds/core-services/egov-localization"
build:
- work-dir: "egov-localization"
image-name: "egov-localization"
@@ -70,7 +70,7 @@ config:
- work-dir: "egov-localization/src/main/resources/db"
image-name: "egov-localization-db"
- - name: "builds/core-services/egov-location"
+ - name: "builds/digit-impel-builds/core-services/egov-location"
build:
- work-dir: "egov-location"
image-name: "egov-location"
@@ -78,25 +78,25 @@ config:
- work-dir: "egov-location/src/main/resources/db"
image-name: "egov-location-db"
- - name: "builds/core-services/egov-mdms-service"
+ - name: "builds/digit-impel-builds/core-services/egov-mdms-service"
build:
- work-dir: "egov-mdms-service"
image-name: "egov-mdms-service"
dockerfile: "build/maven/Dockerfile"
- - name: "builds/core-services/egov-notification-mail"
+ - name: "builds/digit-impel-builds/core-services/egov-notification-mail"
build:
- work-dir: "egov-notification-mail"
image-name: "egov-notification-mail"
dockerfile: "build/maven/Dockerfile"
- - name: "builds/core-services/egov-notification-sms"
+ - name: "builds/digit-impel-builds/core-services/egov-notification-sms"
build:
- work-dir: "egov-notification-sms"
image-name: "egov-notification-sms"
dockerfile: "build/maven/Dockerfile"
- - name: "builds/core-services/egov-otp"
+ - name: "builds/digit-impel-builds/core-services/egov-otp"
build:
- work-dir: "egov-otp"
image-name: "egov-otp"
@@ -104,13 +104,13 @@ config:
- work-dir: "egov-otp/src/main/resources/db"
image-name: "egov-otp-db"
- - name: "builds/core-services/egov-persister"
+ - name: "builds/digit-impel-builds/core-services/egov-persister"
build:
- work-dir: "egov-persister"
image-name: "egov-persister"
dockerfile: "build/maven/Dockerfile"
- - name: "builds/core-services/egov-pg-service"
+ - name: "builds/digit-impel-builds/core-services/egov-pg-service"
build:
- work-dir: "egov-pg-service"
image-name: "egov-pg-service"
@@ -118,19 +118,19 @@ config:
- work-dir: "egov-pg-service/src/main/resources/db"
image-name: "egov-pg-service-db"
- - name: "builds/core-services/egov-searcher"
+ - name: "builds/digit-impel-builds/core-services/egov-searcher"
build:
- work-dir: "egov-searcher"
image-name: "egov-searcher"
dockerfile: "build/maven/Dockerfile"
- - name: "builds/core-services/egov-telemetry"
+ - name: "builds/digit-impel-builds/core-services/egov-telemetry"
build:
- work-dir: "egov-telemetry"
image-name: "egov-telemetry"
dockerfile: "build/maven/Dockerfile"
- - name: "builds/core-services/egov-user"
+ - name: "builds/digit-impel-builds/core-services/egov-user"
build:
- work-dir: "egov-user"
image-name: "egov-user"
@@ -138,7 +138,7 @@ config:
- work-dir: "egov-user/src/main/resources/db"
image-name: "egov-user-db"
- - name: "builds/core-services/egov-workflow-v2"
+ - name: "builds/digit-impel-builds/core-services/egov-workflow-v2"
build:
- work-dir: "egov-workflow-v2"
image-name: "egov-workflow-v2"
@@ -146,13 +146,13 @@ config:
- work-dir: "egov-workflow-v2/src/main/resources/db"
image-name: "egov-workflow-v2-db"
- - name: "builds/core-services/report"
+ - name: "builds/digit-impel-builds/core-services/report"
build:
- work-dir: "report"
image-name: "report"
dockerfile: "build/maven/Dockerfile"
- - name: "builds/core-services/tenant"
+ - name: "builds/digit-impel-builds/core-services/tenant"
build:
- work-dir: "tenant"
image-name: "tenant"
@@ -160,19 +160,25 @@ config:
- work-dir: "tenant/src/main/resources/db"
image-name: "tenant-db"
- - name: "builds/core-services/user-otp"
+ - name: "builds/digit-impel-builds/core-services/user-otp"
build:
- work-dir: "user-otp"
image-name: "user-otp"
dockerfile: "build/maven/Dockerfile"
- - name: "builds/core-services/zuul"
+ - name: "builds/digit-impel-builds/core-services/zuul"
build:
- work-dir: "zuul"
image-name: "zuul"
dockerfile: "build/maven/Dockerfile"
+
+ - name: "builds/digit-impel-builds/core-services/internal-gateway"
+ build:
+ - work-dir: "internal-gateway"
+ image-name: "internal-gateway"
+ dockerfile: "build/maven/Dockerfile"
- - name: "builds/core-services/egov-user-event"
+ - name: "builds/digit-impel-builds/core-services/egov-user-event"
build:
- work-dir: "egov-user-event"
image-name: "egov-user-event"
@@ -181,25 +187,25 @@ config:
image-name: "egov-user-event-db"
dockerfile: "build/maven/Dockerfile"
- - name: "builds/core-services/pdf-service"
+ - name: "builds/digit-impel-builds/core-services/pdf-service"
build:
- work-dir: "pdf-service"
image-name: "pdf-service"
- work-dir: "pdf-service/migration"
image-name: "pdf-service-db"
- - name: "builds/core-services/telemetry/egov-telemetry-kafka-streams"
+ - name: "builds/digit-impel-builds/core-services/telemetry/egov-telemetry-kafka-streams"
build:
- work-dir: "egov-telemetry/egov-telemetry-kafka-streams"
image-name: "egov-telemetry-kafka-streams"
- - name: "builds/core-services/telemetry/egov-telemetry-batch-process"
+ - name: "builds/digit-impel-builds/core-services/telemetry/egov-telemetry-batch-process"
build:
- work-dir: "egov-telemetry/egov-telemetry-batch-process"
image-name: "egov-telemetry-batch-process"
dockerfile: "build/maven/Dockerfile"
- - name: "builds/core-services/egov-url-shortening"
+ - name: "builds/digit-impel-builds/core-services/egov-url-shortening"
build:
- work-dir: "egov-url-shortening"
image-name: "egov-url-shortening"
@@ -207,10 +213,56 @@ config:
- work-dir: "egov-url-shortening/src/main/resources/db"
image-name: "egov-url-shortening-db"
- - name: "builds/core-services/chatbot"
+ - name: "builds/digit-impel-builds/core-services/chatbot"
build:
- work-dir: "chatbot"
image-name: "chatbot"
dockerfile: "build/maven/Dockerfile"
- work-dir: "chatbot/src/main/resources/db"
image-name: "chatbot-db"
+
+ - name: "builds/digit-impel-builds/core-services/http-to-kafka-connector"
+ build:
+ - work-dir: "http-to-kafka-connector"
+ image-name: "whatsapp-webhook"
+
+ - name: "builds/digit-impel-builds/core-services/egov-user-chatbot"
+ build:
+ - work-dir: "egov-user"
+ image-name: "egov-user-chatbot"
+ dockerfile: "build/maven/Dockerfile"
+
+ - name: "builds/digit-impel-builds/core-services/mailbot"
+ build:
+ - work-dir: "mailbot"
+ image-name: "mailbot"
+ dockerfile: "build/maven/Dockerfile"
+
+ - name: "builds/digit-impel-builds/core-services/libraries/enc-client"
+ build:
+ - work-dir: "libraries/enc-client"
+ image-name: "enc-client"
+
+ - name: "builds/digit-impel-builds/core-services/libraries/tracer"
+ build:
+ - work-dir: "libraries/tracer"
+ image-name: "tracer"
+
+ - name: "builds/digit-impel-builds/core-services/nlp-engine"
+ build:
+ - work-dir: "nlp-engine"
+ image-name: "nlp-engine"
+ dockerfile: "nlp-engine/Dockerfile"
+
+ - name: "builds/digit-impel-builds/core-services/xstate-chatbot"
+ build:
+ - work-dir: "xstate-chatbot/nodejs"
+ image-name: "xstate-chatbot"
+ - work-dir: "xstate-chatbot/nodejs/db"
+ image-name: "xstate-chatbot-db"
+
+ - name: "builds/core-services/internal-gateway"
+ build:
+ - work-dir: "internal-gateway"
+ image-name: "internal-gateway"
+ dockerfile: "build/maven/Dockerfile"
diff --git a/build/maven/Dockerfile b/build/maven/Dockerfile
index 0a13f93d..bf3fd16c 100644
--- a/build/maven/Dockerfile
+++ b/build/maven/Dockerfile
@@ -1,5 +1,5 @@
-FROM egovio/alpine-maven-builder-jdk-8:gcp AS build
+FROM egovio/alpine-maven-builder-jdk-8:1-master-NA-6036091e AS build
ARG WORK_DIR
WORKDIR /app
diff --git a/chatbot/.gitignore b/chatbot/.gitignore
new file mode 100644
index 00000000..07827cc2
--- /dev/null
+++ b/chatbot/.gitignore
@@ -0,0 +1,2 @@
+target/
+.idea/
\ No newline at end of file
diff --git a/chatbot/CHANGELOG.md b/chatbot/CHANGELOG.md
new file mode 100644
index 00000000..d3fb302b
--- /dev/null
+++ b/chatbot/CHANGELOG.md
@@ -0,0 +1,23 @@
+
+
+# Changelog
+All notable changes to this module will be documented in this file.
+
+## 1.1.5 - 2021-07-26
+- Fixed when large file is uploaded for any textual answers the service is terminating
+
+## 1.1.4 - 2021-05-11
+- Fixed security issue.
+
+## 1.1.3 - 2021-02-26
+- Updated domain name in application.properties
+
+## 1.1.2 - 2021-01-11
+- Updated PGR v2.0 API calls,request object and response object.
+
+## 1.1.0 - 2020-10-01
+- Integrate PGR v2.0
+
+## 1.0.0 - 2020-06-08
+- Added this service with support to create, track PGR complaints
+- Upgraded to spring boot `2.2.6-RELEASE`
diff --git a/chatbot/LOCALSETUP.md b/chatbot/LOCALSETUP.md
new file mode 100644
index 00000000..d684d264
--- /dev/null
+++ b/chatbot/LOCALSETUP.md
@@ -0,0 +1,24 @@
+# Local Setup
+
+To setup the Chatbot service in your local system, clone the [Core Service repository](https://github.com/egovernments/core-services).
+
+## Dependencies
+
+### Infra Dependency
+
+- [X] Postgres DB
+- [ ] Redis
+- [ ] Elasticsearch
+- [X] Kafka
+ - [X] Consumer
+ - [X] Producer
+
+## Running Locally
+
+To run the Chatbot services locally, update below listed properties in `xternal.properties` before running the project:
+
+- `valuefirst.whatsapp.number`: the mobile number to be used on server
+
+- `valuefirst.username`: username for configured number for sending messages to user through whatsapp provider api calls
+
+- `valuefirst.password`: password for configured number for sending messages to user through whatsapp provider api calls
diff --git a/chatbot/README.md b/chatbot/README.md
new file mode 100644
index 00000000..68f225ce
--- /dev/null
+++ b/chatbot/README.md
@@ -0,0 +1,88 @@
+# Chatbot
+
+Chatbot service is a chatbot which provides functionality to the user to access PGR module services like file complaint, track complaint, notifications from whatsapp. Currently citizen has three options to start conversation scan QR code, give missed call or directly send message to configured whatsapp number.
+
+### DB UML Diagram
+
+- NA
+
+### Service Dependencies
+
+- `egov-user-chatbot` : For creating user without name validation and logging in user
+- `egov-user` : For searching user
+- `egov-localization` : The chatbot is made such that it will store localization codes and the actual text value will be fetched only at the end. This way we can provide multi-lingual support. Localization service is also used to construct messages from templates. This dependency can be eliminated if you want to pass values instead of localization codes.
+- `egov-filestore` : It is a dependency if you want to send/receive any file. This includes sending PDF/Image files.
+- `egov-url-shortening` : For shortening links sent to the user
+- `egov-mdms-service` : For loading mdms data
+- `egov-location` : For loading locality data
+- `rainmaker-pgr` : For creating/searching PGR complaints
+
+### Swagger API Contract
+
+http://editor.swagger.io/?url=https://raw.githubusercontent.com/egovernments/core-services/RAIN-1288/docs/chatbot-contract.yml#!/
+
+## Service Details
+
+Chatbot service allows citizen to access PGR service through whatsapp. Citizen can provide all details required to create PGR complaint through question and answer method. The service continuosly listen on PGR update Kafka topic and send notifications to users associated with PGR record. On any message from citizen which is forwarded by whatsapp provider, chatbot processes his messages by passing message through various stages ex:- validations, enrichment, transformations etc and at the end sends final response to user by calling endpoint of whatsapp provider.
+
+#### Configurations
+
+There are two types of configurations for chatbot states:-
+- Configuration for each state in chatbot, ex:-
+
+ ```
+ name : pgr.create.locality
+ description : "Locality"
+ nodeType : step
+ optional : false
+
+ type : text
+
+ validationRequired : true
+ typeOfValues : FixedSetValues
+ displayOptionsInExternalLink: true
+
+ message : chatbot.messages.pgrCreateLocality
+
+ values :
+ class : org.egov.chat.xternal.valuefetch.LocalityValueFetcher
+ params :
+ tenantId : ~pgr.create.tenantId
+ authToken : /user/authToken
+ recipient: /extraInfo/recipient
+
+ matchAnswerThreshold: 70
+
+ errorMessage: chatbot.messages.pgrCreateLocalityError
+ ```
+
+- Graph adjacency list configuration:- to define flow between chatbot states,ex:-
+
+ root,pgr.create.tenantId,pgr.track.end
+ pgr.create.tenantId,pgr.create.locality
+ pgr.create.locality,pgr.create.landmark
+
+> Note: For more information about these configs please refer technical documentation for the service from https://digit-discuss.atlassian.net/l/c/q8wfb0My
+
+### API Details
+
+
+a) `POST /messages`
+
+Receive user sent message and forward it to chatbot core logic for further processing and sending back response
+
+- If the `media_type` parameter value is `text` then user input would be sent in parameter `text`, in other cases where `media_type` have some other value ex:- image, location etc, the user input would be sent in parameter `media_data`
+
+b) `GET /messages`
+
+Receive user sent message and forward it to chatbot core logic for further processing and sending back response
+
+- If the `media_type` parameter value is `text` then user input would be sent in parameter `text`, in other cases where `media_type` have some other value ex:- image, location etc, the user input would be sent in parameter `media_data`
+
+### Kafka Consumers
+- `update-pgr-service` : used in `update.pgr.service.topic` application property, chatbot listens on this topic to listen for updates on PGR records and then to send notifications to user.
+- The service uses consumers for internal processing also between different stages.
+
+### Kafka Producers
+- `send-message-localized` : chatbot sends data to this topic for telemetry indexing and for internal processing.
+- The service uses producers for internal processing also between different stages.
diff --git a/chatbot/pom.xml b/chatbot/pom.xml
new file mode 100644
index 00000000..a6f47e70
--- /dev/null
+++ b/chatbot/pom.xml
@@ -0,0 +1,194 @@
+
+
+ 4.0.0
+
+ org.egov
+ chatbot
+ 1.1.5-SNAPSHOT
+
+
+ 1.8
+ ${java.version}
+ ${java.version}
+
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.2.6.RELEASE
+
+
+
+
+ src/main/java
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+
+
+ org.springframework.kafka
+ spring-kafka
+
+
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-jdbc
+
+
+
+ org.postgresql
+ postgresql
+ 42.2.5
+
+
+ org.flywaydb
+ flyway-core
+ 5.2.4
+
+
+
+ com.fasterxml.jackson.dataformat
+ jackson-dataformat-yaml
+ 2.9.8
+
+
+
+
+
+ junit
+ junit
+ 4.12
+ test
+
+
+
+
+
+ org.apache.kafka
+ kafka_2.12
+ 2.4.1
+
+
+
+ org.apache.kafka
+ kafka-clients
+ 2.4.1
+
+
+
+ org.apache.kafka
+ kafka-streams
+ 2.4.1
+
+
+
+
+ org.jgrapht
+ jgrapht-core
+ 1.3.0
+
+
+
+ org.jgrapht
+ jgrapht-io
+ 1.3.0
+
+
+
+ me.xdrop
+ fuzzywuzzy
+ 1.2.0
+
+
+
+
+ org.egov
+ mdms-client
+ 0.0.2-SNAPSHOT
+
+
+
+ org.projectlombok
+ lombok
+ 1.18.2
+ provided
+
+
+ org.slf4j
+ slf4j-api
+ 1.7.25
+
+
+
+
+
+
+
+ repo.egovernments.org
+ eGov ERP Releases Repository
+ https://nexus-repo.egovernments.org/nexus/content/repositories/releases/
+
+
+ repo.egovernments.org.snapshots
+ eGov ERP Releases Repository
+ https://nexus-repo.egovernments.org/nexus/content/repositories/snapshots/
+
+
+ repo.egovernments.org.public
+ eGov Public Repository Group
+ https://nexus-repo.egovernments.org/nexus/content/groups/public/
+
+
+
+
+
diff --git a/chatbot/src/main/java/org/egov/chat/ChatBot.java b/chatbot/src/main/java/org/egov/chat/ChatBot.java
new file mode 100644
index 00000000..9c42dc7c
--- /dev/null
+++ b/chatbot/src/main/java/org/egov/chat/ChatBot.java
@@ -0,0 +1,13 @@
+package org.egov.chat;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class ChatBot {
+
+ public static void main(String args[]) {
+ SpringApplication.run(ChatBot.class, args);
+ }
+
+}
diff --git a/chatbot/src/main/java/org/egov/chat/RemoveTestData.java b/chatbot/src/main/java/org/egov/chat/RemoveTestData.java
new file mode 100644
index 00000000..e5d8b64c
--- /dev/null
+++ b/chatbot/src/main/java/org/egov/chat/RemoveTestData.java
@@ -0,0 +1,72 @@
+package org.egov.chat;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.jayway.jsonpath.DocumentContext;
+import com.jayway.jsonpath.JsonPath;
+import com.jayway.jsonpath.WriteContext;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.client.RestTemplate;
+
+import java.io.IOException;
+import java.util.List;
+
+@Slf4j
+@Controller
+@ConditionalOnProperty( value = "test.data.cleanup.enabled", havingValue = "true")
+public class RemoveTestData {
+
+ @Autowired
+ private JdbcTemplate jdbcTemplate;
+ @Autowired
+ private RestTemplate restTemplate;
+ @Autowired
+ private ObjectMapper objectMapper;
+
+ @Value("${elasticsearch.host}")
+ private String esHost;
+ @Value("${elasticsearch.chatbot.messages.index.name}")
+ private String indexName;
+
+ private static String deleteConversationStateFromDBQuery = "DELETE FROM eg_chat_conversation_state WHERE user_id=?";
+
+ private static String deleteFromElasticsearchByUserIdQuery = "{\"query\":{\"match\":{\"user.userId\":\"\"}}}";
+
+ @RequestMapping(value = "/removetestdata", method = RequestMethod.POST)
+ public ResponseEntity