Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jlengrand/dialogflow-fun
This repository contains the code for my talk at JFuture (https://jfuture.dev/#talk_Julien_Lengrand-Lambert)
https://github.com/jlengrand/dialogflow-fun
agent cloud dialogflow google-cloud openbanking psd2
Last synced: about 2 months ago
JSON representation
This repository contains the code for my talk at JFuture (https://jfuture.dev/#talk_Julien_Lengrand-Lambert)
- Host: GitHub
- URL: https://github.com/jlengrand/dialogflow-fun
- Owner: jlengrand
- Created: 2019-10-10T15:57:55.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-11-18T20:38:50.000Z (about 5 years ago)
- Last Synced: 2024-12-23T16:54:26.491Z (about 2 months ago)
- Topics: agent, cloud, dialogflow, google-cloud, openbanking, psd2
- Language: Java
- Homepage:
- Size: 91.8 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DialogFlow fun
[![CircleCI](https://circleci.com/gh/jlengrand/dialogflow-fun/tree/master.svg?style=svg)](https://circleci.com/gh/jlengrand/dialogflow-fun/tree/master)
This repository contains the code used in my "Hey Google, send 20$ to Mum" talk at [JFuture](https://jfuture.dev/) in November 2019.
You can find the slides of this talk in [this other repository](https://github.com/jlengrand/google-send-money-talk).It is not directly possible for you to just clone this repository and get it working because it depends on environments that I used for the talk. I deploy my app on Google App Engine and some of the credentials are privately stored.
The whole dialogflow agent will also be created live, except for the contact entity.## Technology used
* The backend for this talk is built using **Java 11**. I wanted to use **Kotlin** for a while but decided to have some Java fun instead.
* The backend is a simple [Spring Boot](https://spring.io/projects/spring-boot) REST application. Great to start kicking fast.
* The virtual assistant used is Google's [dialogFlow](https://dialogflow.com/).
* The Banking PSD2 demo is built on top of the [OpenBankProject](https://www.openbankproject.com/). They provide a nice 'Bank as a service' API with cool sandboxes, and some are PSD2 compliant.
## Some pointers in the codeThe project is composed of several modules.
* The agent folder contains a zipped version of the DialogFlow agent I will build live. You should be able to import it.
* The `dialogflow-fun-agent` module contains a few routines that interact with an agent using the DialogFlow API.
* The `CreateAgent` class especially creates an agent based on input from a text file.
* The `dialogflow-fun-api` module contains a simple REST API that the DialogFlow agent will interact with. It is the 'backend' of the application.
* The backend is essentially a proxy between the DialogFlow fulfillment requests on one hand, and the OpenBankProject sandboxes on the other hand.
* The entry point of the application is `DialogFlowFunApiApplication`. It hosts the controller used for the Agent fulfillment.
* Most of the PSD2 magic happens in the `OpenBankClient` class. It is a simple class that makes authenticated REST GET and POST calls to the sandbox under the hood.
* The `DialogFlowService` class is tasked with converting fulfillment requests into fully fledged PSD2 API calls.
* The `UserAccountLookup` class is a dirty trick used for the demo to link users and bank accounts. This would have to be done differently for an actual app :).## Useful references (for potential readers of this repo :)
- [Reference guide](https://cloud.google.com/dialogflow/docs/reference/libraries/java)
- [Full library reference](https://googleapis.dev/java/google-cloud-clients/latest/index.html?com/google/cloud/dialogflow/v2/package-summary.html)
- [Maven dependency](https://search.maven.org/artifact/com.google.cloud/google-cloud-dialogflow/0.114.0-alpha/jar)
- [Authentication](https://cloud.google.com/docs/authentication/getting-started)
- [Transaction Types](https://github.com/OpenBankProject/OBP-API/wiki/Transaction-Requests)## Missing information
If you want to run the code yourself, you'll need to have an *OpenBankProject* account and update the `dialogflow-fun-api/src/main/appengine/app.yaml` file to contain the following (with updated values):
```
env_variables:
OPENBANKPROJECT_USERNAME: 'yourUsername'
OPENBANKPROJECT_PASSWORD: 'Bnj0VyuI127SN7yjwfwfet'
OPENBANKPROJECT_CONSUMERKEY: 'c4vkdziyokjfhwekfjhwek50oblsolo5f1g1k2tdyu2'
```
## Google Resources (for me to remember before the talk)- Google Cloud project name : [dialogflow-fun](https://console.cloud.google.com/apis/library?project=dialogflow-fun)
- [View logs](https://console.cloud.google.com/logs/viewer?project=dialogflow-fun&minLogLevel=0&expandAll=false×tamp=2019-10-23T07:50:18.827000000Z&customFacets=&limitCustomFacetWidth=true&dateRangeStart=2019-10-23T06:50:19.080Z&dateRangeEnd=2019-10-23T07:50:19.080Z&interval=PT1H&resource=gae_app%2Fmodule_id%2Fdefault&logName=projects%2Fdialogflow-fun%2Flogs%2Fstdout&logName=projects%2Fdialogflow-fun%2Flogs%2Fstderr&logName=projects%2Fdialogflow-fun%2Flogs%2Fappengine.googleapis.com%252Frequest_log&scrollTimestamp=2019-10-23T07:48:44.904582000Z)
- [Dialog Flow project](https://dialogflow.cloud.google.com/#/agent/ac522b80-e75b-40cd-9493-269fbb4ef634/intents)
- [App Engine Dashboard](https://console.cloud.google.com/appengine?project=dialogflow-fun&serviceId=default&duration=PT6H)
- [The app in the cloud](https://dialogflow-fun.appspot.com/)