XState-Chatbot Integration Document

Overview

The XState-Chatbot is a revamped version of the chatbot, which provides functionality to the user to access PGR module services like file complaints, track complaints, 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 citizens when an employee performs any action on the complaint

  • Allow users to search and pay bills of different modules.

  • Allow users to search and view receipts of different modules.

  • Allow users to change the language of their choice to have a better experience.

  • Put user interactions on an elastic search for Telemetry.

Integration Details

Integration Scope

The 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 apps or counters.

Integration Approach

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 the user pass through the 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:- the 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 the WhatsApp provider’s API request format.

Currently, the XState-Chatbot service is using ValueFirst as the WhatsApp Provider. This will require provider-specific environment variables to be configured. If the provider changes then, all these environment variables will also change. A 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 Details

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 a 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 an informational image follow the steps mentioned below

  1. Download the images from the section Information Images for PGR and Open Search

  2. Upload the image into filestore server. Use the upload file API from this postman collection(https://www.getpostman.com/collections/bdb059c5af698f0d81d6)

  3. For PGR information image mention the filestore id here in the environment file.

  4. For open search, the information image mentions the filestore id here in the 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 lists should not be empty - they must contain at least one element)

Configuration of push notification template messages with a button

Template messages with buttons are maintained in the same way as described in the previous section (Configuration of push notification template messages)

There are two types of button message

  • Quick Reply

  • Call To Action

The Value First document below provides more details.

Integration of Bill Payment and Receipt Search feature in Xstate-Chatbot

The integration of the Bill payment and receipt search feature with the chatbot is enabled and disabled by making changes in this file. The payment and receipt search feature can be enabled and vice versa by exporting the respective bill service and receipt service file.

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 the applicable modules are defined in the variable - bill-supported-modules: "WS, PT, TL" -the defined modules will appear in the bill payment and receipt search. In the given example, the modules Water and Sewerage, Property Tax, and Trade license will appear for bill payment and receipt search.

Add the message bundle, validation and service code for locality searcher in egov-bill and egov-receipt file.

Environmental Variables
Description

WHATSAPP_BUSINESS_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

GOOGLE_MAPS_API_KEY

Maps API key to access geocoding feature

ROOT_TENANTID

Contains state level tenantid value

SUPPORTED_LOCALES

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.

PGR_VERSION

Contains PGR version value to use (i.e v1 or v2)

PGR_UPDATE_TOPIC

Depends on PGR version respective PGR update kafka topic name should mention here. Example: If PGR_VERSION: 'v2' then PGR_UPDATE_TOPIC: 'update-pgr-request'

BILL_SEARCH_LIMIT

Limit for showing maximum number of bills on search.

RECEIPT_SEARCH_LIMIT

Limit for showing maximum number of receipts on search.

COMPLAINT_SEARCH_LIMIT

Limit for showing maximum number of complaints on search.

BILL_SUPPORTED_MODULES

Contains the list of modules to be use for bill payment and receipts search.

INFORMATION_IMAGE_FILESTORE_ID

Contains the filestoreid of informational image, which shows how to share the user current location.

OPEN_SEARCH_IMAGE_FILESTORE_ID

Contains the filestoreid of open search informational image, which shows how to use open search pay feature for bill payment

USER_SERVICE_HARDCODED_PASSWORD

This variable contain fixed value of login password and otp. This value has to configured in env-secrets.yaml.

GEO_SEARCH

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 the respective environment yaml file.

Searcher config file:

Cron job mdms entry:

Localisation for PGR service

Information Images for PGR and Open Search

Reference Docs

Title
Link

Chatbot Message Localisation

nlp-search engine

API List

Title
Link

/xstate-chatbot/message

/xstate-chatbot/reminder

/xstate-chatbot/status

Last updated

​All content on this page by eGov Foundation is licensed under a Creative Commons Attribution 4.0 International License.