dialogFlow Controller Logic - abrazik/AI-Pointment GitHub Wiki

Type of interactions with user

  1. Small talk - Interactions that do not require data from database to be written or read
  2. Find available appointments - User inquires about available appointment times - READ FROM DATABASE
  3. Schedule an available appointment - User affirms their intent to book a specific appointment - WRITE TO DATABASE

1. Small talk interaction flow

  1. User enters message into text box on UI
  2. User clicks submit button
  3. User message from text box is sent to server via POST request, wait for POST request response
  4. POST request is received on server
  5. Intent is read from response
  6. POST request response message, and response context, is formatted into JSON
  7. JSON response is sent to user
  8. POST request response is received by user
  9. Chat response is added to BOT side of message conversation

2. Find available appointments interaction flow

  1. User enters message into text box on UI
  2. User clicks submit button
  3. User message from text box is sent to server via POST request, wait for POST request response
  4. POST request is received on server
  5. Intent code is read from response
  6. Available appointments are read from database
  7. Available appointments, response message, and response context are formatted into JSON
  8. JSON sent to user from server
  9. POST request response is received by user
  10. Chat response is added to BOT side of message conversation

3. Schedule an available appointment

  1. User enters message into text box on UI
  2. User clicks submit button
  3. User message from text box is sent to server via POST request, wait for POST request response
  4. POST request is received on server
  5. Intent code is read from response
  6. Date and time variables are read from response
  7. Appointment is written to database
  8. Appointment time and date, response message, and response context are formatted into JSON
  9. JSON sent to user from server
  10. POST request response is received by user
  11. Chat response is added to BOT side of message conversation

POST request response JSON format

const postReq = {
    response: /*MESSAGE FROM GOOGLE CHATBOT AI*/,
    context: /*MESSAGE CONTEXT FROM GOOGLE CHATBOT AI*/
}
⚠️ **GitHub.com Fallback** ⚠️