0

I have DialogFlow sending a Fulfillment webhook to my server and I am able to send a text-to-speech response back to the google home device.

But how do I trigger a text-to-speech message to be read out by the device without having to initiate from the google home device?

I saw this question on SO which implies it's possible: Send audio file to DialogFlow using Python

I haven't been able to get his code to work because I don't know how to link the userId/sessionId that I get in my webhook call to the request.session_id used in the example.

request = ai.text_request()
request.lang = 'de'  # optional, default value equal 'en'
request.session_id = "<SESSION ID, UNIQUE FOR EACH USER>"
request.query = "Hello"
response = request.getresponse()
print (response.read())

I also found a CURL to trigger an event, but again I can't seem to link the sessionId in the url to my device.

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

Daniel
  • 1
  • 2
  • Can someone tell me what these examples (`ai.text_request()` and `event triggering`) are used for? – Daniel Jun 20 '19 at 20:53

2 Answers2

2

I wrote a freeware program called 'cast' ( www.rlatour.com/cast ) and to get around this problem the program converts the text to an audio file, and then casts the audio file to the google device

Rob
  • 3,488
  • 3
  • 32
  • 27
1

There's no way for a Google Home device to read out something without some sort of user initiation. There is no equivalent to a push notification on the speakers.

Nick Felker
  • 11,536
  • 1
  • 21
  • 35