Goal: To onboard developers onto chatbot code base so that they can modify existing flows or create new ones
Getting started
Prerequisites
javascript developer
Github
SOA
Checkout code
Install …
Recommended IDE: VSCode
Postman
Run code
using react-app
using node.js
When to use one vs other
Overall philosophy
No NL
Simple form fill
State machine approach
Introduction to x-state
Required reading ….
Developing
Introduction to project structure (quick)
Channels
Session manager
Machines
...
Understand current dialog flow -
Have the new developer interact with existing modules using react-app
How to use visual representation and IDE to understand dialog state including hierarchy / Understand how that flow is provided in the code
General patterns
Hierarchical structure
Typical structure 1 - preprocess -> question -> process -> error or transition
onEntry, onEvent, invoke-onDone, always ...
When to queue messages vs when to call toUser()
Scaffolding
Understand how session manager works
Channels
envconfig
Telemetry
Localization
Handling location - Google APIs
What is Postgres used for
What is ElasticSearch used for. Sanctifying user info
Best practices
Naming convention
Testing
How to handle large lists
Escape to the web, e.g., city & locality
Two-level structure, e.g., complaint type
Always monitor DROP OFF / COMPLETION for three months when introducing new dialog in the field
Future thoughts
Developer - Test
Changing prompt and response
Modifying dialog flow
Rearranging questions
Adding a new question
Adding a conditional question
Developing new dialog
Build ELK dashboard to understand drop off funnel
Operations
What do we have deployed today. Systems diagram ….
ELK
Initial Setup
Git - In macOS, most probably, it comes preinstalled. Git Installation Guide
Visual Studio Code (VSCode) - Great for Node JS Project Management
Install NodeJS
If you have HomeBrew, an easier way to install would be “brew install node”
After installing you should be able to run
node -v
npm -v
GitHub Repository - XState-Chatbot
Open this folder in the VSCode
Terminal could be opened within the VSCode (Ctrl + `)
For the first time installing dependencies: “npm install”
To run the app: “npm start”
To run the nodejs-server version of the code:
brew install cask postgresql
Install PostgreSQL (username - postgres, password - postgres, host - localhost, port - 5432). If the values differ, please modify those in the app.
Create a database named “chat”
Run the .sql files present in /db/migration/main folder
NodeJS Project Convention
All file and folder names in kebab-case
Class names in PascalCase. Variable names in camelCase
Development Path
Dummy service | eGov service | |
In-Memory database | react (1) - initial dialog dev, external developers nodejs | react (2) - dialog hardening and testing nodejs |
Postgres database (NA for React) | nodejs | nodejs (3) - staging and production |
Message Format
Text
User input
Location
Geocode (lat, long) pair
Street address
Binary
Image
PDF
Add Comment