Giter VIP home page Giter VIP logo

dialogflow-facts-about-google-nodejs's Introduction

Actions on Google: Facts about Google

This sample demonstrates Actions on Google features for use on Google Assistant including custom entities, contexts, deep links, and rich responses -- using the Node.js client library and deployed on Cloud Functions for Firebase.

Setup Instructions

Prerequisites

  1. Node.js and NPM
    • We recommend installing using NVM
  2. Install the Firebase CLI
    • We recommend using version 6.5.0, npm install -g [email protected]
    • Run firebase login with your Google account

Configuration

Actions Console

  1. From the Actions on Google Console, New project (this will be your Project ID) > Create project > under More options > Conversational
  2. From the top menu under Develop > Actions (left nav) > Add your first action > BUILD (this will bring you to the Dialogflow console) > Select language and time zone > CREATE.
  3. In the Dialogflow console, go to Settings ⚙ > Export and Import > Restore from zip using the agent.zip in this sample's directory.

Firebase Deployment

  1. In the functions directory, run npm install
  2. Run firebase deploy --project {PROJECT_ID} to deploy the function
    • To find your Project ID: In Dialogflow console under Settings ⚙ > General tab > Project ID.

Dialogflow Console

  1. Return to the Dialogflow Console > select Fulfillment > Enable Webhook > Set URL to the Function URL that was returned after the deploy command > SAVE.
    Function URL (dialogflowFirebaseFulfillment): https://${REGION}-${PROJECT_ID}.cloudfunctions.net/dialogflowFirebaseFulfillment
    
  2. Add Deep Links:
    • Select Integrations from the left navigation menu > Google Assistant > Integration Settings > Implicit invocation > add choose_cats & choose_fact intents.
  3. From the left navigation menu, click Integrations > Integration Settings under Google Assistant > Enable Auto-preview changes > Test to open the Actions on Google simulator then say or type Talk to my test app.

Running this Sample

  • You can test your Action on any Google Assistant-enabled device. Make sure the Assistant is signed into the same account used to create the Actions project, and just say “OK Google, talk to my test app”.
  • You can also use the Actions on Google Console simulator to test most features and preview on-device behavior.

Automated Testing

Unit and integration tests are located in the functions/test/. In each of the JavaScript files, change projectId and pathToServiceAccount to your GCP project id and the path to the JSON file for your service account - please follow the following instructions on how to create a service account.

  1. npm install from the functions/ directory
  2. npm test

Notes:

  1. One of the configuration variables you'll need to set in the code is fulfillUrl, which is the url of the fulfillment. Ideally, this should be a locally run cloud function. We recommend using firebase serve.
  2. To use Dialogflow API, you will need to have service account that has the "Dialogflow API client" role. You can set this in the GCP IAM page (see https://cloud.google.com/iam/docs/creating-managing-service-account-keys).

References & Issues

Make Contributions

Please read and follow the steps in the CONTRIBUTING.md.

License

See LICENSE.

Terms

Your use of this sample is subject to, and by using or downloading the sample files you agree to comply with, the Google APIs Terms of Service.

dialogflow-facts-about-google-nodejs's People

Contributors

atulep avatar canain avatar danicat avatar norulesjustfeels avatar paolorotolo avatar silvolu avatar smishra2 avatar taycaldwell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dialogflow-facts-about-google-nodejs's Issues

when i tried to launch it in gcloud got the below error

[email protected] start /app
functions deploy factsAboutGoogle --trigger-http

sh: 1: functions: not found

npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/nodejs/bin/node" "/nodejs/bin/npm" "start"
npm ERR! node v4.2.6
npm ERR! npm v2.14.12
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] start: functions deploy factsAboutGoogle --trigger-http
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] start script 'functions deploy factsAboutGoogle --trigger-http'.
npm ERR! This is most likely a problem with the facts-about-google package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! functions deploy factsAboutGoogle --trigger-http
npm ERR! You can get their info via:
npm ERR! npm owner ls facts-about-google
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /app/npm-debug.log

DialogFlow with Google OAuth2.0

Hi any sample code that uses DialogFlow with Google OAuth2.0?

I believe there should be an oauthcallback and token endpoints but I can't seem to find any code to use.

This is for the account linking authorisation url and token url.

Api.ai help needed

After having followed the previous steps as mentioned in the README and YouTube tutorial,
I clicked on "RESTORE from ZIP" and placed the zip file there.

But I got this Errror message:
No intents or entities found in file. Make sure that file is a zip archive and that intents and entities are in json format and are located inside intents and entities folders correspondingly.

Failed to connect to Google Actions when account linking is activated

Hi!
I am not able to connect and integrate to Google Actions when I set Auth0 parameters.
I'm following this tutorial but not works to me :(

I want to authenticate the user and know some user's attributes such as email and username.

Before I set Auth0 server, Google Actions works fine (without authentication).
This is the error that Google Actions shows;
"It looks like your my test app account is not linked yet".

What is more, I can't integrate with Google Assistant from DialogFlow.

image

I use dialogflow V2 and jovo to deploy.

Any idea?

Step 3 contains unrealisable step

Step 3 contains the screenshot which is not actual and intents to actions which nowadays user won't be able to do.

From CodeLAB:
screen shot 2018-04-21 at 12 37 37

Screen from INTEGRATIONS tab today.
screen shot 2018-04-21 at 12 38 59

Please change a description a little bit and update screen or make it more clear via description.

Step 7: Restore from Zip - No intents or entities found in file

Hello @chatasweetie & team:

  1. I downloaded this, https://github.com/actions-on-google/dialogflow-facts-about-google-nodejs/blob/master/FactsAboutGoogle.zip
  2. Saved the file to downloads on my local machine.
  3. Tried to use the restore from zip button as instructed in step 7 of the Upload Agent within Dialogflow
  4. No intents or entities found in a file (see image): "No intents or entities found in file. Make sure that file is a zip archive and that intents and entities are in json format and are located inside intents and entities folders correspondingly."
  5. Tried to unzip the .zip file to inspect, but was unable to.
  6. I am using Chrome: 67.0.3396.99 (Official Build) (64-bit) on Windows 10 Pro V 1709

Is the zip created by zipping the functions folder? https://github.com/actions-on-google/dialogflow-facts-about-google-nodejs/tree/master/functions

Thanks,

Allan

image

Using app.data [QUESTION]

Hey!

I have one question about the usage of app.data. This app uses it to save the history and hq facts and delete them once they're told.

Is this a special property of the ApiAiApp class? Is it temporary or actually stored between sessions?

I use firebase functions and the app object is actually created inside of the function. So how is it that the app.data property lives between multiple requests?

Any pointers to resources about the lifecycle of firebase functions would be appreciated as well.

Intent about cats crashes with MalformedResponse

When calling the application with the about cats intent, the application fails with the message My test app isn't responding right now. Try again soon.

Looking at the debug info we see that there is a MalformedResponse error:

"sharedDebugInfoList": [
      {
        "name": "ResponseValidation",
        "debugInfo": "",
        "subDebugEntryList": [
          {
            "name": "MalformedResponse",
            "debugInfo": "expected_inputs[0].input_prompt.rich_initial_prompt.items[0].simple_response: 'text_to_speech' or 'ssml' must be set.",
            "subDebugEntryList": []
          }
        ]
      }

This can be reproduced on the simulator invoking the action with:

Talk to my test application about cats

or

Talk to my test application

and then

about cats

importing the project in dialogflow

When importing the project zip file in dialogflow it was not uploading and a message stating that the files does not have intents and other properties.
screenshot 40

Can't upload agent zip file to restore

hello,
I am trying to restore my agent from a backup zip file but when i click upload and select the zip file it won't upload the file.
dialogflow
as you see the window remain like that and don't progress for uploading.

pls share the webhook logic

where's the webhook logic being handled? I don't see any route for handling webhook post request from API.AI in the index.js. Could you pls add those details?

Adding a ";"

Page 8, I would add a ";" at the end of the functions to avoid the copy/past error. (very cosmetic, I know ;-)

Minimum Node Version Fails to Run Firebase CLI tools

Description

Currently, with the suggested node version ~4.2 for this project and the latest Firebase CLI tools version 3.12.0, running firebase init will fail:

$ firebase init
/usr/local/lib/node_modules/firebase-tools/node_modules/tar/lib/pack.js:32
const EOF = Buffer.alloc(1024)
                   ^

TypeError: Buffer.alloc is not a function

It seems that can be fixed by bumping up the minimum node version, as Buffer.alloc was added in Node 4.5.0

Proposal

  1. Update the node version to minimum requirement, ^4.5, as Firebase tools does. See Update below
  2. Or, use the node version recommended by Firebase CLI docs v.6.11.1

Fail Deploy

I'm trying to deploy this firebase project but there's a problem when i write "firebase deploy" in the shell:

Error: Error occurred while parsing your function triggers.

SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at mylocalpath\npm\node_modules\firebase-tools\lib\triggerParser.js:18:11
at Object. (C:\Users\David\AppData\Roaming\npm\node_modules\firebase-tools\lib\triggerParser.js:32:3)
at Module._compile (module.js:409:26)

How to deploy action to google cloud?

Step #6 says "Deploy this action to your preferred hosting environment". More details need to be added here.

Where to deploy index.js? In google cloud? We can create projects in google cloud,, but not sure where to add index.js which has all the business logic.

No intents or entities found in file

After having followed the previous steps as mentioned in the README and YouTube tutorial,
I clicked on "RESTORE from ZIP" and placed the zip file there.

But I got this Errror message:
No intents or entities found in file. Make sure that file is a zip archive and that intents and entities are in json format and are located inside intents and entities folders correspondingly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.