...
Prior Knowledge of Javascript.
Prior Knowledge of NodeJS
Prior Knowledge of REST APIs and related concepts like path parameters, headers, JSON etc.
Prior Knowledge of PostgresSQL
Prior Knowledge of Kafka and related concepts like Producer, Consumer, Topic, Kafka StreamsĀ etc.
Prior knowledge of XState library. Please refer the following link:
https://digit-discuss.atlassian.net/wiki/spaces/DD/pages/1174634508/XState+Core+Chatbot#Basic-Introduction-to-XState
Features:
Raise a complaint
Provide a feedback
Provide rating on a service.
Notifications to citizen after receiving complaint/feedback/rating.
...
{
"message": {
"type": "text",
"input": "1"
},
"user": {
"mobileNumber": "73919044677878787878"
},
"extraInfo": {
"filestoreId": "917834811114",
"applicationId": "PB-MT-107-000754",
"comments": "User complaint comments"
}
}
...
id : id of state,ex:-
citizenComplaint
initial : initial state, ex:-
complaintCategory
onEntry : function to be executed on entry, ex:- onEntry: assign((context, event) => { const message = dialog.get_message(messages.complaintMenu.prompt, context.user.locale); const grammer = dialog.constructContextGrammer(messages.complaintMenu.options.list, messages.complaintMenu.options.messageBundle, context.user.locale); context.grammer = grammer; dialog.sendMessage(context, message, true); })
target : target state
invoke : make a call to an external service
Refer this file for an example
https://github.com/egovernments/DIGIT-Dev/blob/CITIZEN_FEEDBACK_WEBCHAT/core-services/xstate-webchat/nodejs/src/machine/citizen-complaint.js
Modifying the chat flow
The workflow for the chatbot uses the concept of finite state machines which is developed using Xstate library Machine. The workflow implementation is present in nodejs/src/machine/
. To modify the workflow, please make changes to those file.
...
Any external api calls are written as part of files present in nodejs/src/machine/service
which would get called from the state machine.
Localization
The message temples are saved in the following file. In case any more messages are required to be added, it should be done in the same file.
https://github.com/egovernments/DIGIT-Dev/tree/CITIZEN_FEEDBACK_WEBCHAT/core-services/xstate-webchat/nodejs/src/machine/messages
Flow Diagram:
High Level Diagram of chatbot interactions
...