Skip to content

Entry for the Dialogflow CX competition, containing generic webhooks that can be easily reused across different agents

License

Notifications You must be signed in to change notification settings

TomHartogs/dialogflowcx-generic-webhooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generic reusable webhooks

License Typed with TypeScript

A Dialogflow CX competition entry

This repository contains generic webhooks that can be reused across multiple Dialogflow CX agents.

Setup

git clone https://github.com/TomHartogs/dialogflowcx-generic-webhooks.git
cd ./dialogflow-cx-generic-webhooks/functions
firebase --use add PROJECTID

Longterm storage

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.

Deployment

firebase deploy --only functions:longtermstorage

Usage

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.

Analytics

This webhook allows the tracking of custom events in your chatbot with the help of Google Analytics.

Deployment

firebase deploy --only functions:analytics

Note: Copy the URL of your function

Configuration

In order to track events, you first need to create a new Universal Analytics property in Google Analytics. To do this you must:

  1. Go to Admin settings

  2. Click Create Property

  3. Fill in property name

  4. Click Show advanced settings

  5. Select Create a Universal Analytics property

  6. Click Next

  7. Select your UA Property and go to Property Settings

  8. Copy Tracking ID Google Analytics setup Property settings Tracking id

  9. Create a new webhook

  10. Set Webhook URL to be the URL of your deployed cloud function

  11. Add a header with the key trackingid and in the value add your Google Analytics Tracking ID

Dialogflow CX webhook settings

Usage

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

Dialogflow CX fulfillment settings

About

Entry for the Dialogflow CX competition, containing generic webhooks that can be easily reused across different agents

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published