From d8396faab7ebaed4b4aeb7b39dd45f19f8e5c9a3 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Mon, 4 Jun 2018 09:47:59 -0700 Subject: [PATCH] Updated samples, unzipped sample agents, fixed peer dependency issue Change-Id: I89f5a92d5df08aa7bf3485c199154a5a1377d1f7 --- docs/WebhookClient.md | 33 +++-- package.json | 5 +- samples/actions-on-google/README.md | 9 +- .../actions-on-google-agent.zip | Bin 4023 -> 0 bytes .../actions-on-google/dialogflow-agent.zip | Bin 0 -> 8257 bytes .../dialogflow-agent/agent.json | 42 ++++++ .../intents/Action on Google List Select.json | 35 +++++ .../intents/Default Fallback Intent.json | 41 ++++++ .../intents/Default Welcome Intent.json | 37 +++++ .../intents/Other Intent.json | 28 ++++ .../intents/Other Intent_usersays_en.json | 14 ++ .../dialogflow-agent/package.json | 3 + .../actions-on-google/functions/package.json | 10 +- samples/multi-lang-and-locale/README.md | 8 +- ...ilocale-agent.zip => dialogflow-agent.zip} | Bin .../dialogflow-agent/agent.json | 39 +++++ .../intents/Default Fallback Intent.json | 33 +++++ .../intents/Default Welcome Intent.json | 37 +++++ .../Default Welcome Intent_usersays_en.json | 13 ++ .../Default Welcome Intent_usersays_fr.json | 13 ++ .../dialogflow-agent/package.json | 3 + .../functions/package.json | 7 +- .../README.md | 8 +- ...nverter-agent.zip => dialogflow-agent.zip} | Bin .../dialogflow-agent/agent.json | 39 +++++ .../entities/absoluteTempUnit.json | 7 + .../entities/absoluteTempUnit_entries_en.json | 18 +++ .../dialogflow-agent/entities/unit.json | 7 + .../entities/unit_entries_en.json | 18 +++ .../dialogflow-agent/intents/Cancel.json | 35 +++++ .../intents/Cancel_usersays_en.json | 38 +++++ .../Convert Fahrenheit and Celsius.json | 64 ++++++++ ...rt Fahrenheit and Celsius_usersays_en.json | 139 ++++++++++++++++++ .../intents/Convert Rankine and Kelvin.json | 46 ++++++ ...onvert Rankine and Kelvin_usersays_en.json | 58 ++++++++ .../intents/Default Fallback Intent.json | 28 ++++ .../intents/Default Welcome Intent.json | 32 ++++ .../Default Welcome Intent_usersays_en.json | 13 ++ .../dialogflow-agent/package.json | 3 + .../functions/package.json | 7 +- samples/quick-start/README.md | 7 +- ...ckstart-agent.zip => dialogflow-agent.zip} | Bin .../quick-start/dialogflow-agent/agent.json | 37 +++++ .../intents/Default Fallback Intent.json | 41 ++++++ .../intents/Default Welcome Intent.json | 37 +++++ .../quick-start/dialogflow-agent/package.json | 3 + samples/quick-start/functions/index.js | 3 +- samples/quick-start/functions/package.json | 7 +- 48 files changed, 1060 insertions(+), 45 deletions(-) delete mode 100644 samples/actions-on-google/actions-on-google-agent.zip create mode 100644 samples/actions-on-google/dialogflow-agent.zip create mode 100755 samples/actions-on-google/dialogflow-agent/agent.json create mode 100755 samples/actions-on-google/dialogflow-agent/intents/Action on Google List Select.json create mode 100755 samples/actions-on-google/dialogflow-agent/intents/Default Fallback Intent.json create mode 100755 samples/actions-on-google/dialogflow-agent/intents/Default Welcome Intent.json create mode 100755 samples/actions-on-google/dialogflow-agent/intents/Other Intent.json create mode 100755 samples/actions-on-google/dialogflow-agent/intents/Other Intent_usersays_en.json create mode 100755 samples/actions-on-google/dialogflow-agent/package.json rename samples/multi-lang-and-locale/{multilocale-agent.zip => dialogflow-agent.zip} (100%) create mode 100755 samples/multi-lang-and-locale/dialogflow-agent/agent.json create mode 100755 samples/multi-lang-and-locale/dialogflow-agent/intents/Default Fallback Intent.json create mode 100755 samples/multi-lang-and-locale/dialogflow-agent/intents/Default Welcome Intent.json create mode 100755 samples/multi-lang-and-locale/dialogflow-agent/intents/Default Welcome Intent_usersays_en.json create mode 100755 samples/multi-lang-and-locale/dialogflow-agent/intents/Default Welcome Intent_usersays_fr.json create mode 100755 samples/multi-lang-and-locale/dialogflow-agent/package.json rename samples/parameters-contexts-and-rich-responses/{temperature-converter-agent.zip => dialogflow-agent.zip} (100%) create mode 100755 samples/parameters-contexts-and-rich-responses/dialogflow-agent/agent.json create mode 100755 samples/parameters-contexts-and-rich-responses/dialogflow-agent/entities/absoluteTempUnit.json create mode 100755 samples/parameters-contexts-and-rich-responses/dialogflow-agent/entities/absoluteTempUnit_entries_en.json create mode 100755 samples/parameters-contexts-and-rich-responses/dialogflow-agent/entities/unit.json create mode 100755 samples/parameters-contexts-and-rich-responses/dialogflow-agent/entities/unit_entries_en.json create mode 100755 samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Cancel.json create mode 100755 samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Cancel_usersays_en.json create mode 100755 samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Convert Fahrenheit and Celsius.json create mode 100755 samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Convert Fahrenheit and Celsius_usersays_en.json create mode 100755 samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Convert Rankine and Kelvin.json create mode 100755 samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Convert Rankine and Kelvin_usersays_en.json create mode 100755 samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Default Fallback Intent.json create mode 100755 samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Default Welcome Intent.json create mode 100755 samples/parameters-contexts-and-rich-responses/dialogflow-agent/intents/Default Welcome Intent_usersays_en.json create mode 100755 samples/parameters-contexts-and-rich-responses/dialogflow-agent/package.json rename samples/quick-start/{quickstart-agent.zip => dialogflow-agent.zip} (100%) create mode 100755 samples/quick-start/dialogflow-agent/agent.json create mode 100755 samples/quick-start/dialogflow-agent/intents/Default Fallback Intent.json create mode 100755 samples/quick-start/dialogflow-agent/intents/Default Welcome Intent.json create mode 100755 samples/quick-start/dialogflow-agent/package.json diff --git a/docs/WebhookClient.md b/docs/WebhookClient.md index f73ec39..14f1c9d 100644 --- a/docs/WebhookClient.md +++ b/docs/WebhookClient.md @@ -19,9 +19,10 @@ Dialogflow's simulator * [.query](#WebhookClient+query) : string * [.locale](#WebhookClient+locale) : string * [.session](#WebhookClient+session) : string - * [.add(response)](#WebhookClient+add) + * [.consoleMessages](#WebhookClient+consoleMessages) : [Array.<RichResponse>](#RichResponse) + * [.add(responses)](#WebhookClient+add) + * [.addResponse_(response)](#WebhookClient+addResponse_) * [.handleRequest(handler)](#WebhookClient+handleRequest) ⇒ Promise - * [.getConsoleMessages()](#WebhookClient+getConsoleMessages) ⇒ Array.<RichResponses> * [.setContext(context)](#WebhookClient+setContext) ⇒ [WebhookClient](#WebhookClient) * [.clearOutgoingContexts()](#WebhookClient+clearOutgoingContexts) ⇒ [WebhookClient](#WebhookClient) * [.clearContext(context)](#WebhookClient+clearContext) ⇒ [WebhookClient](#WebhookClient) @@ -109,10 +110,28 @@ Dialogflow input contexts included in the request or null if no value Dialogflow v2 API only https://dialogflow.com/docs/reference/api-v2/rest/v2beta1/WebhookRequest#FIELDS.session +**Kind**: instance property of [WebhookClient](#WebhookClient) + + +### webhookClient.consoleMessages : [Array.<RichResponse>](#RichResponse) +List of messages defined in Dialogflow's console for the matched intent +https://dialogflow.com/docs/rich-messages + **Kind**: instance property of [WebhookClient](#WebhookClient) -### webhookClient.add(response) +### webhookClient.add(responses) +Add a response or list of responses to be sent to Dialogflow + +**Kind**: instance method of [WebhookClient](#WebhookClient) + +| Param | Type | Description | +| --- | --- | --- | +| responses | [RichResponse](#RichResponse) \| string \| [Array.<RichResponse>](#RichResponse) \| Array.<string> | (list) or single responses | + + + +### webhookClient.addResponse_(response) Add a response to be sent to Dialogflow **Kind**: instance method of [WebhookClient](#WebhookClient) @@ -133,14 +152,6 @@ Each handler must be a function callback. | --- | --- | --- | | handler | Map \| requestCallback | map of Dialogflow action name to handler function or function to handle all requests (regardless of Dialogflow action). | - - -### webhookClient.getConsoleMessages() ⇒ Array.<RichResponses> -Get a list of responses defined in Dialogflow's console -for the matched intent -https://dialogflow.com/docs/rich-messages - -**Kind**: instance method of [WebhookClient](#WebhookClient) ### webhookClient.setContext(context) ⇒ [WebhookClient](#WebhookClient) diff --git a/package.json b/package.json index f9ccea0..c697eba 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.0", + "version": "0.4.1", "license": "Apache-2.0", "author": "Google Inc.", "directories": { @@ -37,11 +37,10 @@ "fulfillment" ], "dependencies": { - "actions-on-google": "^2.1.2", "debug": "^3.1.0" }, "peerDependencies": { - "actions-on-google": "^2.0.1" + "actions-on-google": "^2.1.3" }, "devDependencies": { "ava": "^0.24.0", diff --git a/samples/actions-on-google/README.md b/samples/actions-on-google/README.md index a7283bc..6ba362b 100644 --- a/samples/actions-on-google/README.md +++ b/samples/actions-on-google/README.md @@ -9,15 +9,16 @@ Click on the **Add to Dialogflow** button below and follow the prompts to create [![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) -1. Create a Dialogflow agent +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"` and `"actions-on-google": "^2.1.2"` to the `package.json` file's `dependencies` object 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. Create a Dialogflow agent +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` diff --git a/samples/actions-on-google/actions-on-google-agent.zip b/samples/actions-on-google/actions-on-google-agent.zip deleted file mode 100644 index f6448574b50d9ad36b6b24f82d41d581e0a16ff6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4023 zcmd5mKi%IQsukbRF+SAA*?gyR%BFXS65F}TJ11pa1c$gP3YDqmd6buztTwT zM9J(wc?_x>G((lRTZ#Hm>R?;dOnt$<5Oi{Sl{PNKLN}b-Dop5esoGHf8GUt(QeDGS zl^f5;eQg}@#|oxsH`oJdgi_An3R!QOlFvCF@jKSu?lU}#`vVNS1Z2@&L-iLr-_Lz1 zY}|V4-rG!O`&wi7J+Cvs68$xbtotx(0Q11>MixC(}=^}eQ`RB-AMgCVN(Jv>$Cr+4i=@r4U(4u#?TkN(Wf z41p}NKp@IR)d zizC9t-O<@`41+#2w&hSXHk>(8ghi28oM~J|ntehvR3w@?K}N=aR|wb0Bt2tbUC)XT zc63ZMYi)aGj#PSR`mEU$iQ2C63&zwGX?lmQx_S<{dboZdz9%}?Gk}7^EFJj*t^r`dnU;ZDMxg3q+B)Fi00MqaE(GA}tMe!e z;Fh)f^%8c4Z>_M{9p)-KT3gzz%dD{KPc>*7*a0frQVz;bB_U!!4iVs8LwREk;q@qQ zmhS(Ab9soA2}y9=dtQb;hijS}j)WIu1gyEOTF6$#nHsSZf!4)j_~XnL2lSC(3{r(V z7?VMYOo|~DmL%oHBxRqyTAo)<;$T_AKwLm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