Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Commit d8396fa

Browse files
author
Matt Carroll
committed
Updated samples, unzipped sample agents, fixed peer dependency issue
Change-Id: I89f5a92d5df08aa7bf3485c199154a5a1377d1f7
1 parent d6eabd5 commit d8396fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1060
-45
lines changed

docs/WebhookClient.md

+22-11
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ Dialogflow's simulator
1919
* [.query](#WebhookClient+query) : <code>string</code>
2020
* [.locale](#WebhookClient+locale) : <code>string</code>
2121
* [.session](#WebhookClient+session) : <code>string</code>
22-
* [.add(response)](#WebhookClient+add)
22+
* [.consoleMessages](#WebhookClient+consoleMessages) : [<code>Array.&lt;RichResponse&gt;</code>](#RichResponse)
23+
* [.add(responses)](#WebhookClient+add)
24+
* [.addResponse_(response)](#WebhookClient+addResponse_)
2325
* [.handleRequest(handler)](#WebhookClient+handleRequest) ⇒ <code>Promise</code>
24-
* [.getConsoleMessages()](#WebhookClient+getConsoleMessages) ⇒ <code>Array.&lt;RichResponses&gt;</code>
2526
* [.setContext(context)](#WebhookClient+setContext)[<code>WebhookClient</code>](#WebhookClient)
2627
* [.clearOutgoingContexts()](#WebhookClient+clearOutgoingContexts)[<code>WebhookClient</code>](#WebhookClient)
2728
* [.clearContext(context)](#WebhookClient+clearContext)[<code>WebhookClient</code>](#WebhookClient)
@@ -109,10 +110,28 @@ Dialogflow input contexts included in the request or null if no value
109110
Dialogflow v2 API only
110111
https://dialogflow.com/docs/reference/api-v2/rest/v2beta1/WebhookRequest#FIELDS.session
111112

113+
**Kind**: instance property of [<code>WebhookClient</code>](#WebhookClient)
114+
<a name="WebhookClient+consoleMessages"></a>
115+
116+
### webhookClient.consoleMessages : [<code>Array.&lt;RichResponse&gt;</code>](#RichResponse)
117+
List of messages defined in Dialogflow's console for the matched intent
118+
https://dialogflow.com/docs/rich-messages
119+
112120
**Kind**: instance property of [<code>WebhookClient</code>](#WebhookClient)
113121
<a name="WebhookClient+add"></a>
114122

115-
### webhookClient.add(response)
123+
### webhookClient.add(responses)
124+
Add a response or list of responses to be sent to Dialogflow
125+
126+
**Kind**: instance method of [<code>WebhookClient</code>](#WebhookClient)
127+
128+
| Param | Type | Description |
129+
| --- | --- | --- |
130+
| responses | [<code>RichResponse</code>](#RichResponse) \| <code>string</code> \| [<code>Array.&lt;RichResponse&gt;</code>](#RichResponse) \| <code>Array.&lt;string&gt;</code> | (list) or single responses |
131+
132+
<a name="WebhookClient+addResponse_"></a>
133+
134+
### webhookClient.addResponse_(response)
116135
Add a response to be sent to Dialogflow
117136

118137
**Kind**: instance method of [<code>WebhookClient</code>](#WebhookClient)
@@ -133,14 +152,6 @@ Each handler must be a function callback.
133152
| --- | --- | --- |
134153
| handler | <code>Map</code> \| <code>requestCallback</code> | map of Dialogflow action name to handler function or function to handle all requests (regardless of Dialogflow action). |
135154

136-
<a name="WebhookClient+getConsoleMessages"></a>
137-
138-
### webhookClient.getConsoleMessages() ⇒ <code>Array.&lt;RichResponses&gt;</code>
139-
Get a list of responses defined in Dialogflow's console
140-
for the matched intent
141-
https://dialogflow.com/docs/rich-messages
142-
143-
**Kind**: instance method of [<code>WebhookClient</code>](#WebhookClient)
144155
<a name="WebhookClient+setContext"></a>
145156

146157
### webhookClient.setContext(context) ⇒ [<code>WebhookClient</code>](#WebhookClient)

package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "dialogflow-fulfillment",
33
"description": "Dialogflow Fulfillment Library for Node.js",
44
"main": "src/dialogflow-fulfillment.js",
5-
"version": "0.4.0",
5+
"version": "0.4.1",
66
"license": "Apache-2.0",
77
"author": "Google Inc.",
88
"directories": {
@@ -37,11 +37,10 @@
3737
"fulfillment"
3838
],
3939
"dependencies": {
40-
"actions-on-google": "^2.1.2",
4140
"debug": "^3.1.0"
4241
},
4342
"peerDependencies": {
44-
"actions-on-google": "^2.0.1"
43+
"actions-on-google": "^2.1.3"
4544
},
4645
"devDependencies": {
4746
"ava": "^0.24.0",

samples/actions-on-google/README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ Click on the **Add to Dialogflow** button below and follow the prompts to create
99
[![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)
1010

1111
### Option 2: Dialogflow Inline Editor
12-
1. [Sign up for or sign into Dialogflow](https://console.dialogflow.com/api-client/#/login)
13-
1. Create a Dialogflow agent
12+
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)
13+
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)
1414
1. [Enable the Cloud Function for Firebase inline editor](https://dialogflow.com/docs/fulfillment#cloud_functions_for_firebase)
1515
1. Copy this code in `functions/index.js` the `index.js` file in the Dialogflow Cloud Function for Firebase inline editor.
16-
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.
16+
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.
1717
1. Click `Deploy`
1818

1919
### Option 3: Firebase CLI
20-
1. Create a Dialogflow agent
20+
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)
21+
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)
2122
1. `cd` to the `functions` directory
2223
1. Run `npm install`
2324
1. Install the Firebase CLI by running `npm install -g firebase-tools`
Binary file not shown.
8.06 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"description": "",
3+
"language": "en",
4+
"disableInteractionLogs": false,
5+
"disableStackdriverLogs": true,
6+
"googleAssistant": {
7+
"googleAssistantCompatible": true,
8+
"project": "libsample-advanced",
9+
"welcomeIntentSignInRequired": false,
10+
"startIntents": [],
11+
"systemIntents": [],
12+
"endIntentIds": [
13+
"736b2be9-7526-4f76-91ca-e16f46ea2cca",
14+
"6e9eae14-ec0e-4925-8506-96adab96eee4"
15+
],
16+
"oAuthLinking": {
17+
"required": false,
18+
"grantType": "AUTH_CODE_GRANT"
19+
},
20+
"voiceType": "MALE_1",
21+
"capabilities": [],
22+
"protocolVersion": "V2",
23+
"autoPreviewEnabled": true,
24+
"isDeviceAgent": false
25+
},
26+
"defaultTimezone": "America/Los_Angeles",
27+
"webhook": {
28+
"url": "https://us-central1-actionsontransactions.cloudfunctions.net/dialogflowFirebaseFulfillment",
29+
"headers": {
30+
"": ""
31+
},
32+
"available": true,
33+
"useForDomains": false,
34+
"cloudFunctionsEnabled": true,
35+
"cloudFunctionsInitialized": true
36+
},
37+
"isPrivate": true,
38+
"customClassifierMode": "use.after",
39+
"mlMinConfidence": 0.3,
40+
"supportedLanguages": [],
41+
"onePlatformApiVersion": "v2"
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"id": "6e9eae14-ec0e-4925-8506-96adab96eee4",
3+
"name": "Action on Google List Select",
4+
"auto": true,
5+
"contexts": [],
6+
"responses": [
7+
{
8+
"resetContexts": false,
9+
"affectedContexts": [],
10+
"parameters": [],
11+
"messages": [
12+
{
13+
"type": "simple_response",
14+
"platform": "google",
15+
"lang": "en",
16+
"textToSpeech": "You selected an item from a list or carousel with the key \"#actions_intent_OPTION.OPTION\""
17+
}
18+
],
19+
"defaultResponsePlatforms": {
20+
"google": false
21+
},
22+
"speech": []
23+
}
24+
],
25+
"priority": 500000,
26+
"webhookUsed": false,
27+
"webhookForSlotFilling": false,
28+
"lastUpdate": 1528133199,
29+
"fallbackIntent": false,
30+
"events": [
31+
{
32+
"name": "actions_intent_OPTION"
33+
}
34+
]
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"id": "a574dd15-59da-46e7-a17f-a621902a5bc7",
3+
"name": "Default Fallback Intent",
4+
"auto": true,
5+
"contexts": [],
6+
"responses": [
7+
{
8+
"resetContexts": false,
9+
"action": "input.unknown",
10+
"affectedContexts": [],
11+
"parameters": [],
12+
"messages": [
13+
{
14+
"type": 0,
15+
"lang": "en",
16+
"speech": [
17+
"I didn\u0027t get that. Can you say it again?",
18+
"I missed what you said. Say it again?",
19+
"Sorry, could you say that again?",
20+
"Sorry, can you say that again?",
21+
"Can you say that again?",
22+
"Sorry, I didn\u0027t get that.",
23+
"Sorry, what was that?",
24+
"One more time?",
25+
"What was that?",
26+
"Say that again?",
27+
"I didn\u0027t get that.",
28+
"I missed that."
29+
]
30+
}
31+
],
32+
"defaultResponsePlatforms": {},
33+
"speech": []
34+
}
35+
],
36+
"priority": 500000,
37+
"webhookUsed": false,
38+
"webhookForSlotFilling": false,
39+
"fallbackIntent": true,
40+
"events": []
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"id": "d4299d80-7da4-4fd2-a7b7-477ffb7a5df9",
3+
"name": "Default Welcome Intent",
4+
"auto": true,
5+
"contexts": [],
6+
"responses": [
7+
{
8+
"resetContexts": false,
9+
"action": "input.welcome",
10+
"affectedContexts": [],
11+
"parameters": [],
12+
"messages": [
13+
{
14+
"type": 0,
15+
"lang": "en",
16+
"speech": [
17+
"Hi!",
18+
"Hello!",
19+
"Good day!",
20+
"Greetings!"
21+
]
22+
}
23+
],
24+
"defaultResponsePlatforms": {},
25+
"speech": []
26+
}
27+
],
28+
"priority": 500000,
29+
"webhookUsed": false,
30+
"webhookForSlotFilling": false,
31+
"fallbackIntent": false,
32+
"events": [
33+
{
34+
"name": "WELCOME"
35+
}
36+
]
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"id": "8ea5901d-817c-4514-8d00-5f8619e4f26e",
3+
"name": "Other Intent",
4+
"auto": true,
5+
"contexts": [],
6+
"responses": [
7+
{
8+
"resetContexts": false,
9+
"affectedContexts": [],
10+
"parameters": [],
11+
"messages": [
12+
{
13+
"type": 0,
14+
"lang": "en",
15+
"speech": []
16+
}
17+
],
18+
"defaultResponsePlatforms": {},
19+
"speech": []
20+
}
21+
],
22+
"priority": 500000,
23+
"webhookUsed": true,
24+
"webhookForSlotFilling": false,
25+
"lastUpdate": 1528132560,
26+
"fallbackIntent": false,
27+
"events": []
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
{
3+
"id": "262b5c54-aed4-4ad1-8a6f-424cf0c644df",
4+
"data": [
5+
{
6+
"text": "other intent",
7+
"userDefined": false
8+
}
9+
],
10+
"isTemplate": false,
11+
"count": 0,
12+
"updated": 1528132560
13+
}
14+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"version": "1.0.0"
3+
}

samples/actions-on-google/functions/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
"deploy": "firebase deploy --only functions:dialogflowFirebaseFulfillment"
1414
},
1515
"dependencies": {
16-
"firebase-admin": "^4.2.1",
17-
"firebase-functions": "^0.5.7",
18-
"dialogflow-fulfillment": "^0.4.0",
19-
"actions-on-google": "^2.1.2"
16+
"firebase-admin": "^5.12.1",
17+
"firebase-functions": "^1.0.3",
18+
"actions-on-google": "^2.1.3",
19+
"dialogflow-fulfillment": "0.4.1"
2020
}
21-
}
21+
}

samples/multi-lang-and-locale/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ Click on the **Add to Dialogflow** button below and follow the prompts to create
99
[![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)
1010

1111
### Option 2: Dialogflow Inline Editor
12-
1. [Sign up for or sign into Dialogflow](https://console.dialogflow.com/api-client/#/login)
13-
1. Create a Dialogflow agent
12+
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)
13+
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)
1414
1. [Enable the Cloud Function for Firebase inline editor](https://dialogflow.com/docs/fulfillment#cloud_functions_for_firebase)
1515
1. Change the name of the function in `functions/index.js` from `dialogflowFulfillmentMultiLocale` to `dialogflowFirebaseFulfillment`
1616
1. Copy this code in `functions/index.js` the `index.js` file in the Dialogflow Cloud Function for Firebase inline editor.
1717
1. Add `"dialogflow-fulfillment": "^0.4.0"` to the `package.json` file's `dependencies` object in the Dialogflow Cloud Function for Firebase inline editor.
1818
1. Click `Deploy`
1919

2020
### Option 3: Firebase CLI
21-
1. Create a Dialogflow agent
22-
1. Go to your agent's settings and [Restore from zip](https://dialogflow.com/docs/agents#export_and_import) using the `multilocaleAgent.zip` in this directory (Note: this will overwrite your existing agent)
21+
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)
22+
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)
2323
1. `cd` to the `functions` directory
2424
1. Run `npm install`
2525
1. Install the Firebase CLI by running `npm install -g firebase-tools`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"description": "",
3+
"language": "en",
4+
"disableInteractionLogs": false,
5+
"googleAssistant": {
6+
"googleAssistantCompatible": true,
7+
"project": "libsample-multilangandlocale",
8+
"welcomeIntentSignInRequired": false,
9+
"startIntents": [],
10+
"systemIntents": [],
11+
"endIntentIds": [],
12+
"oAuthLinking": {
13+
"required": false,
14+
"grantType": "AUTH_CODE_GRANT"
15+
},
16+
"voiceType": "MALE_1",
17+
"capabilities": [],
18+
"protocolVersion": "V2",
19+
"autoPreviewEnabled": true
20+
},
21+
"defaultTimezone": "America/Los_Angeles",
22+
"webhook": {
23+
"url": "https://us-central1-libsample-advanced.cloudfunctions.net/dialogflowFirebaseFulfillment",
24+
"headers": {
25+
"": ""
26+
},
27+
"available": true,
28+
"useForDomains": false,
29+
"cloudFunctionsEnabled": true,
30+
"cloudFunctionsInitialized": true
31+
},
32+
"isPrivate": true,
33+
"customClassifierMode": "use.after",
34+
"mlMinConfidence": 0.3,
35+
"supportedLanguages": [
36+
"fr"
37+
],
38+
"onePlatformApiVersion": "v2"
39+
}

0 commit comments

Comments
 (0)