Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

Dialogflow

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

App-Structure

Slide 6

Slide 6 text

Base concepts ● Intents ● Entities ● Fulfillment ● Context ● Events @RittmeyerW

Slide 7

Slide 7 text

Permissions ● For some things you need the user‘s consent – User name – Fine or coarse location – Push actions – Repeated actions @RittmeyerW

Slide 8

Slide 8 text

Visual Elements ● Only on devices with visual interface – Cards with images, text and links – Lists – Carousel – Suggestion chips @RittmeyerW

Slide 9

Slide 9 text

SSML ● Makes text to speech more lively ● Supports – breaks – cardinals / ordinals / date / characters – audio / media – emphasis ● Doesn‘t support other languages ● https://github.com/mandnyc/ssml-builder @RittmeyerW

Slide 10

Slide 10 text

Fulfillment ● It‘s just JSON going back and forth ● It has to use TLS ● For real projects: Use Cloud Functions / AWS Lambda ● For the hackathon: – Use a local server – Expose it via ngrok ● Your backend has roughly five seconds time @RittmeyerW

Slide 11

Slide 11 text

Fulfillment ● Google libs for JS: https://github.com/actions-on-google/actions-on-google-nodejs ● Google libs for Java/Kotlin: https://github.com/actions-on-google/actions-on-google-java ● Json Spec https://developers.google.com/actions/build/json/dialogflow-webhook-json @RittmeyerW

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

Dialogflow-Demo

Slide 15

Slide 15 text

Initialisation const { dialogflow, Image, Suggestions, Carousel, //... } = require('actions-on-google'); const app = dialogflow(); // or: const app = dialogflow( {debug: true} ); @RittmeyerW

Slide 16

Slide 16 text

Normal speech app.intent('welcome', conv => { conv.ask('Hi, welcome back to Fast Journey?'); conv.ask('You can ask to review booked journeys or start booking a new one.'); conv.ask('Which would you like to do: Revisit an existing booking or booking a new trip?'); }); @RittmeyerW

Slide 17

Slide 17 text

Parameters app.intent('suggestion', (conv, {number}) => { conv.close(`Here's the number: ${number}`) }); @RittmeyerW

Slide 18

Slide 18 text

Parameters app.intent('suggestion', (conv, params) => { if (params.number !== '') { conv.ask(`Your lucky number is: ${params.number}`); } else { conv.ask('I still need your number'); } }); @RittmeyerW

Slide 19

Slide 19 text

Ending a conversation app.intent('bye', conv => { conv.close('Thanks. It was a pleasure talking to you!') }); @RittmeyerW

Slide 20

Slide 20 text

Rich responses conv.ask(new Carousel({ title: 'Carousel Title', items: { // Add the first item to the carousel 'SELECTION_KEY_ONE': { synonyms: [ 'synonym 1', 'synonym 2', ], title: 'Title of First Carousel Item', description: 'This is a description of a carousel item.', image: new Image(/*...*/) , }, // ... } } )); @RittmeyerW

Slide 21

Slide 21 text

Rich responses @RittmeyerW

Slide 22

Slide 22 text

Rich responses app.intent('helper.option', (conv, params, option) => { const SELECTED_ITEM_RESPONSES = { 'SELECTION_KEY_ONE': 'You selected the first item', 'SELECTION_KEY_GOOGLE_HOME': 'You selected the Google Home!', 'SELECTION_KEY_GOOGLE_PIXEL': 'You selected the Google Pixel!', }; conv.ask(SELECTED_ITEM_RESPONSES[option]); conv.ask('Which response would you like to see next?'); }); @RittmeyerW

Slide 23

Slide 23 text

Async work app.intent('welcome', conv => { return somePromise() .then(promiseResult => { conv.ask(promiseResult); }); }); app.intent('welcome', async conv => { let result = await somePromise(); conv.ask(result); }); @RittmeyerW

Slide 24

Slide 24 text

Integration ● Probably best for the hackathon is to use Express const express = require('express') const bodyParser = require('body-parser') // ... app code here const expressApp = express().use(bodyParser.json()) expressApp.post('/fulfillment', app) expressApp.listen(3000) @RittmeyerW

Slide 25

Slide 25 text

URLs ● Dialogflow Docs https://cloud.google.com/dialogflow/docs/ ● Dialogflow console https://dialogflow.cloud.google.com/ @RittmeyerW

Slide 26

Slide 26 text

Account Linking ● If you want to use existing accounts (like Hermes does) ● Different methods (with or without Oauth) ● Not recommended for the hackathon ● But definitely for existing services when going live @RittmeyerW

Slide 27

Slide 27 text

Cross Platform

Slide 28

Slide 28 text

Libs ● AssitantJS https://github.com/webcomputing/AssistantJS ● Jovo Framework https://github.com/jovotech/jovo-framework-nodejs @RittmeyerW

Slide 29

Slide 29 text

Voice UX

Slide 30

Slide 30 text

Books ● Cathy Pearl: Designing Voice User Interfaces ● Amir Shevat: Designing Bots ● Erika Hall: Conversational Design https://abookapart.com/products/conversational-design @RittmeyerW

Slide 31

Slide 31 text

Online ● Recommendations by Google – https://developers.google.com/actions/design/ ● Recommendations by Amazon – https://developer.amazon.com/ask-resources/guided/conversational- design-workshop#/ @RittmeyerW

Slide 32

Slide 32 text

No content