Is it possible to trigger another Actions on Google app from within my own AoG app's fulfillment? [duplicate]

蹲街弑〆低调 提交于 2020-01-02 10:11:29

问题


This question pertains specifically to Actions on Google Apps and is concerning the ability to trigger an event/action to cause the Assistant to choose another AoG app for the end user; specifically to trigger someone else's AoG app, not one that you have written.

Idea: I want to create a custom AoG app. Something like planning-for-a-hike app. I want my user to be able to ask about the weather. At that point, I want to pass the flow over to an already existing app to get the weather. ie. while using my app the user says "Okay, sounds good. So what's the weather looks like today?" and at that point I want to trigger the default weather app by passing a specific phrase back to the assistant or writing an intent.

I'm familiar with the concept of Dialogflow followup event sent back from fulfillment but am pretty sure I could not use such an intent to trigger an entire app that I didn't write. Intents exist within apps as I understand them. It is the Google Assistant that decides which app to trigger and appears to me that it doesn't have an API exposing that functionality.

If such a thing is possible, how would it look?

Thanks!


回答1:


Invoking AoG apps can only done by Google but you might be able to trigger any intent with an event from a different Dialogflow agent from your webhook by making either a :

GET request from your webhook like:

curl \
-H "Authorization: Bearer YOUR_CLIENT_ACCESS_TOKEN" \
"https://api.dialogflow.com/v1/query?v=20150910&e=event_name&timezone=Europe/Paris&lang=en&sessionId=1234567890"

or a POST request to it with the headers:

Authorization: Bearer YOUR_CLIENT_ACCESS_TOKEN
Content-Type: application/json

and the request body like:

"event":{  
  "name":"<EVENT_NAME>",
  "data":{
      “<PARAMETER_NAME>”:”<PARAMETER_VALUE>”  
  },
  "timezone":"America/New_York",
  "lang":"en",
  "sessionId":"1321321"
}

Note that you need to have access to the other agent's Dialogflow access token



来源:https://stackoverflow.com/questions/48728406/is-it-possible-to-trigger-another-actions-on-google-app-from-within-my-own-aog-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!