问题
I'm experimenting with my Google Home and I read a lot about actions on google and was able to deploy it to Google Cloud Services, but how does the Google Home know where my application is if it's on Heroku?
Does it have something to do with creds.data
and theActions-On-Google-nodejs SDK
?
回答1:
Here is a steps to deploy an heroku app with google home.
Let us take an example provided by google.
First download git in your system git-scm.com/download/win
Download Heroku CLI from heroku.com
Install NODE.JS from here nodejs.org/en/
Open Git Bash in your computer, locate a folder where you want to start your project.
Clone git project Example provide by Google (" git clone https://github.com/actions-on-google/apiai-facts-about-google-nodejs "), this is a command for git bash to clone project in your computer, just copy and paste the command separated in inverted comma and press enter, you will find a new folder with name (apiai-facts-about-google-nodejs) .
Use these Command to get the things done(BELOW BOLD TEXT ARE ALL COMMANDS)
cd apiai-facts-about-google-nodejs (Command for GIT Bash)
npm install (Command for GIT Bash)
Heroku Login (In Command Prompt) and write heroku credentials
heroku create APP_NAME (Command for GIT Bash)
git add . (Command for GIT Bash) fullestop is important which tells that you app is in current working directory.
git commit -am "Firstcommit" (Command for GIT Bash)
git push heroku master (Command for GIT Bash)
********************END OF NODE.JS PART*********************
Open API.AI login and Create New Agent.
With named MyAction.
Restore the zip into the MyAction project: (When You clone GIT App, A folder was created On POINT NO 5 ,mention above ,inside a folder there is a ZIP file, it is basically for API.AI)
Click on the gear icon to the right of the agent name.
Click on the Export and Import tab.
Click Restore from Zip and select the API.AI project zip file (Located in your sample folder with name FactsAboutGoogle.ZIP ).
Type RESTORE in the text box and click Restore.
Enable fulfillment:
Click Fulfillment and slide the Enabled slider to the right.
In the URL field, enter the endpoint URL for fulfillment. The URL is Your Node.js Application , Login on heroku.com select the app you create with name in Point No 10 .
On the top right hand ,You will see a link Open App click on it copy the URL and Paste into your API.AI fulfillment and ENABLE DOMAINS.
Now you can test you app on API.AI it start communication with Heroku but still not with Google Home. For this follow the below steps.
Click on Integrations.
Enable ACTION ON GOOGLE
Name The Agent you call from your google home.
he is asking for Google Project ID (for this you will have to create a project on google cloud).
go to console.developers.google.com
create app
Click On ENABLE API
Search Google Actions API
click on Google Actions API
click Enable
click on Directory listing
Fill the form .
See the Youtube video and implement on Integration with Google rest of the thing already done.
Now you can able to play with Google Home.
回答2:
Even if you host the action on Heroku, you still need to provide either the httpExecution URL in the action package if you are using the Actions SDK, or the fulfillment URL if you are using API.AI.
The actions actions client library can run on any hosting platform supporting Node.js.
来源:https://stackoverflow.com/questions/41773484/how-do-i-deploy-a-actions-on-google-on-heroku