This repository contains the complete code for creating and developing the Pulse Google Assistant Agent created for Youtube.
Included is the zipped JSON for easy agent import, the full cloud function code to be hosted by Firebase and tools for local development.
Before beginning you must have a google account. You can create one here.
- Create or Import a New Project on Actions on Google
- Specify Invocation of your project under Setup > Invocation
- Add an Action to fufill your invocation under Build > Actions
- Select Custom Intent then Build
- You will be redirected to Dialogflow
- Rename your Dialogflow Agent
- Specify language, timezone and click Create
- Clone the repository with
git clone https://github.com/BenjaminKostiuk/radiant-pulse.git
- Navigate in Dialogflow console under Settings ⚙ > Export and Import tab > RESTORE FROM ZIP
- Select
DialogflowAgent.zip
from the project directory - Type
RESTORE
and click Restore - Click Save
- Ensure that all intents and entities have been imported properly
- Navigate to https://console.developers.google.com/apis/dashboard?
- Select the name of your Google Project
- Under Library search for the Youtube Analytics & Youtube Data V3 APIS and enable both.
- Next, navigate to Credentials and find the auto created OAuth 2.0 client ID.
- It should be named Web Client (auto created by Google Service).
- Make a note of the Client ID and Client secret. These will be used for setting up Oauth.
- Add this authorized redirect URI under the section Authorized redirect URIs: https://oauth-redirect.googleusercontent.com/r/ {your app name} and save.
- Navigate to https://console.actions.google.com and select your Google project > Develop > Account Linking
- Select 'Yes, allow users to sign up for new accounts via voice'.
- Select OAuth & Google Sign In as Linking Type with Implicit Authentication.
- Paste the Client ID from earlier and the following information:
- Authorization URL: https://accounts.google.com/o/oauth2/v2/auth
- Token URL: https://www.googleapis.com/oauth2/v3/tokeninfo
- Add the following scopes to the client: // TODO add more scopes
https://www.googleapis.com/auth/yt-analytics.readonly
- Save and test
cd
to thefunctions
directory from the repository- Run
npm install
- Install the Firebase CLI by running
npm install -g firebase-tools
- Login with your Google account,
firebase login
- Add your project to the sample with
firebase use <project ID>
- In Dialogflow console under Settings ⚙ > General tab > copy Project ID.
- Navigate to the
functions
directory. - Run
npm run tunnel
and copy the URL that ngrok gives. It should look like this http://75e31e28.ngrok.io. - In a new terminal run
npm run serve
from the functions directory. - Back in the Dialogflow Console > Fulfillment > Enable Webhook.
- Change the URL to {url}/dialogflow
- For example: http://75e31e28.ngrok.io/dialogflow
- Save the changes. All traffic should be forwarded to localhost:5000.
- Navigate to the
functions
directory. - Run
firebase deploy --only functions:dialogflowFirebaseFulfillment
- When successfully deployed, visit the Project Console link > Functions > Dashboard
- Copy the link under the events column. For example:
https://us-central1-<PROJECTID>.cloudfunctions.net/<FUNCTIONNAME>
- Ensure that back in Dialogflow Console > Fulfillment > Enable Webhook.
- If not, Paste the URL from the Firebase Console’s events column into the URL field > Save..
Name | Language |
---|---|
Fulfillment Webhook JSON | JSON |
Dialogflow Console Template | Node.js |
Bike Shop-Google Calendar API | Node.js |
WWO Weather API | Node.js |
Alexa Importer | Node.js |
Temperature Trivia | Node.js |
Human-Agent | Node.js |
Google Translation API | Python |
WWO Weather API | Python |
- Questions? Try StackOverflow.
- Dialogflow Documentation.
- For more information on Initializing Firebase SDK for Cloud Functions.
See LICENSE.