You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: firestore-dialogflow-fulfillment/POSTINSTALL.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ This will create a new DialogFlow agent named `${param:AGENT_NAME}` for you. You
10
10
11
11
## Setting up DialogFlow Fulfillment
12
12
13
-
First, copy this URL`https://${param:LOCATION}-${param:PROJECT_ID}.cloudfunctions.net/ext-firestore-dialogflow-fulfillment-dialogflowFulfillment`, which is the URL of the DialogFlow webhook.
13
+
First, copy this URL, which is the URL of the DialogFlow webhook: `https://${param:LOCATION}-${param:PROJECT_ID}.cloudfunctions.net/ext-firestore-dialogflow-fulfillment-dialogflowFulfillment`
14
14
15
15
Next, go to the DialogFlow console [here](https://dialogflow.cloud.google.com/#/agent/${param:PROJECT_ID}/fulfillment), enable the Webhook and add this URL as the Fulfillment webhook URL.
This extension integrates with DialogFlow through Firestore.
3
+
This extension integrates with DialogFlow through Firestore, it can book meetings on your calendar from a DialogFlow conversation.
4
+
5
+
You don't need to interact with DialogFlow in your app as the extension do it for you and provide the conversation replies from DialogFlow in a Firestore collection.
4
6
5
7
## Install The Extension
6
8
7
-
### Pre-requisites
9
+
Make sure `firebase-tools` is installed: `npm i -g firebase-tools`.
8
10
9
-
1. Make sure `firebase-tools` is installed: `npm i -g firebase-tools`.
Before you can use the extension, you need to have a DialogFlow agent. The extension provides you with a HTTP function that you can call to create an agent for you, so you don't to do it manually.
20
+
21
+
To create and agent, you can call the `ext-firestore-dialogflow-fulfillment-createDialogflowAgent` function through the [Google Cloud CLI](https://cloud.google.com/sdk/gcloud):
This will create a new DialogFlow agent for you. You can find the agent in the DialogFlow console [here](https://dialogflow.cloud.google.com/#/agents).
30
+
31
+
### Setting up DialogFlow Fulfillment
32
+
20
33
The extension will deploy a HTTP function that will be used as a Fullfilment webhook for DialogFlow. The function will look like this, with the `PROJECT_ID` replaced with your project ID, and the `LOCATION` replaced with your project's default Cloud Functions location:
Provide the URL to DialogFlow as the Fulfillment webhook URL.
27
40
28
-
### Development
41
+
### Give the extension access to your calendar
29
42
30
-
1.`cd firestore-dialogflow-fulfillment/functions` && `npm run build`
31
-
2.`cd firestore-dialogflow-fulfillment/demo` && `npm run dev`
32
-
3.`cd _emulator` && `firebase emulators:start`
43
+
To allow the extension to create events, you need to give it access to the calendar `${param:CALENDAR_ID}`. To do this, copy the extension service account principal email address from the [Service Accounts page](https://console.cloud.google.com/iam-admin/serviceaccounts) in the Google Cloud Console, which starts with `ext-firestore-dialogflow`. Then, go to your calendar Sharing settings, and add the email with **Make changes to events** permission.
Call `newConversation` with a `message` to start a new conversation, which will return a `conversationId` that you can use to send messages to the same conversation.
37
48
38
-
- Agent = Overall agent who will handle the conversation
39
-
- Intent = Based on user input, dialogflow will match to an intent based on the settings in that intent
40
-
- We are trying to get a DATE & TIME from the user (to do something with, e.g. add something to Google calendar)
41
-
- If DialogFlow doesn't have both parameters, it will ask the user for them (based on ML and the data in the intent config)
- Each time DialogFlow gets a message, it'll send it through the webhook (https://dialogflow.cloud.google.com/#/agent/extensions-testing/fulfillment)
44
-
- In our webhook logic, if the intent matches one we care about AND we have both DATE & TIME parameters, we'll send a message to the user, otherwise just let DialogFlow handle it.
45
-
- At this point we'll go and do some API task and respond to the user (e.g. "I've added that to our calendar, see you on X at Y")
59
+
To add new messages to the conversation, call `newMessage` with the `conversationId` and `message`.
(Note: Been using https://ngrok.com/ to pipe the webhook messages to the emulator - just needs installing and setting up on the port functions are running on).
73
+
## Development
48
74
49
-
The current general flow for the extension is:
75
+
1.`cd firestore-dialogflow-fulfillment/functions` && `npm run build`
76
+
2.`cd firestore-dialogflow-fulfillment/demo` && `npm run dev`
77
+
3.`cd _emulator` && `firebase emulators:start`
50
78
51
-
-`newConversation` - Callable Function. Takes a message, creates a new conversation and adds a doc to a subcollection, and returns the ID (which the user can use to listen to new messages).
52
-
-`newMessage` - adds a new user message to the conversation
53
-
-`onNewMessage` - a firestore trigger that listens for new messages. If it's from the user, we'll send a message to dialog flow and wait for a response. Once we have that, add a message to the conversation.
54
-
-`dialogflowFulfillment` - HTTP function (ignores auth for now), which DialogFlow calls - here we can respond with our own messages to the user if we want.
79
+
(Note: Been using https://ngrok.com/ to pipe the webhook messages to the emulator - just needs installing and setting up on the port functions are running on).
55
80
56
81
Use `lsof -t -i:4001 -i:8080 -i:9000 -i:9099 -i:9199 -i:8085 | xargs kill -9` to kill emulators.
0 commit comments