Chatbot service is a chatbot which provides functionality to the user to access PGR module services like filing complaints, tracking complaints, and notifications from WhatsApp. Currently, the citizen has three options - to start a conversation scan the QR code, give a missed call or directly send a message to configured WhatsApp number.
Prior knowledge of Java/J2EE.
Prior knowledge of SpringBoot.
Prior knowledge of PostgreSQL.
Prior knowledge of REST APIs and related concepts like path parameters, headers, JSON etc.
Prior knowledge of JSONQuery in Postgres. (Similar to PostgreSQL with a few aggregate functions.)
egov-user-chatbot
: For creating a user without name validation and logging in the user
egov-user
: For searching users
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
Chatbot service allows citizens to access PGR service through WhatsApp. Citizens can provide all details required to create a PGR complaint through the question-and-answer method. The service continuously listens to the PGR update Kafka topic and sends notifications to users associated with the PGR record. On any message from a citizen which is forwarded by a WhatsApp provider, the chatbot processes the messages by passing messages through various stages. For instance - validations, enrichment, transformations etc and at the end sends the final response to the user by calling the endpoint of the WhatsApp provider.
There are two types of configurations for chatbot states:-
Configuration for each state in chatbot, ex:-
Graph adjacency list configuration:- to define flow between chatbot states,ex:-
High-Level diagram of chatbot interactions
Flow Diagram of Chatbot-User conversation
Flow Diagram of Chatbot notifications
Add configs required for chatbot service.
Deploy the latest version of the chatbot service.
Add role-action mapping for APIs.
The chatbot service is used to communicate with the users, lodge their complaints or provide miscellaneous/ad-hoc services which citizens avail from ULBs in an interactive way over WhatsApp.
Can perform service-specific business logic without impacting the other module.
In the future, if we want to expose the application to citizens then it can be done easily.
The workflow or Service-specific workflow can be enabled at the chatbot level at any time without changing the design.
To integrate, the host of the chatbot module should be overwritten in the helm chart.
POST /messages
should be added as the endpoint for receiving user-sent messages and forwarding them to the chatbot core logic for further processing and sending back the response.
GET /messages
should be added as the endpoint for receiving user-sent messages and forwarding them to chatbot core logic for further processing and sending back responses.
a) POST /messages
Receive the user-sent messages and forward them to chatbot core logic for further processing and sending back responses.
If the media_type
parameter value is text
then user input would be sent in the parameter text
, in other cases where media_type
have some other value ex:- image, location etc, the user input would be sent in a parameter media_data
b) GET /messages
Receive the user-sent message and forward it to the chatbot core logic for further processing and sending back responses.
If the media_type
parameter value is text
then user input would be sent in the parameter text
, in other cases where media_type
have some other value ex:- image, location etc, the user input would be sent in a parameter media_data
update-pgr-service
: used in update.pgr.service.topic
application property, the chatbot listens on this topic to listen for updates on PGR records and then to send notifications to users.
The service uses consumers for internal processing also between different stages.
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.
Title | Link |
---|---|
API Swagger Documentation