Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

Goal: To onboard developers onto chatbot code base so that they can modify existing flows or create new ones

Prerequisites

  1. Getting started 

    1. Prerequisites

      1. javascript developer

      2. Github

      3. SOA

    2. Checkout code

    3. Install …

      1. Recommended IDE: VSCode

      2. Postman

    4. Run code 

      1. using react-app

      2. using node.js

      3. When to use one vs other

  2. Overall philosophy

    1. No NL

    2. Simple form fill

    3. State machine approach

  3. Introduction to x-state

    1. Required reading ….

  4. Developing

    1. Introduction to project structure (quick)

      1. Channels

      2. Session manager

      3. Machines

      4. ...

    2. Understand current dialog flow - 

      1. Have the new developer interact with existing modules using react-app

      2. How to use visual representation and IDE to understand dialog state including hierarchy / Understand how that flow is provided in the code

      3. General patterns

        1. Hierarchical structure

        2. Typical structure 1 - preprocess -> question -> process -> error or transition

        3. onEntry, onEvent, invoke-onDone, always ... 

        4. When to queue messages vs when to call toUser()

    3. Scaffolding

      1. Understand how session manager works

      2. Channels

      3. envconfig

      4. Telemetry

      5. Localization

      6. Handling location - Google APIs

      7. What is Postgres used for

      8. What is ElasticSearch used for. Sanctifying user info

    4. Best practices

      1. Naming convention

      2. Testing

      3. How to handle large lists

        1. Escape to the web, e.g., city & locality

        2. Two-level structure, e.g., complaint type

      4. Always monitor DROP OFF / COMPLETION for three months when introducing new dialog in the field

    5. Future thoughts

  5. Developer - Test

    1. Changing prompt and response

    2. Modifying dialog flow

      1. Rearranging questions

      2. Adding a new question

      3. Adding a conditional question 

    3. Developing new dialog

    4. Build ELK dashboard to understand drop off funnel

  6. Operations

    1. What do we have deployed today. Systems diagram ….

    2. ELK


...

Initial Setup

  1. Git - In macOS, most probably, it comes preinstalled. Git Installation Guide

  2. Visual Studio Code (VSCode) - Great for Node JS Project Management

  3. Install NodeJS

    1. If you have HomeBrew, an easier way to install would be “brew install node”

    2. After installing you should be able to run

      1. node -v

      2. npm -v

  4. GitHub Repository - XState-Chatbot

    1. Open this folder in the VSCode

    2. Terminal could be opened within the VSCode (Ctrl + `)

    3. For the first time installing dependencies: “npm install”

    4. To run the app: “npm start”

  5. To run the nodejs-server version of the code:

    1. brew install cask postgresql

    2. Install PostgreSQL (username - postgres, password - postgres, host - localhost, port - 5432). If the values differ, please modify those in the app.

    3. Create a database named “chat”

    4. Run the .sql files present in /db/migration/main folder


NodeJS Project Convention


  1. All file and folder names in kebab-case

  2. 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

  1. Text

    1. User input

    2. Location

      1. Geocode (lat, long) pair

      2. Street address

  2. Binary

    1. Image

    2. PDF