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 filing complaints, tracking complaints and notifications from WhatsApp. It allows the user to view receipts and pay bills for Property, Trade Licence, Fire NOC, 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 searching and viewing bills/past payment receipts and to improve speed and convenience for bill payments. 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 counter.

Integration Approach

Integration of New Whatsapp Provider

Whatsapp provider is a third-party service that acts as an intermediary between the user WhatsApp client and the XState-Chatbot server. All messages coming/going to/from the user pass through the WhatsApp provider. The chatbot calls the WhatsApp provider to send messages to the user. When a user responds to any WhatsApp message the WhatsApp provider calls the Chatbot service configured endpoint with details like messages sent by the user, the sender 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. The final output from the chatbot is also 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’.

Adding Information Images 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 the filestore server. Use the upload file API from the Postman collection here.

  3. For the 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.

Value First Whatsapp User Guide

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 to the list present in the environment file.

For example: If the application modules are defined in the variable - bill-supported-modules: "WS, PT, TL" -the defined modules appear in the bill payment and receipt search. In the given example, the modules Water and Sewerage, Property Tax, and Trade License appear for bill payment and receipt search.

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

Environmental VariablesDescription

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 the 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

API List

Last updated

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