Versions Compared

Key

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

...

Prerequisites

  • NodeJS

  • XState

  • PostgreSQL

  • Kafka(optional)

Key Functionalities

  • Build a chat flow to facilitate a user to interact with rainmaker modules

  • Link a chat flow with backend services

Deployment Details

  1. Deploy the latest version of xstate-chatbot

  2. Configure /xstate-chatbot to be a whitelisted open endpoint in zuul

  3. Add indexer-config to the egov-indexer to index all the telemetry messages

Environment Variable

Description

WHATSAPP_PROVIDER

The provider through which WhatsApp messages are sent & received. An adapter for ValueFirst is written. If there is any new provider a separate adapter will have to be implemented.

A default console adapter is provided for developers to test the chatbot locally.

REPO_PROVIDER

The database used to store the chat state. Currently, an adapter for PostgreSQL is provided.

An InMemory adapter is provided to test the chatbot locally

SERVICE_PROVIDER

If it’s value is configured to be eGov, it will call the backend rainmaker services. If the value is configured as Dummy, dummy data would be used rather than fetching data from APIs.

Dummy option is provided for initial dialog development, and is only to be used locally.

SUPPORTED_LOCALES

A list of comma separated locales supported by the chatbot.

Other configuration details are mentioned as part of the XState-Chatbot Integration Document.

Overall Philosophy of Chatbot

...

  1. The chat states would only include dialog-specific code. Any code related to backend service should be written as a part of a separate …-service.js file.

  2. Any code that doesn’t include any asynchronous API call can be written as a part of the onEntry function or an action.

  3. If the function needs to make an API call, that would have to be written with the invoke-onDone pattern. The asynchronous function should be written as a part of the service file. The consolidated data returned by it can be processed in the state of the dialog file.

  4. Helper functions are written in dialog.js file. It is advised to use those functions as much as possible rather than writing any custom logic in dialog files.

...