This repository contains generic webhooks that can be reused across multiple Dialogflow CX agents.
git clone https://github.com/TomHartogs/dialogflowcx-generic-webhooks.git
cd ./dialogflow-cx-generic-webhooks/functions
firebase --use add PROJECTID
Use this simple webhook if you want to store sessionParameters over multiple sessions. The webhook will read and write sessionParameters to a firestore database. Allowing you to easily save user progress/context and to retrieve it in a following session.
firebase deploy --only functions:longtermstorage
The webhook supports 3 types of tags:
Tag | Description |
---|---|
Save | Saves all session parameters in a firestore document with the sessionId as unique key |
Load | Looks for a document with the sessionId and appends the previous sessionParameters to the current parameters |
Clear | Clears all session parameters from both the current session and the storage |
Be sure to store the sessionId somewhere in the front-end so you can use the same id with later sessions.
This webhook allows the tracking of custom events in your chatbot with the help of Google Analytics.
firebase deploy --only functions:analytics
Note: Copy the URL of your function
In order to track events, you first need to create a new Universal Analytics property in Google Analytics. To do this you must:
-
Go to Admin settings
-
Click
Create Property
-
Fill in property name
-
Click
Show advanced settings
-
Select
Create a Universal Analytics property
-
Click
Next
-
Select your UA Property and go to Property Settings
-
Create a new webhook
-
Set Webhook URL to be the URL of your deployed cloud function
-
Add a header with the key
trackingid
and in the value add yourGoogle Analytics Tracking ID
To send events to Google Analytics you need to trigger your webhook. In the tag you need to define a JSON with the following parameters
Key | Value |
---|---|
Event | Name of the custom event as to be displayed in Google Analytics |
Category | Category of the event |
Label | Custom label |