/radiant-pulse

Google Assistant Agent connecting users and content creators with YouTube interactions, data, analytics and insights.

Primary LanguageJavaScriptApache License 2.0Apache-2.0

Pulse for Google Assistant

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.

Setup

Before beginning you must have a google account. You can create one here.

Step 1: Create a new Project on Actions on Google

  1. Create or Import a New Project on Actions on Google
  2. Specify Invocation of your project under Setup > Invocation
  3. Add an Action to fufill your invocation under Build > Actions
  4. Select Custom Intent then Build
  5. You will be redirected to Dialogflow
  6. Rename your Dialogflow Agent
  7. Specify language, timezone and click Create

Step 2: Setting up your Dialogflow Agent

  1. Clone the repository with git clone https://github.com/BenjaminKostiuk/radiant-pulse.git
  2. Navigate in Dialogflow console under Settings ⚙ > Export and Import tab > RESTORE FROM ZIP
  3. Select DialogflowAgent.zip from the project directory
  4. Type RESTORE and click Restore
  5. Click Save
  6. Ensure that all intents and entities have been imported properly

Step 3: Connect to the Youtube API

  1. Navigate to https://console.developers.google.com/apis/dashboard?
  2. Select the name of your Google Project
  3. Under Library search for the Youtube Analytics & Youtube Data V3 APIS and enable both.
  4. 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).
  1. Make a note of the Client ID and Client secret. These will be used for setting up Oauth.
  2. Add this authorized redirect URI under the section Authorized redirect URIs: https://oauth-redirect.googleusercontent.com/r/ {your app name} and save.
  3. Navigate to https://console.actions.google.com and select your Google project > Develop > Account Linking
  4. Select 'Yes, allow users to sign up for new accounts via voice'.
  5. Select OAuth & Google Sign In as Linking Type with Implicit Authentication.
  6. Paste the Client ID from earlier and the following information:
  1. Add the following scopes to the client: // TODO add more scopes
https://www.googleapis.com/auth/yt-analytics.readonly
  1. Save and test

Step 4: Firebase CLI and npm

  1. cd to the functions directory from the repository
  2. Run npm install
  3. Install the Firebase CLI by running npm install -g firebase-tools
  4. Login with your Google account, firebase login
  5. Add your project to the sample with firebase use <project ID>
  • In Dialogflow console under Settings ⚙ > General tab > copy Project ID.

Development

Locally

  1. Navigate to the functions directory.
  2. Run npm run tunnel and copy the URL that ngrok gives. It should look like this http://75e31e28.ngrok.io.
  3. In a new terminal run npm run serve from the functions directory.
  4. Back in the Dialogflow Console > Fulfillment > Enable Webhook.
  5. Change the URL to {url}/dialogflow
  1. Save the changes. All traffic should be forwarded to localhost:5000.

Deployment

  1. Navigate to the functions directory.
  2. Run firebase deploy --only functions:dialogflowFirebaseFulfillment
  3. 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>
  1. 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..

Other Dialogflow Samples

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

Resources & Issues

License

See LICENSE.

Contributors