Skip to content
A chatbot built for the charity Chayn using the dialog flow API, node, React, postgreSQL and Google sheets API
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Little Window


The Little Window app is avaliable here

User Story

‘Direct users quickly and safely to the correct resource so that users can feel informed and empowered to read further.’

Our Solution

A chat bot to help those who have suffered from domestic abuse to access resources quickly and safely

The aims of the solution:

  • To provide information within a 15 minute window
  • To provide effective real-time service
  • Ensure a safer digital footprint
  • To provide accessible and engaging information
  • To raise awareness on domestic abuse

The app


What it will look like on the Chayn website


Tech stack

  • DialogFlow (Natural Language Processor)
  • GoogleSheets API
  • React
  • Node / Express
  • PostgreSQL
  • Heroku

Software Architecture


Our Conversation Flow (Divorce Route Example)


How to run locally

You will need before hand:

  • Dialogflow account & key
  • Googlesheets API key
  • 2 x PostgreSQL Databases


  1. Clone the repo: git clone
  2. Install dependencies npm install
  3. Create a config.env in the root directory. This will need:
  1. Login to your prod db and run db_build.sql
  2. Run the app in dev mode: npm run dev


  1. Run npm test in the command line
  2. Run cd client then npm test to run React tests

Setting up Dialogflow

You can setup your conversation flow in Dialogflow using the following guidelines:


  • All intents need to send back a custom payload, even if it's just an empty object

Option buttons

  • For options buttons, send an options property in the custom payload. This is an array of objects for each button, where each object contains a text and postback key & value. text is the value that will appear on the button, postback is the actual value that will be sent to Dialogflow - this should map to the utterance of next intent you want to trigger with that button.

  • If it is intended that by selecting the relevant option that resources will be displayed to the user, the postback on the button should also be the reference for the server to lookup the correct columns in a Google Sheet.

  • The message that is then returned by Dialogflow in response to the postback should contain a value of "resources": "true", which then triggers this lookup:

Selecting multiple buttons

  • If it is intended that multiple options can be selected for a set of buttons, which are then submitted:

  • Then the payload should contain a selectOptions property which is an array of objects for each option, where each object contains a text, postback and lookup value. However in contrast to the button options, instead of the postback being the lookup to the Google Sheet, the lookup value should map to the relevant columns in the Google Sheet. The user can then select multiple options before submitting.

Multiple messages

  • Where multiple messages are to be displayed to the user, without any user input, each message where there should be a followup message from the bot should contain a retrigger property for which the value maps to the utterance for the intent for the next message:

Message speed

  • As in the above screenshot, each message can be given a time delay in the payload of slow (5secs) or superslow (8secs) to slow down the speed of a given bot response. The standard speed is 1.5secs.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.