XState-Chatbot Integration Document
Overview
XState-Chatbot is a revamped version of the chatbot, which provides functionality to the user to access PGR module services like file complaint, track complaint, notifications from whats app, It allows the user to view receipts and pay the bills for Property, Trade Licence, FireNOC, Water and Sewerage and BPA service module.
Key Functionalities
File PGR complaint
Track PGR complaint
Support images when filing complaints
Notifications to citizen when an employee performs any action on the complaint
Allow user to search and pay bills of different modules.
Allow user to search and view receipts of different modules.
Allow user to change the language of their choice to have a better experience.
Put user interactions on an elastic search for Telemetry.
Integration
Integration Scope
XState chatbot can be integrated with any other module to improve the ease of search and view bills/past payment receipts and to improve speed and convenience for bill payment. It can be integrated with the PGR module for easiness of creation and tracking of the complaint.
Integration Benefits
Increase in convenience and ease of making the bill payment.
Increase in no. of users opting for online payment.
Improvement in demand collection efficiency
Creating an additional channel for payment.
Remove dependency on mobile/web app or counter.
Integration Details
Integration of New Whatsapp Provider
Whatsapp provider is a third-party service that works in the middle of a user's WhatsApp client and XState-Chatbot server. All messages coming/going to/from user pass through WhatsApp provider. Chatbot calls WhatsApp provider to send messages to the user. When a user responds with any WhatsApp message the WhatsApp provider calls Chatbot service’s configured endpoint with details ex:- user sent message, sender’s number etc.
If any new WhatsApp provider is to be used with a chatbot, code must be written to convert the provider’s incoming messages to the format that the chatbot understands and also final output from the chatbot should be converted to WhatsApp provider’s API request format.
Currently, the XState-Chatbot service is using ValueFirst as the WhatsApp Provider. This will require provider-specific environment variable to be configured. If the provider changes then, all these environment variable will also change. Few of those environment variables are stored as secrets, so these values need to be configured in env-secrets.yaml.
As this is a revamped version of the chatbot service, all of the secrets should already be present. There is no need to create new secrets.
Integration of PGR complaint feature in XState-Chatbot
The integration of PGR with a chatbot can be enabled and disabled by making changes in this file. By exporting the respective PGR service file, the PGR service feature can be sable and vice versa.
Configuration of PGR version in chatbot
To configure the PGR module to use in Xstate-chatbot - the below variable values need to change in the environment file as per the requirement.
pgrVersion
pgrUpdateTopic
To configure PGR v2 in XState chatbot then pgrVersion should be ‘v2' and pgrUpdateTopic should be 'update-pgr-request’.
Configuration of city and locality search with nlp-search engine
To enable the fuzzy search for city and locality selection in PGR complaint flow The variable nlp-geoSearch has to be set true in the environment file. To use the nlp-search engine with xstate chatbot, make sure that stable build is deployed and all the mdms data are present for that particular environment. To know more about the nlp-search engine service please refer to the Reference document section.
Adding Information Image in PGR complaint creation and Open search information image
To configure the filestoreid for informational image follow the steps mention below
Download the images from the section Information Images for PGR and Open Search
Upload the image into filestore server. Use the upload file API from this postman collection(https://www.getpostman.com/collections/bdb059c5af698f0d81d6)
For PGR information image mention the filestore id here in environment file .
For Open search information image mention the filestore id here in environment file .
For example:
a) if supportedLocales: process.env.SUPPORTED_LOCALES || 'en_IN,hi_IN'
then valuefirst-notification-resolved-templateid: "12345,6789"
b) if supportedLocales: process.env.SUPPORTED_LOCALES || 'hi_IN,en_IN'
then valuefirst-notification-resolved-templateid: "6789,12345"
(Note: Both the list should not be empty, it must contain at least one element)
Configuration of push notification template messages with button
Template messages with button are maintained in the same way as describe in previous section (Configuration of push notification template messages)
There are two type of button message
Quick Reply
Call To Action
More details can be found in the value first document.
Integration of Bill Payment and Receipt Search feature in Xstate-Chatbot:
The integration of the Bill payment and receipt search feature with the chatbot can be enabled and disable by making changes in this file. By exporting the respective bill service and receipt service file, the payment and receipt search feature can be enabled and vice versa.
Configuration of module for Bill payment and Receipt search
To configure the list of modules to appear as an option for payment and receipt, Add the module business service code in the list present in the environment file.
For example:
If bill-supported-modules: "WS, PT, TL"
then Water and Sewerage, Property, Trade license module would appear for bill payment and
receipt search.
Also add the message bundle, validation and service code for locality searcher in egov-bill and egov-receipt file.
Environment Variables | Description |
| The mobile number to be used on server |
| Username for configured number for sending messages to user through whatsapp provider API calls |
| Password for configured number for sending messages to user through whatsapp provider API calls |
| Maps API key to access geocoding feature |
| Contains state level tenantid value |
| This variable contains the list supported language in chatbot. If there is a need to add new language in chatbot, then its respective locale need to add in this list. |
| Contains PGR version value to use (i.e v1 or v2) |
| Depends on PGR version respective PGR update kafka topic name should mention here. Example: If |
| Limit for showing maximum number of bills on search. |
| Limit for showing maximum number of receipts on search. |
| Limit for showing maximum number of complaints on search. |
| Contains the list of modules to be use for bill payment and receipts search. |
| Contains the filestoreid of informational image, which shows how to share the user current location. |
| Contains the filestoreid of open search informational image, which shows how to use open search pay feature for bill payment |
| This variable contain fixed value of login password and otp. This value has to configured in env-secrets.yaml. |
| Boolean flag to enable and disable city / locality nlp search |
Configuration of Telemetry File
Add this telemetry file in config repo and mention the filename in respective environment yaml file.
Searcher config file:
Cron job mdms entry:
Localisation for PGR service
Information Images for PGR and Open Search
Reference Docs
Doc Links
Title | Link |
Chatbot Message Localisation | |
nlp-search engine |
API List
Title | Link |
/xstate-chatbot/message | |
/xstate-chatbot/reminder | |
/xstate-chatbot/status |
Last updated