How do I deploy a Actions-On-Google on Heroku?

2019-09-05 22:19发布

问题:

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.

  1. First download git in your system git-scm.com/download/win

  2. Download Heroku CLI from heroku.com

  3. Install NODE.JS from here nodejs.org/en/

  4. Open Git Bash in your computer, locate a folder where you want to start your project.

  5. 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) .

  6. Use these Command to get the things done(BELOW BOLD TEXT ARE ALL COMMANDS)

  7. cd apiai-facts-about-google-nodejs (Command for GIT Bash)

  8. npm install (Command for GIT Bash)

  9. Heroku Login (In Command Prompt) and write heroku credentials

  10. heroku create APP_NAME (Command for GIT Bash)

  11. git add . (Command for GIT Bash) fullestop is important which tells that you app is in current working directory.

  12. git commit -am "Firstcommit" (Command for GIT Bash)

  13. git push heroku master (Command for GIT Bash)

********************END OF NODE.JS PART*********************

  1. Open API.AI login and Create New Agent.

  2. With named MyAction.

  3. 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)

  4. Click on the gear icon to the right of the agent name.

  5. Click on the Export and Import tab.

  6. Click Restore from Zip and select the API.AI project zip file (Located in your sample folder with name FactsAboutGoogle.ZIP ).

  7. Type RESTORE in the text box and click Restore.

  8. Enable fulfillment:

  9. Click Fulfillment and slide the Enabled slider to the right.

  10. 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 .

  11. 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.

  12. 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.

  13. Click on Integrations.

  14. Enable ACTION ON GOOGLE

  15. Name The Agent you call from your google home.

  16. he is asking for Google Project ID (for this you will have to create a project on google cloud).

  17. go to console.developers.google.com

  18. create app

  19. Click On ENABLE API

  20. Search Google Actions API

  21. click on Google Actions API

  22. click Enable

  23. click on Directory listing

  24. Fill the form .

  25. See the Youtube video and implement on Integration with Google rest of the thing already done.

  26. 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.