Giter VIP home page Giter VIP logo

fulfillment-weather-nodejs's Introduction

Dialogflow Fulfillment: Node.js Weather Sample

Dialogflow and Fulfillment Setup

Select only one of the options below.

Option 1: Add to Dialogflow (Recommended)

To create this agent from our template:

 
  1. Get a WWO Local Weather REST API key from https://developer.worldweatheronline.com/api/
  2. Replace <ENTER_WWO_API_KEY_HERE> with your WWO API key on line 20 of functions/index.js
  3. Select Deploy.
  4. In Dialogflow Console > Settings ⚙ > select Google Cloud link in Project ID section. From Google Cloud Platform > menu ☰ > Enable Billing.

Option 2: Firebase CLI

  1. Create a Dialogflow Agent
  2. git clone https://github.com/dialogflow/fulfillment-weather-nodejs.git
  3. In Dialogflow console under Settings ⚙ > Restore from Zip using the weather-agent.zip in this directory.
  4. Get a WWO Local Weather REST API key from https://developer.worldweatheronline.com/api/
  5. Replace <ENTER_WWO_API_KEY_HERE> with your WWO API key on line 20 of functions/index.js
  6. cd to the functions directory
  7. Run npm install
  8. Install the Firebase CLI with npm install -g firebase-tools
  9. Login to your Google account with firebase login
  10. Add your project to the sample with firebase use [project ID]
    • In Dialogflow console under Settings ⚙ > General tab > copy Project ID.
  11. Run firebase deploy --only functions:dialogflowFulfillmentLibAdvancedSample
  12. 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>
  13. Back in Dialogflow Console > Fulfullment > Enable Webhook.
  14. Paste the URL from the Firebase Console’s events column into the URL field > Save.
  15. In Dialogflow Console > Settings ⚙ > select Google Cloud link in Project ID section. From Google Cloud Platform > menu ☰ > Enable Billing.

Related Samples

Name Language
Fulfillment & Regex Validation Node.js
Weather: Fulfillment & WWO API Node.js
Bike Shop: Fulfillment & Google Calendar API Node.js
Temperature Trivia: Fulfillment & Actions on Google Node.js
Fulfillment & Actions on Google Node.js
Fulfillment & Firestore Database Node.js
Multi-language/locale Node.js
Basic Slot Filling Node.js
Alexa Importer Node.js

For Fulfillment Webhook JSON Requests & Responses.

References & Issues

Make Contributions

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

License

See LICENSE.md.

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.

fulfillment-weather-nodejs's People

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

Watchers

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

fulfillment-weather-nodejs's Issues

Getting Error while python deployment

I tried so many times to deploy python part 3 code on Heroku. but getting 500 internal server error.
Could you please help me or provide me a link where it is deployed

Thanks

The date format that creates the dialogflow api v2 does not match api worldweatheronline date format

Sorry for my english it's done by machine translation.
dialogflow api v2 creates System Entities sys@date in the following format "2018-04-06T12: 00: 00-06: 00" string in ISO-8601 format for api worldweatheronline the following 2018-04-06 format applies. Because of this, the weather forecast for the date is not correctly reproduced. With this goal I suggest correcting the following lines in the code
let date = '';
let date1 = req.body.queryResult.parameters['date'];
if (date1.substr(0,10)) {
date = date1.substr(0,10);
console.log('Date: ' + date);
} else { date = new Date().toJSON().substr(0,10);
console.log('Date: ' + date);
}

This example doesn't work anymore, please update it

After spending a massive amount of time trying to fix it, I've found a way to make it work.

I did the following:

  1. Complete the steps as described in the Option 1: Add to Dialogflow in the readme

  2. In the package.json, change the firebase admin version to:
    firebase-admin": "^6.0.0

  3. in the index.js, add the following lines after "use strict":

var admin = require('firebase-admin');
admin.initializeApp({
  credential: admin.credential.applicationDefault(),
  databaseURL: 'https://<DATABASE_NAME>.firebaseio.com'
});

No need to replace DATABASE_NAME with anything, just leave this string as it is.

I'm not sure if all of the additional steps are actually required. But my bot is now able to get the weaather.

Cant make http request with intent

So I'm currently trying to have an intent trigger an http request but keep getting errors.

When the intent triggers this code is executed

const https = require('https');
https.get('*************',
(resp) => {
let data = '';

resp.on('data', (chunk) => {
data += chunk;
});


resp.on('end', () => {
console.log(JSON.parse(data).explanation);
});

}).on("error", (err) => {
console.log("Error: " + err.message);
});
When running the intent I get Error: getaddrinfo ENOTFOUND back

My code works fine when I run it locally so the issue appears to be something not lining up properly with dialogflow

If anyone has any advice I would greatly appreciate it.

Thanks!

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.