问题
What I want to implement is at least a working prototype of a Google Assistant Action with the use of local MySQL database. What I've taught of is MySQL DB-> Google Cloud Platform-> DialogFlow -> Google Assistant.
So the end product would be for example, I say: "What is my total sales" and Google Assistant would retrieve the data from MySQL. I've been trying to look for solutions online and none seem to match what I am looking for. Would this solution be theoretically possible? and how would I be able to integrate the cloud platform into the Google Assistant Action through DialogFlow? Thanks!
回答1:
It is possible!
- Create a Dialogflow agent. Define your intents and add the static response. Test it.
- Once tests are passed, integrated it with Actions-On-Google using "Integration tab" to the left.
- Test the Assistant with static responses.
- When Assistant is ready with the static response, develop a webhook. You can use different client libraries in NodeJS (AoG Client or Dialogflow Client) or in Python (Flask-Assistant or Dialogflow Client) or can create your own.
- Once the webhook is ready, run it locally and expose to the internet using NGROK.
- Use the generated URL as fulfillment to the Dialogflow agent and update the assistant's draft version.
- Create a MySQL DB and connect it webhook using regular NodeJS or Python code
- Restart the server and test end to end!
- Once tested locally with NGROK, you can PUSH it to the cloud (NodeJS or Python) or any other server.
来源:https://stackoverflow.com/questions/51471128/possibility-of-connecting-mysql-database-to-google-assistant