diff --git a/README.md b/README.md index 017b73c..fc1c394 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ This library is intended to be help building Node.js Dialogflow fulfillment for 1. Create a Dialogflow agent 1. [Enable the Cloud Function for Firebase inline editor](https://dialogflow.com/docs/fulfillment#cloud_functions_for_firebase) 1. Copy this code in `samples/quick-start/functions/index.js` the `index.js` file in the Dialogflow Cloud Function for Firebase inline editor. -1. Add `"dialogflow-fulfillment": "^1.0.0"` to the `package.json` file's `dependencies` object in the Dialogflow Cloud Function for Firebase inline editor. +1. Add `"dialogflow-fulfillment": "^0.5.0"` to the `package.json` file's `dependencies` object in the Dialogflow Cloud Function for Firebase inline editor. 1. Click `Deploy` diff --git a/package.json b/package.json index c697eba..d54cf52 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "dialogflow-fulfillment", "description": "Dialogflow Fulfillment Library for Node.js", "main": "src/dialogflow-fulfillment.js", - "version": "0.4.1", + "version": "0.5.0", "license": "Apache-2.0", "author": "Google Inc.", "directories": { diff --git a/samples/actions-on-google/README.md b/samples/actions-on-google/README.md deleted file mode 100644 index 6ba362b..0000000 --- a/samples/actions-on-google/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# Dialogflow Fulfillment Actions on Google Sample - -## Setup -Choose one of the three options listed below for setup. You only need to complete one of the three options below to setup this sample. - -### Option 1: Add to Dialogflow (recommended) -Click on the **Add to Dialogflow** button below and follow the prompts to create a new agent: - -[![Dialogflow Fullfillment: Actions on Google](https://storage.googleapis.com/dialogflow-oneclick/deploy.svg "Dialogflow Fullfillment: Actions on Google")](https://console.dialogflow.com/api-client/oneclick?templateUrl=https%3A%2F%2Fstorage.googleapis.com%2Fdialogflow-oneclick%2Factions-on-google-agent.zip&agentName=ActionsOnGoogleSample) - -### Option 2: Dialogflow Inline Editor -1. [Sign up for or sign into Dialogflow](https://console.dialogflow.com/api-client/#/login) and [create a agent](https://dialogflow.com/docs/agents#create_an_agent) -1. Go to your agent's settings and [Restore from zip](https://dialogflow.com/docs/agents#export_and_import) using the `dialogflow-agent.zip` in this directory (Note: this will overwrite your existing agent) -1. [Enable the Cloud Function for Firebase inline editor](https://dialogflow.com/docs/fulfillment#cloud_functions_for_firebase) -1. Copy this code in `functions/index.js` the `index.js` file in the Dialogflow Cloud Function for Firebase inline editor. -1. Add `"dialogflow-fulfillment": "^0.4.1"` and `"actions-on-google": "^2.1.3"` to the `package.json` file's `dependencies` object in the Dialogflow Cloud Function for Firebase inline editor. -1. Click `Deploy` - -### Option 3: Firebase CLI -1. [Sign up for or sign into Dialogflow](https://console.dialogflow.com/api-client/#/login) and [create a agent](https://dialogflow.com/docs/agents#create_an_agent) -1. Go to your agent's settings and [Restore from zip](https://dialogflow.com/docs/agents#export_and_import) using the `dialogflow-agent.zip` in this directory (Note: this will overwrite your existing agent) -1. `cd` to the `functions` directory -1. Run `npm install` -1. Install the Firebase CLI by running `npm install -g firebase-tools` -1. Login to your Google account with `firebase login` -1. Add your project to the sample with `firebase use [project ID]` [find your project ID here](https://dialogflow.com/docs/agents#settings) -1. Run `firebase deploy --only functions:dialogflowFirebaseFulfillment` -1. Paste the URL into your Dialogflow agent's fulfillment and click `Save` -1. Under the fulfillment section of your `Default Welcome Intent` and `Default Fallback Intent` check the box for `Use webhook` and click `Save` - -## References and How to report bugs -* Dialogflow documentation: [https://docs.dialogflow.com](https://docs.dialogflow.com). -* If you find any issues, please open a bug on [GitHub](https://github.com/dialogflow/dialogflow-fulfillment-nodejs/issues). -* Questions are answered on [StackOverflow](https://stackoverflow.com/questions/tagged/dialogflow). - -## How to make contributions? -Please read and follow the steps in the CONTRIBUTING.md. - -## License -See LICENSE.md. - -## Terms -Your use of this sample is subject to, and by using or downloading the sample files you agree to comply with, the [Google APIs Terms of Service](https://developers.google.com/terms/). diff --git a/samples/actions-on-google/dialogflow-agent.zip b/samples/actions-on-google/dialogflow-agent.zip deleted file mode 100644 index 6980265..0000000 Binary files a/samples/actions-on-google/dialogflow-agent.zip and /dev/null differ diff --git a/samples/actions-on-google/dialogflow-agent/agent.json b/samples/actions-on-google/dialogflow-agent/agent.json deleted file mode 100755 index bac80e8..0000000 --- a/samples/actions-on-google/dialogflow-agent/agent.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "description": "", - "language": "en", - "disableInteractionLogs": false, - "disableStackdriverLogs": true, - "googleAssistant": { - "googleAssistantCompatible": true, - "project": "libsample-advanced", - "welcomeIntentSignInRequired": false, - "startIntents": [], - "systemIntents": [], - "endIntentIds": [ - "736b2be9-7526-4f76-91ca-e16f46ea2cca", - "6e9eae14-ec0e-4925-8506-96adab96eee4" - ], - "oAuthLinking": { - "required": false, - "grantType": "AUTH_CODE_GRANT" - }, - "voiceType": "MALE_1", - "capabilities": [], - "protocolVersion": "V2", - "autoPreviewEnabled": true, - "isDeviceAgent": false - }, - "defaultTimezone": "America/Los_Angeles", - "webhook": { - "url": "https://us-central1-actionsontransactions.cloudfunctions.net/dialogflowFirebaseFulfillment", - "headers": { - "": "" - }, - "available": true, - "useForDomains": false, - "cloudFunctionsEnabled": true, - "cloudFunctionsInitialized": true - }, - "isPrivate": true, - "customClassifierMode": "use.after", - "mlMinConfidence": 0.3, - "supportedLanguages": [], - "onePlatformApiVersion": "v2" -} \ No newline at end of file diff --git a/samples/actions-on-google/dialogflow-agent/intents/Action on Google List Select.json b/samples/actions-on-google/dialogflow-agent/intents/Action on Google List Select.json deleted file mode 100755 index b744553..0000000 --- a/samples/actions-on-google/dialogflow-agent/intents/Action on Google List Select.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "id": "6e9eae14-ec0e-4925-8506-96adab96eee4", - "name": "Action on Google List Select", - "auto": true, - "contexts": [], - "responses": [ - { - "resetContexts": false, - "affectedContexts": [], - "parameters": [], - "messages": [ - { - "type": "simple_response", - "platform": "google", - "lang": "en", - "textToSpeech": "You selected an item from a list or carousel with the key \"#actions_intent_OPTION.OPTION\"" - } - ], - "defaultResponsePlatforms": { - "google": false - }, - "speech": [] - } - ], - "priority": 500000, - "webhookUsed": false, - "webhookForSlotFilling": false, - "lastUpdate": 1528133199, - "fallbackIntent": false, - "events": [ - { - "name": "actions_intent_OPTION" - } - ] -} \ No newline at end of file diff --git a/samples/actions-on-google/dialogflow-agent/intents/Default Fallback Intent.json b/samples/actions-on-google/dialogflow-agent/intents/Default Fallback Intent.json deleted file mode 100755 index e13f35e..0000000 --- a/samples/actions-on-google/dialogflow-agent/intents/Default Fallback Intent.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "id": "a574dd15-59da-46e7-a17f-a621902a5bc7", - "name": "Default Fallback Intent", - "auto": true, - "contexts": [], - "responses": [ - { - "resetContexts": false, - "action": "input.unknown", - "affectedContexts": [], - "parameters": [], - "messages": [ - { - "type": 0, - "lang": "en", - "speech": [ - "I didn\u0027t get that. Can you say it again?", - "I missed what you said. Say it again?", - "Sorry, could you say that again?", - "Sorry, can you say that again?", - "Can you say that again?", - "Sorry, I didn\u0027t get that.", - "Sorry, what was that?", - "One more time?", - "What was that?", - "Say that again?", - "I didn\u0027t get that.", - "I missed that." - ] - } - ], - "defaultResponsePlatforms": {}, - "speech": [] - } - ], - "priority": 500000, - "webhookUsed": false, - "webhookForSlotFilling": false, - "fallbackIntent": true, - "events": [] -} \ No newline at end of file diff --git a/samples/actions-on-google/dialogflow-agent/intents/Default Welcome Intent.json b/samples/actions-on-google/dialogflow-agent/intents/Default Welcome Intent.json deleted file mode 100755 index bf142c5..0000000 --- a/samples/actions-on-google/dialogflow-agent/intents/Default Welcome Intent.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "id": "d4299d80-7da4-4fd2-a7b7-477ffb7a5df9", - "name": "Default Welcome Intent", - "auto": true, - "contexts": [], - "responses": [ - { - "resetContexts": false, - "action": "input.welcome", - "affectedContexts": [], - "parameters": [], - "messages": [ - { - "type": 0, - "lang": "en", - "speech": [ - "Hi!", - "Hello!", - "Good day!", - "Greetings!" - ] - } - ], - "defaultResponsePlatforms": {}, - "speech": [] - } - ], - "priority": 500000, - "webhookUsed": false, - "webhookForSlotFilling": false, - "fallbackIntent": false, - "events": [ - { - "name": "WELCOME" - } - ] -} \ No newline at end of file diff --git a/samples/actions-on-google/dialogflow-agent/intents/Other Intent.json b/samples/actions-on-google/dialogflow-agent/intents/Other Intent.json deleted file mode 100755 index 3ff92eb..0000000 --- a/samples/actions-on-google/dialogflow-agent/intents/Other Intent.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "id": "8ea5901d-817c-4514-8d00-5f8619e4f26e", - "name": "Other Intent", - "auto": true, - "contexts": [], - "responses": [ - { - "resetContexts": false, - "affectedContexts": [], - "parameters": [], - "messages": [ - { - "type": 0, - "lang": "en", - "speech": [] - } - ], - "defaultResponsePlatforms": {}, - "speech": [] - } - ], - "priority": 500000, - "webhookUsed": true, - "webhookForSlotFilling": false, - "lastUpdate": 1528132560, - "fallbackIntent": false, - "events": [] -} \ No newline at end of file diff --git a/samples/actions-on-google/dialogflow-agent/intents/Other Intent_usersays_en.json b/samples/actions-on-google/dialogflow-agent/intents/Other Intent_usersays_en.json deleted file mode 100755 index ec6bf0f..0000000 --- a/samples/actions-on-google/dialogflow-agent/intents/Other Intent_usersays_en.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "id": "262b5c54-aed4-4ad1-8a6f-424cf0c644df", - "data": [ - { - "text": "other intent", - "userDefined": false - } - ], - "isTemplate": false, - "count": 0, - "updated": 1528132560 - } -] \ No newline at end of file diff --git a/samples/actions-on-google/dialogflow-agent/package.json b/samples/actions-on-google/dialogflow-agent/package.json deleted file mode 100755 index 688e939..0000000 --- a/samples/actions-on-google/dialogflow-agent/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "1.0.0" -} \ No newline at end of file diff --git a/samples/actions-on-google/firebase.json b/samples/actions-on-google/firebase.json deleted file mode 100644 index 9e26dfe..0000000 --- a/samples/actions-on-google/firebase.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/samples/actions-on-google/functions/index.js b/samples/actions-on-google/functions/index.js deleted file mode 100644 index 7dcd29f..0000000 --- a/samples/actions-on-google/functions/index.js +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Copyright 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const functions = require('firebase-functions'); -const { WebhookClient } = require('dialogflow-fulfillment'); -const { Card, Suggestion } = require('dialogflow-fulfillment'); -const { Carousel } = require('actions-on-google'); - -process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements - -const imageUrl = 'https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png'; -const imageUrl2 = 'https://lh3.googleusercontent.com/Nu3a6F80WfixUqf_ec_vgXy_c0-0r4VLJRXjVFF_X_CIilEu8B9fT35qyTEj_PEsKw'; -const linkUrl = 'https://assistant.google.com/'; - -exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => { - const agent = new WebhookClient({ request, response }); - console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers)); - console.log('Dialogflow Request body: ' + JSON.stringify(request.body)); - - function googleAssistantOther(agent) { - // Get Actions on Google library conv instance - let conv = agent.conv(); - // Use Actions on Google library to add responses - conv.ask('Please choose an item:'); - conv.ask(new Carousel({ - title: 'Google Assistant', - items: { - 'WorksWithGoogleAssistantItemKey': { - title: 'Works With the Google Assistant', - description: 'If you see this logo, you know it will work with the Google Assistant.', - image: { - url: imageUrl, - accessibilityText: 'Works With the Google Assistant logo', - }, - }, - 'GoogleHomeItemKey': { - title: 'Google Home', - description: 'Google Home is a powerful speaker and voice Assistant.', - image: { - url: imageUrl2, - accessibilityText: 'Google Home' - }, - }, - }, - })); - // Add Actions on Google library responses to your agent's response - agent.add(conv); - } - - function welcome(agent) { - agent.add(`Welcome to my agent!`); - } - - function fallback(agent) { - agent.add(`I didn't understand`); - agent.add(`I'm sorry, can you try again?`); - } - - function other(agent) { - agent.add(`This message is from Dialogflow's Cloud Functions for Firebase editor!`); - agent.add(new Card({ - title: `Title: this is a card title`, - imageUrl: imageUrl, - text: `This is the body text of a card. You can even use line\n breaks and emoji! 💁`, - buttonText: 'This is a button', - buttonUrl: linkUrl - }) - ); - agent.add(new Suggestion(`Quick Reply`)); - agent.add(new Suggestion(`Suggestion`)); - agent.setContext({ name: 'weather', lifespan: 2, parameters: { city: 'Rome' }}); - } - - // Run the proper handler based on the matched Dialogflow intent - let intentMap = new Map(); - intentMap.set('Default Welcome Intent', welcome); - intentMap.set('Default Fallback Intent', fallback); - if (agent.requestSource === agent.ACTIONS_ON_GOOGLE) { - intentMap.set(null, googleAssistantOther); - } else { - intentMap.set(null, other); - } - agent.handleRequest(intentMap); -}); diff --git a/samples/actions-on-google/functions/package.json b/samples/actions-on-google/functions/package.json deleted file mode 100644 index 60339f8..0000000 --- a/samples/actions-on-google/functions/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "dialogflowFirebaseFulfillment", - "description": "Dialogflow Fulfillment Library quick start sample", - "version": "0.0.1", - "private": true, - "license": "Apache Version 2.0", - "author": "Google Inc.", - "engines": { - "node": ">=6.0" - }, - "scripts": { - "start": "firebase serve --only functions:dialogflowFirebaseFulfillment", - "deploy": "firebase deploy --only functions:dialogflowFirebaseFulfillment" - }, - "dependencies": { - "firebase-admin": "^5.12.1", - "firebase-functions": "^1.0.3", - "actions-on-google": "^2.1.3", - "dialogflow-fulfillment": "0.4.1" - } -} diff --git a/samples/multi-lang-and-locale/README.md b/samples/multi-lang-and-locale/README.md deleted file mode 100644 index 859f2ff..0000000 --- a/samples/multi-lang-and-locale/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# Multi-language and Locale Sample - -## Setup -Choose one of the three options listed below for setup. You only need to complete one of the three options below to setup this sample. - -### Option 1: Add to Dialogflow (recommended) -Click on the **Add to Dialogflow** button below and follow the prompts to create a new agent: - -[![Multi-locale](https://storage.googleapis.com/dialogflow-oneclick/deploy.svg "Multi-locale")](https://console.dialogflow.com/api-client/oneclick?templateUrl=https%3A%2F%2Fstorage.googleapis.com%2Fdialogflow-oneclick%2Fmultilocale-agent.zip&agentName=MultilocaleSample) - -### Option 2: Dialogflow Inline Editor -1. [Sign up for or sign into Dialogflow](https://console.dialogflow.com/api-client/#/login) and [create a agent](https://dialogflow.com/docs/agents#create_an_agent) -1. Go to your agent's settings and [Restore from zip](https://dialogflow.com/docs/agents#export_and_import) using the `dialogflow-agent.zip` in this directory (Note: this will overwrite your existing agent) -1. [Enable the Cloud Function for Firebase inline editor](https://dialogflow.com/docs/fulfillment#cloud_functions_for_firebase) -1. Change the name of the function in `functions/index.js` from `dialogflowFulfillmentMultiLocale` to `dialogflowFirebaseFulfillment` -1. Copy this code in `functions/index.js` the `index.js` file in the Dialogflow Cloud Function for Firebase inline editor. -1. Add `"dialogflow-fulfillment": "^0.4.0"` to the `package.json` file's `dependencies` object in the Dialogflow Cloud Function for Firebase inline editor. -1. Click `Deploy` - -### Option 3: Firebase CLI -1. [Sign up for or sign into Dialogflow](https://console.dialogflow.com/api-client/#/login) and [create a agent](https://dialogflow.com/docs/agents#create_an_agent) -1. Go to your agent's settings and [Restore from zip](https://dialogflow.com/docs/agents#export_and_import) using the `dialogflow-agent.zip` in this directory (Note: this will overwrite your existing agent) -1. `cd` to the `functions` directory -1. Run `npm install` -1. Install the Firebase CLI by running `npm install -g firebase-tools` -1. Login to your Google account with `firebase login` -1. Add your project to the sample with `firebase use [project ID]` [find your project ID here](https://dialogflow.com/docs/agents#settings) -1. Run `firebase deploy --only functions:dialogflowFulfillmentMultiLocale` -1. Paste the URL into your Dialogflow agent's fulfillment - -## References and How to report bugs -* Dialogflow documentation: [https://docs.dialogflow.com](https://docs.dialogflow.com). -* If you find any issues, please open a bug on [GitHub](https://github.com/dialogflow/dialogflow-fulfillment-nodejs/issues). -* Questions are answered on [StackOverflow](https://stackoverflow.com/questions/tagged/dialogflow). - -## How to make contributions? -Please read and follow the steps in the CONTRIBUTING.md. - -## License -See LICENSE.md. - -## Terms -Your use of this sample is subject to, and by using or downloading the sample files you agree to comply with, the [Google APIs Terms of Service](https://developers.google.com/terms/). diff --git a/samples/multi-lang-and-locale/dialogflow-agent.zip b/samples/multi-lang-and-locale/dialogflow-agent.zip deleted file mode 100644 index c715743..0000000 Binary files a/samples/multi-lang-and-locale/dialogflow-agent.zip and /dev/null differ diff --git a/samples/multi-lang-and-locale/dialogflow-agent/agent.json b/samples/multi-lang-and-locale/dialogflow-agent/agent.json deleted file mode 100755 index 4591d5f..0000000 --- a/samples/multi-lang-and-locale/dialogflow-agent/agent.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "description": "", - "language": "en", - "disableInteractionLogs": false, - "googleAssistant": { - "googleAssistantCompatible": true, - "project": "libsample-multilangandlocale", - "welcomeIntentSignInRequired": false, - "startIntents": [], - "systemIntents": [], - "endIntentIds": [], - "oAuthLinking": { - "required": false, - "grantType": "AUTH_CODE_GRANT" - }, - "voiceType": "MALE_1", - "capabilities": [], - "protocolVersion": "V2", - "autoPreviewEnabled": true - }, - "defaultTimezone": "America/Los_Angeles", - "webhook": { - "url": "https://us-central1-libsample-advanced.cloudfunctions.net/dialogflowFirebaseFulfillment", - "headers": { - "": "" - }, - "available": true, - "useForDomains": false, - "cloudFunctionsEnabled": true, - "cloudFunctionsInitialized": true - }, - "isPrivate": true, - "customClassifierMode": "use.after", - "mlMinConfidence": 0.3, - "supportedLanguages": [ - "fr" - ], - "onePlatformApiVersion": "v2" -} \ No newline at end of file diff --git a/samples/multi-lang-and-locale/dialogflow-agent/intents/Default Fallback Intent.json b/samples/multi-lang-and-locale/dialogflow-agent/intents/Default Fallback Intent.json deleted file mode 100755 index 9484bbe..0000000 --- a/samples/multi-lang-and-locale/dialogflow-agent/intents/Default Fallback Intent.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "id": "43ca31a7-53ac-4cdb-a3fa-305e14c48c3e", - "name": "Default Fallback Intent", - "auto": false, - "contexts": [], - "responses": [ - { - "resetContexts": false, - "action": "input.unknown", - "affectedContexts": [], - "parameters": [], - "messages": [ - { - "type": 0, - "lang": "fr", - "speech": "webhook a échoué" - }, - { - "type": 0, - "lang": "en", - "speech": "Webhook Failed" - } - ], - "defaultResponsePlatforms": {}, - "speech": [] - } - ], - "priority": 500000, - "webhookUsed": true, - "webhookForSlotFilling": false, - "fallbackIntent": true, - "events": [] -} \ No newline at end of file diff --git a/samples/multi-lang-and-locale/dialogflow-agent/intents/Default Welcome Intent.json b/samples/multi-lang-and-locale/dialogflow-agent/intents/Default Welcome Intent.json deleted file mode 100755 index b4d117d..0000000 --- a/samples/multi-lang-and-locale/dialogflow-agent/intents/Default Welcome Intent.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "id": "2134273f-3417-4b8a-9f59-148572fd2e60", - "name": "Default Welcome Intent", - "auto": true, - "contexts": [], - "responses": [ - { - "resetContexts": false, - "action": "input.welcome", - "affectedContexts": [], - "parameters": [], - "messages": [ - { - "type": 0, - "lang": "fr", - "speech": "webhook a échoué" - }, - { - "type": 0, - "lang": "en", - "speech": "Webhook Failed" - } - ], - "defaultResponsePlatforms": {}, - "speech": [] - } - ], - "priority": 500000, - "webhookUsed": true, - "webhookForSlotFilling": false, - "fallbackIntent": false, - "events": [ - { - "name": "WELCOME" - } - ] -} \ No newline at end of file diff --git a/samples/multi-lang-and-locale/dialogflow-agent/intents/Default Welcome Intent_usersays_en.json b/samples/multi-lang-and-locale/dialogflow-agent/intents/Default Welcome Intent_usersays_en.json deleted file mode 100755 index 5bfd207..0000000 --- a/samples/multi-lang-and-locale/dialogflow-agent/intents/Default Welcome Intent_usersays_en.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - { - "id": "79cef82e-4889-431e-94fa-87e18aa57c52", - "data": [ - { - "text": "hi", - "userDefined": false - } - ], - "isTemplate": false, - "count": 0 - } -] \ No newline at end of file diff --git a/samples/multi-lang-and-locale/dialogflow-agent/intents/Default Welcome Intent_usersays_fr.json b/samples/multi-lang-and-locale/dialogflow-agent/intents/Default Welcome Intent_usersays_fr.json deleted file mode 100755 index dab3351..0000000 --- a/samples/multi-lang-and-locale/dialogflow-agent/intents/Default Welcome Intent_usersays_fr.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - { - "id": "9834e31e-bc3d-407d-b0ed-68e4ce36716c", - "data": [ - { - "text": "salut", - "userDefined": false - } - ], - "isTemplate": false, - "count": 0 - } -] \ No newline at end of file diff --git a/samples/multi-lang-and-locale/dialogflow-agent/package.json b/samples/multi-lang-and-locale/dialogflow-agent/package.json deleted file mode 100755 index 688e939..0000000 --- a/samples/multi-lang-and-locale/dialogflow-agent/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "1.0.0" -} \ No newline at end of file diff --git a/samples/multi-lang-and-locale/firebase.json b/samples/multi-lang-and-locale/firebase.json deleted file mode 100644 index 9e26dfe..0000000 --- a/samples/multi-lang-and-locale/firebase.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/samples/multi-lang-and-locale/functions/index.js b/samples/multi-lang-and-locale/functions/index.js deleted file mode 100644 index 431968e..0000000 --- a/samples/multi-lang-and-locale/functions/index.js +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Copyright 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const functions = require('firebase-functions'); -const { WebhookClient } = require('dialogflow-fulfillment'); - -process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements - -exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => { - const agent = new WebhookClient({ request, response }); - console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers)); - console.log('Dialogflow Request body: ' + JSON.stringify(request.body)); - - // English handler functions and intent map - function welcome(agent) { - agent.add(`Welcome to my agent!`); - } - function fallback(agent) { - agent.add(`I didn't understand`); - agent.add(`I'm sorry, can you try again?`); - } - let enIntentMap = new Map(); // Map functions to English Dialogflow intent names - enIntentMap.set('Default Welcome Intent', welcome); - enIntentMap.set('Default Fallback Intent', fallback); - - // French handler functions and intent map - function bienvenue(agent) { - agent.add(`Bienvenue à mon agent!`); - } - function secours(agent) { - agent.add(`Je n'ai pas compris`); - agent.add(`Pouvez-vous essayer encore?`); - } - let frIntentMap = new Map(); // Map functions to French Dialogflow intent names - frIntentMap.set('Default Welcome Intent', bienvenue); - frIntentMap.set('Default Fallback Intent', secours); - - // Chose which intent map to use based on the language of the request - console.log(`Request locale: ${agent.locale}`); - if (agent.locale === 'en') { - agent.handleRequest(enIntentMap); - } else if (agent.locale === 'fr') { - agent.handleRequest(frIntentMap); - } -}); diff --git a/samples/multi-lang-and-locale/functions/package.json b/samples/multi-lang-and-locale/functions/package.json deleted file mode 100644 index 04ec488..0000000 --- a/samples/multi-lang-and-locale/functions/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "dialogflowFirebaseFulfillment", - "description": "Dialogflow Fulfillment Library multi-language and multi-locale sample", - "version": "0.0.1", - "private": true, - "license": "Apache Version 2.0", - "author": "Google Inc.", - "engines": { - "node": ">=6.0" - }, - "scripts": { - "start": "firebase serve --only functions:dialogflowFirebaseFulfillment", - "deploy": "firebase deploy --only functions:dialogflowFirebaseFulfillment" - }, - "dependencies": { - "firebase-admin": "^5.12.1", - "firebase-functions": "^1.0.3", - "dialogflow-fulfillment": "^0.4.1", - "actions-on-google": "^2.1.3" - } -} \ No newline at end of file diff --git a/samples/parameters-contexts-and-rich-responses/README.md b/samples/parameters-contexts-and-rich-responses/README.md deleted file mode 100644 index 42666a2..0000000 --- a/samples/parameters-contexts-and-rich-responses/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# Temperature Trivia - -## Setup -Choose one of the three options listed below for setup. You only need to complete one of the three options below to setup this sample. - -### Option 1: Add to Dialogflow (recommended) -Click on the **Add to Dialogflow** button below and follow the prompts to create a new agent: - -[![Temperature Trivia](https://storage.googleapis.com/dialogflow-oneclick/deploy.svg "Temperature Trivia")](https://console.dialogflow.com/api-client/oneclick?templateUrl=https%3A%2F%2Fstorage.googleapis.com%2Fdialogflow-oneclick%2Ftemperature-converter-agent.zip&agentName=TemperatureConverterSample) - -### Option 2: Dialogflow Inline Editor -1. [Sign up for or sign into Dialogflow](https://console.dialogflow.com/api-client/#/login) and [create a agent](https://dialogflow.com/docs/agents#create_an_agent) -1. Go to your agent's settings and [Restore from zip](https://dialogflow.com/docs/agents#export_and_import) using the `dialogflow-agent.zip` in this directory (Note: this will overwrite your existing agent) -1. [Enable the Cloud Function for Firebase inline editor](https://dialogflow.com/docs/fulfillment#cloud_functions_for_firebase) -1. Change the name of the function in `functions/index.js` from `dialogflowFulfillmentLibAdvancedSample` to `dialogflowFirebaseFulfillment` -1. Copy this code in `functions/index.js` the `index.js` file in the Dialogflow Cloud Function for Firebase inline editor. -1. Add `"dialogflow-fulfillment": "^0.4.0"` to the `package.json` file's `dependencies` object in the Dialogflow Cloud Function for Firebase inline editor. -1. Click `Deploy` - -### Setup: Firebase CLI (option 2) - -1. [Sign up for or sign into Dialogflow](https://console.dialogflow.com/api-client/#/login) and [create a agent](https://dialogflow.com/docs/agents#create_an_agent) -1. Go to your agent's settings and [Restore from zip](https://dialogflow.com/docs/agents#export_and_import) using the `dialogflow-agent.zip` in this directory (Note: this will overwrite your existing agent) -1. `cd` to the `functions` directory -1. Run `npm install` -1. Install the Firebase CLI by running `npm install -g firebase-tools` -1. Login to your Google account with `firebase login` -1. Add your project to the sample with `firebase use [project ID]` [find your project ID here](https://dialogflow.com/docs/agents#settings) -1. Run `firebase deploy --only functions:dialogflowFulfillmentLibAdvancedSample` -1. Paste the URL into your Dialogflow agent's fulfillment - -## References and How to report bugs -* Dialogflow documentation: [https://docs.dialogflow.com](https://docs.dialogflow.com). -* If you find any issues, please open a bug on [GitHub](https://github.com/dialogflow/dialogflow-fulfillment-nodejs/issues). -* Questions are answered on [StackOverflow](https://stackoverflow.com/questions/tagged/dialogflow). - -## How to make contributions? -Please read and follow the steps in the CONTRIBUTING.md. - -## License -See LICENSE.md. - -## Terms -Your use of this sample is subject to, and by using or downloading the sample files you agree to comply with, the [Google APIs Terms of Service](https://developers.google.com/terms/). diff --git a/samples/parameters-contexts-and-rich-responses/dialogflow-agent.zip b/samples/parameters-contexts-and-rich-responses/dialogflow-agent.zip deleted file mode 100644 index ede813e..0000000 Binary files a/samples/parameters-contexts-and-rich-responses/dialogflow-agent.zip and /dev/null differ diff --git a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/agent.json b/samples/parameters-contexts-and-rich-responses/dialogflow-agent/agent.json deleted file mode 100755 index 186442b..0000000 --- a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/agent.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "description": "", - "language": "en", - "disableInteractionLogs": false, - "googleAssistant": { - "googleAssistantCompatible": true, - "project": "libsample-advanced", - "welcomeIntentSignInRequired": false, - "startIntents": [], - "systemIntents": [], - "endIntentIds": [ - "736b2be9-7526-4f76-91ca-e16f46ea2cca" - ], - "oAuthLinking": { - "required": false, - "grantType": "AUTH_CODE_GRANT" - }, - "voiceType": "MALE_1", - "capabilities": [], - "protocolVersion": "V2", - "autoPreviewEnabled": true - }, - "defaultTimezone": "America/Los_Angeles", - "webhook": { - "url": "https://us-central1-libsample-advanced.cloudfunctions.net/dialogflowFirebaseFulfillment", - "headers": { - "": "" - }, - "available": true, - "useForDomains": false, - "cloudFunctionsEnabled": true, - "cloudFunctionsInitialized": true - }, - "isPrivate": true, - "customClassifierMode": "use.after", - "mlMinConfidence": 0.3, - "supportedLanguages": [], - "onePlatformApiVersion": "v2" -} \ No newline at end of file diff --git a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/entities/absoluteTempUnit.json b/samples/parameters-contexts-and-rich-responses/dialogflow-agent/entities/absoluteTempUnit.json deleted file mode 100755 index 32ada23..0000000 --- a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/entities/absoluteTempUnit.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "id": "bced28ff-00a9-44bc-80f7-ca2ff085f636", - "name": "absoluteTempUnit", - "isOverridable": true, - "isEnum": false, - "automatedExpansion": false -} \ No newline at end of file diff --git a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/entities/absoluteTempUnit_entries_en.json b/samples/parameters-contexts-and-rich-responses/dialogflow-agent/entities/absoluteTempUnit_entries_en.json deleted file mode 100755 index de7f662..0000000 --- a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/entities/absoluteTempUnit_entries_en.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "value": "Kelvin", - "synonyms": [ - "Kelvin", - "K", - "kelvin" - ] - }, - { - "value": "Rankine", - "synonyms": [ - "Rankine", - "R", - "rankine" - ] - } -] \ No newline at end of file diff --git a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/entities/unit.json b/samples/parameters-contexts-and-rich-responses/dialogflow-agent/entities/unit.json deleted file mode 100755 index d55cf74..0000000 --- a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/entities/unit.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "id": "d2e0852d-a8fd-4d5b-a014-bf609dd9f445", - "name": "unit", - "isOverridable": true, - "isEnum": false, - "automatedExpansion": false -} \ No newline at end of file diff --git a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/entities/unit_entries_en.json b/samples/parameters-contexts-and-rich-responses/dialogflow-agent/entities/unit_entries_en.json deleted file mode 100755 index 181403e..0000000 --- a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/entities/unit_entries_en.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "value": "Celsius", - "synonyms": [ - "Celsius", - "C", - "celsius" - ] - }, - { - "value": "Fahrenheit", - "synonyms": [ - "Fahrenheit", - "F", - "fahrenheit" - ] - } -] \ No newline at end of file diff --git a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Cancel.json b/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Cancel.json deleted file mode 100755 index d722adc..0000000 --- a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Cancel.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "id": "736b2be9-7526-4f76-91ca-e16f46ea2cca", - "name": "Cancel", - "auto": true, - "contexts": [], - "responses": [ - { - "resetContexts": false, - "action": "cancel", - "affectedContexts": [ - { - "name": "temperature", - "parameters": {}, - "lifespan": 0 - } - ], - "parameters": [], - "messages": [ - { - "type": 0, - "lang": "en", - "speech": "Goodbye!" - } - ], - "defaultResponsePlatforms": {}, - "speech": [] - } - ], - "priority": 500000, - "webhookUsed": false, - "webhookForSlotFilling": false, - "lastUpdate": 1517002931, - "fallbackIntent": false, - "events": [] -} \ No newline at end of file diff --git a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Cancel_usersays_en.json b/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Cancel_usersays_en.json deleted file mode 100755 index 6c3c89d..0000000 --- a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Cancel_usersays_en.json +++ /dev/null @@ -1,38 +0,0 @@ -[ - { - "id": "090fe506-4c96-4330-9664-477b518d718c", - "data": [ - { - "text": "Exit", - "userDefined": false - } - ], - "isTemplate": false, - "count": 0, - "updated": 1517002931 - }, - { - "id": "0bea9d01-7206-4389-9e9d-d7db36cb53c1", - "data": [ - { - "text": "Quit", - "userDefined": false - } - ], - "isTemplate": false, - "count": 0, - "updated": 1517002931 - }, - { - "id": "b36b3d02-3569-489b-a254-63fd8a950c3f", - "data": [ - { - "text": "Cancel", - "userDefined": false - } - ], - "isTemplate": false, - "count": 0, - "updated": 1517002931 - } -] \ No newline at end of file diff --git a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Convert Fahrenheit and Celsius.json b/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Convert Fahrenheit and Celsius.json deleted file mode 100755 index 83048b1..0000000 --- a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Convert Fahrenheit and Celsius.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "id": "a7e72b1d-225b-47ec-95ff-8e7ca3a12138", - "name": "Convert Fahrenheit and Celsius", - "auto": true, - "contexts": [], - "responses": [ - { - "resetContexts": false, - "action": "convert.common.temperature", - "affectedContexts": [ - { - "name": "temperature", - "parameters": {}, - "lifespan": 1 - } - ], - "parameters": [ - { - "id": "f0256fcd-8ef7-4de6-a027-060ff032d2f0", - "required": true, - "dataType": "@sys.number", - "name": "temperature", - "value": "$temperature", - "prompts": [ - { - "lang": "en", - "value": "What temperature would you like to convert?" - } - ], - "isList": false - }, - { - "id": "35303e91-1bb2-4bad-8b37-71dd34f7d54f", - "required": true, - "dataType": "@unit", - "name": "unit", - "value": "$unit", - "prompts": [ - { - "lang": "en", - "value": "Fahrenheit or Celsius?" - } - ], - "isList": false - } - ], - "messages": [ - { - "type": 0, - "lang": "en", - "speech": "Webhook Failed" - } - ], - "defaultResponsePlatforms": {}, - "speech": [] - } - ], - "priority": 500000, - "webhookUsed": true, - "webhookForSlotFilling": false, - "lastUpdate": 1517002171, - "fallbackIntent": false, - "events": [] -} \ No newline at end of file diff --git a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Convert Fahrenheit and Celsius_usersays_en.json b/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Convert Fahrenheit and Celsius_usersays_en.json deleted file mode 100755 index ee6a017..0000000 --- a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Convert Fahrenheit and Celsius_usersays_en.json +++ /dev/null @@ -1,139 +0,0 @@ -[ - { - "id": "c103174e-530f-4bbc-8afc-08db0f438bee", - "data": [ - { - "text": "27", - "alias": "temperature", - "meta": "@sys.number", - "userDefined": false - }, - { - "text": "°", - "userDefined": false - } - ], - "isTemplate": false, - "count": 0 - }, - { - "id": "0ea802b7-5bcb-47b9-9c6e-c178ee32919f", - "data": [ - { - "text": "30", - "alias": "temperature", - "meta": "@sys.number", - "userDefined": true - }, - { - "text": " degrees", - "userDefined": false - } - ], - "isTemplate": false, - "count": 0 - }, - { - "id": "cc81c27c-c714-4d8d-9c00-42710b683b35", - "data": [ - { - "text": "25", - "alias": "temperature", - "meta": "@sys.number", - "userDefined": false - } - ], - "isTemplate": false, - "count": 0 - }, - { - "id": "ad5f4fed-4f1f-479b-bf0e-e2eefed09d7c", - "data": [ - { - "text": "How about ", - "userDefined": false - }, - { - "text": "45", - "alias": "temperature", - "meta": "@sys.number", - "userDefined": true - }, - { - "text": " degrees?", - "userDefined": false - } - ], - "isTemplate": false, - "count": 0 - }, - { - "id": "6354925c-bf9c-4a5a-93d5-a1599051c65e", - "data": [ - { - "text": "27", - "alias": "temperature", - "meta": "@sys.number", - "userDefined": false - }, - { - "text": "° ", - "userDefined": false - }, - { - "text": "Celsius", - "alias": "unit", - "meta": "@unit", - "userDefined": true - } - ], - "isTemplate": false, - "count": 0 - }, - { - "id": "bd6fb6a7-bf35-409e-a2f3-dcc72b3bb696", - "data": [ - { - "text": "-40", - "alias": "temperature", - "meta": "@sys.number", - "userDefined": true - }, - { - "text": "° ", - "userDefined": false - }, - { - "text": "Fahrenheit", - "alias": "unit", - "meta": "@unit", - "userDefined": true - } - ], - "isTemplate": false, - "count": 0 - }, - { - "id": "c76b7675-a35b-48bd-bb4a-227aa40a436b", - "data": [ - { - "text": "45", - "alias": "temperature", - "meta": "@sys.number", - "userDefined": true - }, - { - "text": " degrees ", - "userDefined": false - }, - { - "text": "Celsius", - "alias": "unit", - "meta": "@unit", - "userDefined": true - } - ], - "isTemplate": false, - "count": 0 - } -] \ No newline at end of file diff --git a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Convert Rankine and Kelvin.json b/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Convert Rankine and Kelvin.json deleted file mode 100755 index 3991fc7..0000000 --- a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Convert Rankine and Kelvin.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "id": "78b4b898-d06d-461b-845b-1ee8dd5d6158", - "name": "Convert Rankine and Kelvin", - "auto": true, - "contexts": [ - "temperature" - ], - "responses": [ - { - "resetContexts": false, - "action": "convert.absolute.temperature", - "affectedContexts": [], - "parameters": [ - { - "id": "be3f3214-fdcf-4e2b-b057-7b0ae133e01d", - "required": true, - "dataType": "@absoluteTempUnit", - "name": "absoluteTempUnit", - "value": "$absoluteTempUnit", - "prompts": [ - { - "lang": "en", - "value": "Rankine or Kelvin?" - } - ], - "isList": false - } - ], - "messages": [ - { - "type": 0, - "lang": "en", - "speech": "Webhook Failed" - } - ], - "defaultResponsePlatforms": {}, - "speech": [] - } - ], - "priority": 500000, - "webhookUsed": true, - "webhookForSlotFilling": false, - "lastUpdate": 1517002804, - "fallbackIntent": false, - "events": [] -} \ No newline at end of file diff --git a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Convert Rankine and Kelvin_usersays_en.json b/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Convert Rankine and Kelvin_usersays_en.json deleted file mode 100755 index fed2084..0000000 --- a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Convert Rankine and Kelvin_usersays_en.json +++ /dev/null @@ -1,58 +0,0 @@ -[ - { - "id": "360a5438-1113-4a65-8697-281d6773da90", - "data": [ - { - "text": "Kelvin", - "alias": "absoluteTempUnit", - "meta": "@absoluteTempUnit", - "userDefined": false - } - ], - "isTemplate": false, - "count": 0, - "updated": 1517002804 - }, - { - "id": "9e035726-eb5f-4a7d-a8e8-ca2e09e58c4f", - "data": [ - { - "text": "Rankine", - "alias": "absoluteTempUnit", - "meta": "@absoluteTempUnit", - "userDefined": false - } - ], - "isTemplate": false, - "count": 0, - "updated": 1517002804 - }, - { - "id": "b18572f8-1921-463e-9751-1dddca9d907b", - "data": [ - { - "text": "K", - "alias": "absoluteTempUnit", - "meta": "@absoluteTempUnit", - "userDefined": false - } - ], - "isTemplate": false, - "count": 0, - "updated": 1517002804 - }, - { - "id": "55e31bdf-a41a-4884-8264-6f8d4114a6d6", - "data": [ - { - "text": "R", - "alias": "absoluteTempUnit", - "meta": "@absoluteTempUnit", - "userDefined": false - } - ], - "isTemplate": false, - "count": 2, - "updated": 1517002804 - } -] \ No newline at end of file diff --git a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Default Fallback Intent.json b/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Default Fallback Intent.json deleted file mode 100755 index 33385bb..0000000 --- a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Default Fallback Intent.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "id": "296423e9-f6b2-4483-81c1-4462ae455719", - "name": "Default Fallback Intent", - "auto": false, - "contexts": [], - "responses": [ - { - "resetContexts": false, - "action": "input.unknown", - "affectedContexts": [], - "parameters": [], - "messages": [ - { - "type": 0, - "lang": "en", - "speech": "Webhook Failed" - } - ], - "defaultResponsePlatforms": {}, - "speech": [] - } - ], - "priority": 500000, - "webhookUsed": true, - "webhookForSlotFilling": false, - "fallbackIntent": true, - "events": [] -} \ No newline at end of file diff --git a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Default Welcome Intent.json b/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Default Welcome Intent.json deleted file mode 100755 index 0838201..0000000 --- a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Default Welcome Intent.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "id": "37873ae7-a618-4462-a67d-8877e2128fa0", - "name": "Default Welcome Intent", - "auto": true, - "contexts": [], - "responses": [ - { - "resetContexts": false, - "action": "input.welcome", - "affectedContexts": [], - "parameters": [], - "messages": [ - { - "type": 0, - "lang": "en", - "speech": "Webhook Failed" - } - ], - "defaultResponsePlatforms": {}, - "speech": [] - } - ], - "priority": 500000, - "webhookUsed": true, - "webhookForSlotFilling": false, - "fallbackIntent": false, - "events": [ - { - "name": "WELCOME" - } - ] -} \ No newline at end of file diff --git a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Default Welcome Intent_usersays_en.json b/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Default Welcome Intent_usersays_en.json deleted file mode 100755 index 25d77d1..0000000 --- a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Default Welcome Intent_usersays_en.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - { - "id": "759c6964-a552-40db-a12f-bf75a1ca99ff", - "data": [ - { - "text": "hi", - "userDefined": false - } - ], - "isTemplate": false, - "count": 0 - } -] \ No newline at end of file diff --git a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/package.json b/samples/parameters-contexts-and-rich-responses/dialogflow-agent/package.json deleted file mode 100755 index 688e939..0000000 --- a/samples/parameters-contexts-and-rich-responses/dialogflow-agent/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "1.0.0" -} \ No newline at end of file diff --git a/samples/parameters-contexts-and-rich-responses/firebase.json b/samples/parameters-contexts-and-rich-responses/firebase.json deleted file mode 100644 index 9e26dfe..0000000 --- a/samples/parameters-contexts-and-rich-responses/firebase.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/samples/parameters-contexts-and-rich-responses/functions/index.js b/samples/parameters-contexts-and-rich-responses/functions/index.js deleted file mode 100644 index 10d37ab..0000000 --- a/samples/parameters-contexts-and-rich-responses/functions/index.js +++ /dev/null @@ -1,148 +0,0 @@ -/** - * Copyright 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const functions = require('firebase-functions'); -const {WebhookClient} = require('dialogflow-fulfillment'); -const {Text, Card, Image, Suggestion, Payload} = require('dialogflow-fulfillment'); - -process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements - -// Wikipedia link and image URLs -const wikipediaTemperatureUrl = 'https://en.wikipedia.org/wiki/Temperature'; -const wikipediaTemperatureImageUrl = 'https://upload.wikimedia.org/wikipedia/commons/2/23/Thermally_Agitated_Molecule.gif'; -const wikipediaCelsiusUrl = 'https://en.wikipedia.org/wiki/Celsius'; -const wikipediaCelsiusImageUrl = 'https://upload.wikimedia.org/wikipedia/commons/a/ad/Celsius_original_thermometer.png'; -const wikipediaFahrenheitUrl = 'https://en.wikipedia.org/wiki/Fahrenheit'; -const wikipediaFahrenheitImageUrl = 'https://upload.wikimedia.org/wikipedia/commons/b/bd/Fahrenheit_small.jpg'; -const wikipediaKelvinUrl = 'https://en.wikipedia.org/wiki/Kelvin'; -const wikipediaKelvinImageUrl = 'https://upload.wikimedia.org/wikipedia/commons/a/a0/Lord_Kelvin_photograph.jpg'; -const wikipediaRankineUrl = 'https://en.wikipedia.org/wiki/Rankine_scale'; -const wikipediaRankineImageUrl = 'https://upload.wikimedia.org/wikipedia/commons/5/58/Rankine_William_signature.jpg'; - -exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => { - const agent = new WebhookClient({ request, response }); - console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers)); - console.log('Dialogflow Request body: ' + JSON.stringify(request.body)); - - function welcome(agent) { - agent.add('Welcome to the temperature converter!'); - agent.add(new Card({ - title: 'Vibrating molecules', - imageUrl: wikipediaTemperatureImageUrl, - text: 'Did you know that temperature is really just a measure of how fast molecules are vibrating around?! 😱', - buttonText: 'Temperature Wikipedia Page', - buttonUrl: wikipediaTemperatureUrl - }) - ); - agent.add('I can convert Celsius to Fahrenheit and Fahrenheit to Celsius! What temperature would you like to convert?'); - agent.add(new Suggestion('27° Celsius')); - agent.add(new Suggestion('-40° Fahrenheit')); - agent.add(new Suggestion('Cancel')); - } - - function convertFahrenheitAndCelsius(agent) { - // Get parameters from Dialogflow to convert - const temperature = agent.parameters.temperature; - const unit = agent.parameters.unit; - console.log(`User requested to convert ${temperature}° ${unit}`); - - let convertedTemp, convertedUnit, temperatureHistory; - if (unit === 'Celsius') { - convertedTemp = temperature*(9/5) + 32; - convertedUnit = 'Fahrenheit'; - temperatureHistory = new Card({ - title: 'Fahrenheit', - imageUrl: wikipediaFahrenheitImageUrl, - text: 'Daniel Gabriel Fahrenheit, invented the Fahrenheit scale (first widely used, standardized temperature scale) and the mercury thermometer.', - buttonText: 'Fahrenheit Wikipedia Page', - buttonUrl: wikipediaFahrenheitUrl - }); - } else if (unit === 'Fahrenheit') { - convertedTemp = (temperature-32)*(5/9); - convertedUnit = 'Celsius'; - temperatureHistory = new Card({ - title: 'Celsius', - imageUrl: wikipediaCelsiusImageUrl, - text: 'The original Celsius thermometer had a reversed scale, where 100 is the freezing point of water and 0 is its boiling point.', - buttonText: 'Celsius Wikipedia Page', - buttonUrl: wikipediaCelsiusUrl - }); - } - - // Sent the context to store the parameter information - // and make sure the followup Rankine - agent.setContext({ - name: 'temperature', - lifespan: 1, - parameters:{temperature: temperature, unit: unit} - }); - - // Compile and send response - agent.add(`${temperature}° ${unit} is ${convertedTemp}° ${convertedUnit}`); - agent.add(temperatureHistory); - agent.add('Would you like to know what this temperature is in Kelvin or Rankine?'); - agent.add(new Suggestion('Kelvin')); - agent.add(new Suggestion('Rankine')); - agent.add(new Suggestion('Cancel')); - } - - function convertRankineAndKelvin(agent) { - const secondUnit = agent.parameters.absoluteTempUnit; - const tempContext = agent.getContext('temperature'); - const originalTemp = tempContext.parameters.temperature; - const originalUnit = tempContext.parameters.unit; - - // Convert temperature - let convertedTemp, convertedUnit, temperatureHistoryText, temperatureHistoryImage; - if (secondUnit === 'Kelvin') { - convertedTemp = originalTemp === 'Celsius' ? originalTemp + 273.15 : (originalTemp-32)*(5/9) + 273.15; - convertedUnit = 'Kelvin'; - temperatureHistoryText = 'Here is a picture of the namesake of the Rankine unit, William John Macquorn Rankine:'; - temperatureHistoryImage = new Image(wikipediaKelvinImageUrl); - } else if (secondUnit === 'Rankine') { - convertedTemp = originalTemp === 'Fahrenheit' ? originalTemp + 459.67 : originalTemp*(9/5) + 32 + 459.67; - convertedUnit = 'Rankine'; - temperatureHistoryText = 'Here is a picture of the namesake of the Kelvin unit, Lord Kelvin:'; - temperatureHistoryImage = new Image(wikipediaRankineImageUrl); - } - - // Set `temperature` context lifetime to zero - // to reset the conversational state and parameters - agent.setContext({name: 'temperature', lifespan: 0}); - - // Compile and send response - agent.add(`${originalTemp}° ${originalUnit} is ${convertedTemp}° ${convertedUnit}. ` + temperatureHistoryText); - agent.add(new Image(temperatureHistoryImage)); - agent.add('Go ahead and say another temperature to get the conversion.'); - agent.add(new Suggestion('27° Celsius')); - agent.add(new Suggestion('-40° Fahrenheit')); - agent.add(new Suggestion('Cancel')); - } - - function fallback(agent) { - agent.add('Woah! Its getting a little hot in here.'); - agent.add(`I didn't get that, can you try again?`); - } - - let intentMap = new Map(); // Map functions to Dialogflow intent names - intentMap.set('Default Welcome Intent', welcome); - intentMap.set('Convert Fahrenheit and Celsius', convertFahrenheitAndCelsius); - intentMap.set('Convert Rankine and Kelvin', convertRankineAndKelvin); - intentMap.set('Default Fallback Intent', fallback); - agent.handleRequest(intentMap); -}); diff --git a/samples/parameters-contexts-and-rich-responses/functions/package.json b/samples/parameters-contexts-and-rich-responses/functions/package.json deleted file mode 100644 index 1c740b3..0000000 --- a/samples/parameters-contexts-and-rich-responses/functions/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "dialogflowFirebaseFulfillment", - "description": "Dialogflow Fulfillment Library Sample for parameters, contexts and rich responses", - "version": "0.0.1", - "private": true, - "license": "Apache Version 2.0", - "author": "Google Inc.", - "engines": { - "node": ">=6.0" - }, - "scripts": { - "start": "firebase serve --only functions:dialogflowFirebaseFulfillment", - "deploy": "firebase deploy --only functions:dialogflowFirebaseFulfillment" - }, - "dependencies": { - "firebase-admin": "^5.12.1", - "firebase-functions": "^1.0.3", - "dialogflow-fulfillment": "^0.4.1", - "actions-on-google": "^2.1.3" - } -} \ No newline at end of file diff --git a/samples/quick-start/README.md b/samples/quick-start/README.md deleted file mode 100644 index cf361dd..0000000 --- a/samples/quick-start/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# Getting Started Sample - -## Setup -Choose one of the three options listed below for setup. You only need to complete one of the three options below to setup this sample. - -### Option 1: Add to Dialogflow (recommended) -Click on the **Add to Dialogflow** button below and follow the prompts to create a new agent: - -[![Getting Started](https://storage.googleapis.com/dialogflow-oneclick/deploy.svg "Getting Started")](https://console.dialogflow.com/api-client/oneclick?templateUrl=https%3A%2F%2Fstorage.googleapis.com%2Fdialogflow-oneclick%2Fquickstart-agent.zip&agentName=QuickStartSample) - -### Option 2: Dialogflow Inline Editor -1. [Sign up for or sign into Dialogflow](https://console.dialogflow.com/api-client/#/login) and [create a agent](https://dialogflow.com/docs/agents#create_an_agent) -1. Go to your agent's settings and [Restore from zip](https://dialogflow.com/docs/agents#export_and_import) using the `dialogflow-agent.zip` in this directory (Note: this will overwrite your existing agent) -1. [Enable the Cloud Function for Firebase inline editor](https://dialogflow.com/docs/fulfillment#cloud_functions_for_firebase) -1. Copy this code in `functions/index.js` the `index.js` file in the Dialogflow Cloud Function for Firebase inline editor. -1. Add `"dialogflow-fulfillment": "^0.4.0"` to the `package.json` file's `dependencies` object in the Dialogflow Cloud Function for Firebase inline editor. -1. Click `Deploy` - -### Option 3: Firebase CLI -1. [Sign up for or sign into Dialogflow](https://console.dialogflow.com/api-client/#/login) and [create a agent](https://dialogflow.com/docs/agents#create_an_agent) -1. Go to your agent's settings and [Restore from zip](https://dialogflow.com/docs/agents#export_and_import) using the `dialogflow-agent.zip` in this directory (Note: this will overwrite your existing agent) -1. `cd` to the `functions` directory -1. Run `npm install` -1. Install the Firebase CLI by running `npm install -g firebase-tools` -1. Login to your Google account with `firebase login` -1. Add your project to the sample with `firebase use [project ID]` [find your project ID here](https://dialogflow.com/docs/agents#settings) -1. Run `firebase deploy --only functions:dialogflowFirebaseFulfillment` -1. Paste the URL into your Dialogflow agent's fulfillment and click `Save` -1. Under the fulfillment section of your `Default Welcome Intent` and `Default Fallback Intent` check the box for `Use webhook` and click `Save` - -## References and How to report bugs -* Dialogflow documentation: [https://docs.dialogflow.com](https://docs.dialogflow.com). -* If you find any issues, please open a bug on [GitHub](https://github.com/dialogflow/dialogflow-fulfillment-nodejs/issues). -* Questions are answered on [StackOverflow](https://stackoverflow.com/questions/tagged/dialogflow). - -## How to make contributions? -Please read and follow the steps in the CONTRIBUTING.md. - -## License -See LICENSE.md. - -## Terms -Your use of this sample is subject to, and by using or downloading the sample files you agree to comply with, the [Google APIs Terms of Service](https://developers.google.com/terms/). -e -See LICENSE.md. - -## Terms -Your use of this sample is subject to, and by using or downloading the sample files you agree to comply with, the [Google APIs Terms of Service](https://developers.google.com/terms/). diff --git a/samples/quick-start/dialogflow-agent.zip b/samples/quick-start/dialogflow-agent.zip deleted file mode 100644 index 077e87f..0000000 Binary files a/samples/quick-start/dialogflow-agent.zip and /dev/null differ diff --git a/samples/quick-start/dialogflow-agent/agent.json b/samples/quick-start/dialogflow-agent/agent.json deleted file mode 100755 index 3e3d224..0000000 --- a/samples/quick-start/dialogflow-agent/agent.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "description": "", - "language": "en", - "disableInteractionLogs": false, - "googleAssistant": { - "googleAssistantCompatible": true, - "project": "libsample-quickstart", - "welcomeIntentSignInRequired": false, - "startIntents": [], - "systemIntents": [], - "endIntentIds": [], - "oAuthLinking": { - "required": false, - "grantType": "AUTH_CODE_GRANT" - }, - "voiceType": "MALE_1", - "capabilities": [], - "protocolVersion": "V2", - "autoPreviewEnabled": true - }, - "defaultTimezone": "America/Los_Angeles", - "webhook": { - "url": "https://us-central1-libsample-advanced.cloudfunctions.net/dialogflowFirebaseFulfillment", - "headers": { - "": "" - }, - "available": true, - "useForDomains": false, - "cloudFunctionsEnabled": true, - "cloudFunctionsInitialized": true - }, - "isPrivate": true, - "customClassifierMode": "use.after", - "mlMinConfidence": 0.3, - "supportedLanguages": [], - "onePlatformApiVersion": "v2" -} \ No newline at end of file diff --git a/samples/quick-start/dialogflow-agent/intents/Default Fallback Intent.json b/samples/quick-start/dialogflow-agent/intents/Default Fallback Intent.json deleted file mode 100755 index 8a38b58..0000000 --- a/samples/quick-start/dialogflow-agent/intents/Default Fallback Intent.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "id": "18a3bd14-1921-47d9-bcca-a1d84dc4b990", - "name": "Default Fallback Intent", - "auto": false, - "contexts": [], - "responses": [ - { - "resetContexts": false, - "action": "input.unknown", - "affectedContexts": [], - "parameters": [], - "messages": [ - { - "type": 0, - "lang": "en", - "speech": [ - "I didn\u0027t get that. Can you say it again?", - "I missed what you said. Say it again?", - "Sorry, could you say that again?", - "Sorry, can you say that again?", - "Can you say that again?", - "Sorry, I didn\u0027t get that.", - "Sorry, what was that?", - "One more time?", - "What was that?", - "Say that again?", - "I didn\u0027t get that.", - "I missed that." - ] - } - ], - "defaultResponsePlatforms": {}, - "speech": [] - } - ], - "priority": 500000, - "webhookUsed": true, - "webhookForSlotFilling": false, - "fallbackIntent": true, - "events": [] -} \ No newline at end of file diff --git a/samples/quick-start/dialogflow-agent/intents/Default Welcome Intent.json b/samples/quick-start/dialogflow-agent/intents/Default Welcome Intent.json deleted file mode 100755 index 86ca6bd..0000000 --- a/samples/quick-start/dialogflow-agent/intents/Default Welcome Intent.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "id": "719886eb-9eb5-47ed-90c2-9279aec3d305", - "name": "Default Welcome Intent", - "auto": true, - "contexts": [], - "responses": [ - { - "resetContexts": false, - "action": "input.welcome", - "affectedContexts": [], - "parameters": [], - "messages": [ - { - "type": 0, - "lang": "en", - "speech": [ - "Hi!", - "Hello!", - "Good day!", - "Greetings!" - ] - } - ], - "defaultResponsePlatforms": {}, - "speech": [] - } - ], - "priority": 500000, - "webhookUsed": true, - "webhookForSlotFilling": false, - "fallbackIntent": false, - "events": [ - { - "name": "WELCOME" - } - ] -} \ No newline at end of file diff --git a/samples/quick-start/dialogflow-agent/package.json b/samples/quick-start/dialogflow-agent/package.json deleted file mode 100755 index 688e939..0000000 --- a/samples/quick-start/dialogflow-agent/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "1.0.0" -} \ No newline at end of file diff --git a/samples/quick-start/firebase.json b/samples/quick-start/firebase.json deleted file mode 100644 index 9e26dfe..0000000 --- a/samples/quick-start/firebase.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/samples/quick-start/functions/index.js b/samples/quick-start/functions/index.js deleted file mode 100644 index a0b2a97..0000000 --- a/samples/quick-start/functions/index.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright 2017 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -const functions = require('firebase-functions'); -const {WebhookClient, Card, Suggestion} = require('dialogflow-fulfillment'); - -process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements - -exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => { - const agent = new WebhookClient({ request, response }); - console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers)); - console.log('Dialogflow Request body: ' + JSON.stringify(request.body)); - - function welcome(agent) { - agent.add(`Welcome to my agent!`); - } - - function fallback(agent) { - agent.add(`I didn't understand`); - agent.add(`I'm sorry, can you try again?`); - } - - // // Uncomment and edit to make your own intent handler - // // uncomment `intentMap.set('your intent name here', yourFunctionHandler);` - // // below to get this funciton to be run when a Dialogflow intent is matched - // function yourFunctionHandler(agent) { - // agent.add(`This message is from Dialogflow's Cloud Functions for Firebase editor!`); - // agent.add(new Card({ - // title: `Title: this is a card title`, - // imageUrl: 'https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png', - // text: `This is the body text of a card. You can even use line\n breaks and emoji! 💁`, - // buttonText: 'This is a button', - // buttonUrl: 'https://assistant.google.com/' - // }) - // ); - // agent.add(new Suggestion(`Quick Reply`)); - // agent.add(new Suggestion(`Suggestion`)); - // agent.setContext({ name: 'weather', lifespan: 2, parameters: { city: 'Rome' }}); - // } - - // Run the proper function handler based on the matched Dialogflow intent name - let intentMap = new Map(); - intentMap.set('Default Welcome Intent', welcome); - intentMap.set('Default Fallback Intent', fallback); - // intentMap.set('your intent name here', yourFunctionHandler); - agent.handleRequest(intentMap); -}); diff --git a/samples/quick-start/functions/package.json b/samples/quick-start/functions/package.json deleted file mode 100644 index 7810bde..0000000 --- a/samples/quick-start/functions/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "dialogflowFirebaseFulfillment", - "description": "Dialogflow Fulfillment Library quick start sample", - "version": "0.0.1", - "private": true, - "license": "Apache Version 2.0", - "author": "Google Inc.", - "engines": { - "node": ">=6.0" - }, - "scripts": { - "start": "firebase serve --only functions:dialogflowFirebaseFulfillment", - "deploy": "firebase deploy --only functions:dialogflowFirebaseFulfillment" - }, - "dependencies": { - "firebase-admin": "^5.12.1", - "firebase-functions": "^1.0.3", - "dialogflow-fulfillment": "^0.4.1", - "actions-on-google": "^2.1.3" - } -} \ No newline at end of file