DeveloperPlayBook
Python
Python
  • Introduction
  • Architecture
    • Technology Stack
    • ADR Records
  • Design
  • Bootstraping
  • Development Environment
    • Accounts (AWS, GCP, CircleCI)
  • Services/API
    • Serverless
    • Containers
    • Python
    • Firebase
    • Chatbots
    • Testing
  • Frontend
    • Serverless
    • Containers
    • Chatbot
  • Plattform
  • IAM - IAMaaS
  • Persistance - DBaaS
    • Serverless
    • Container
  • Event Driven / Streaming aaS
    • Kinesis
  • AI - AIaaS
  • Production / Reliability Engineering
  • create-k8s-secrets
  • VI
  • Tools
Powered by GitBook
On this page
  • Architecture Decisions
  • Dialogflow
  • Getting Started
  • Implement the intent
  • Implement the fulfilment
  • Test a chatbot - manually & unit test
  • Connect the Chatbot to Facebook Messanger
  • Integrate fulfilment with REST Python AWS Lambda (e.g. "analyse my bmi trend")
  1. Services/API

Chatbots

PreviousFirebaseNextTesting

Last updated 7 years ago

Architecture Decisions

  • ADR-0005 - Use Dialogflow for chatbots

Dialogflow

Getting Started

Implement the intent

Guide: Google Documenation

Model your Dialog

Here is the plantuml activity diagram

Create a "Default Welcome Intent" with answers: "Hi I am your personal trainer, let me advice you on your health. I can currently calculate your BMI, store the BMI and advices you on your BMI."

Implement a "mange_bmi" intent

After creating the intent add training phrases and activate webhook fulfilment (this is required to check if allready a user exists for this profile):

Do the same for the update_bmi intent (training phrase: My hight is 177 cm, I weigh 80 kg and my birthday is 19.12.1987). How to handle partial dates (https://miningbusinessdata.com/dialogflow-tutorial-setting-context-from-your-inline-webhook-using-contextout/)

Implement the fulfilment

Using Firebase

To start it makes sense to implement all fulfillments in one webhook on firebases. Later for more complex logic it is adviced to move this logic to it's own webhooks that are then called from the fulfillment webhook. For more details see the later section.

Setup Firebase (https://den.gitbook.io/developerplaybook/services-api/firebase)

mkdir fulfillment-router
firebase login
firebase init

Guide: Google Documentation

  • "we highly recommend that you use the Node.js client library to process requests and return responses"

Using a Webhook with AWS Lambda

First build a webhook with a fullfilment router

https://medium.com/@pallavtrivedi03/how-to-make-a-webhook-for-dialogflow-fulfillment-d02835cc50bf

Test a chatbot - manually & unit test

Connect the Chatbot to Facebook Messanger

Integrate fulfilment with REST Python AWS Lambda (e.g. "analyse my bmi trend")

Sample: https://github.com/miningbusinessdata/apiai-python-webhook/blob/master/app.py

Client libraries overview  |  Dialogflow ES  |  Google CloudGoogle Cloud
http://dialogflow-python-client-v2.readthedocs.io/en/latest/?#using-dialogflowdialogflow-python-client-v2.readthedocs.io
"Manage BMI" Dialog
Logo