Multiple responses using node-red-contrib-google-action 1.2.1

#1

Hello
I use node-red-contrib-google-action 1.2.1.
Actually, I can exchange beetween google assistant and node-red, that works.
The only problem is that I must ask something in google assistants, and node-red answers.
what i would like to do is that node-red returns several answers, after a first ask in the assistans.
For example, I wouls like to monitor the status of a signal, wich can change and be true or fals.
So, as long as the conversation is not terminated, I would like that node-red send an answer to google assistant, each time my signal changes.
For test, I created a simple inject node, with string true or false, connected to the google response node.
But it seems that if there is no request from the assistant, no response is sent.
Is there a possibility to do what I want to do?

0 Likes

#2

It would help if you posted your flow!

0 Likes

#3

Here is the flow :slight_smile:
[{"id":"9c5021a0.223d8","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"be40cdd2.9e03e","type":"google-action in","z":"9c5021a0.223d8","name":"Action Request","topic":"action","port":"8081","url":"/","key":"google-actions-key1.pem","cert":"google-actions-cert1.pem","x":100,"y":60,"wires":[["bdad57c2.668d48","a67a7bb7.620638"]]},{"id":"bdad57c2.668d48","type":"debug","z":"9c5021a0.223d8","name":"","active":true,"console":"false","complete":"true","x":1210,"y":60,"wires":[]},{"id":"40b280a9.9dff2","type":"google-action response","z":"9c5021a0.223d8","name":"","x":1200,"y":160,"wires":[]},{"id":"a8109422.e8f798","type":"change","z":"9c5021a0.223d8","name":"Goodbye","rules":[{"t":"set","p":"payload","pt":"msg","to":"A la prochaine","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":260,"wires":[["bdad57c2.668d48","40b280a9.9dff2"]]},{"id":"99a192e2.6e429","type":"switch","z":"9c5021a0.223d8","name":"Question","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"numéro","vt":"str"},{"t":"cont","v":"parle","vt":"str"},{"t":"cont","v":"au revoir","vt":"str"},{"t":"cont","v":"image","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":5,"x":480,"y":180,"wires":[["b79f2007.0e3df"],["1ea5421f.617d9e"],["a8109422.e8f798"],["6d12ef67.bda6d"],["6f79ea7a.a38ed4"]],"outputLabels":["number","","don't understand","",""]},{"id":"cbd1d5f4.f5c5b8","type":"change","z":"9c5021a0.223d8","name":"Number","rules":[{"t":"set","p":"closeConversation","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"payload","pt":"msg","to":"\"Mon numéro est \" & $floor($random() * 10)\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":140,"wires":[["bdad57c2.668d48","40b280a9.9dff2","ac2473a1.6d463"]]},{"id":"6f79ea7a.a38ed4","type":"change","z":"9c5021a0.223d8","name":"Pas compris","rules":[{"t":"set","p":"closeConversation","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"payload","pt":"msg","to":"Désolé, je ne comprend pas","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":360,"wires":[["bdad57c2.668d48","40b280a9.9dff2"]]},{"id":"1287ef6d.4c7d61","type":"change","z":"9c5021a0.223d8","name":"","rules":[{"t":"set","p":"closeConversation","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"payload","pt":"msg","to":"Bonjour, Ici Node-Red","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":100,"wires":[["bdad57c2.668d48","40b280a9.9dff2"]]},{"id":"a67a7bb7.620638","type":"switch","z":"9c5021a0.223d8","name":"Intent","property":"intent","propertyType":"msg","rules":[{"t":"eq","v":"actions.intent.MAIN","vt":"str"},{"t":"eq","v":"actions.intent.TEXT","vt":"str"},{"t":"eq","v":"actions.intent.CANCEL","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":270,"y":160,"wires":[["1287ef6d.4c7d61"],["99a192e2.6e429"],["a8109422.e8f798"]],"outputLabels":["MAIN","TEXT","CANCEL"]},{"id":"b79f2007.0e3df","type":"random","z":"9c5021a0.223d8","name":"","low":"1","high":"10","inte":"true","property":"payload","x":640,"y":160,"wires":[["cbd1d5f4.f5c5b8"]]},{"id":"1ea5421f.617d9e","type":"change","z":"9c5021a0.223d8","name":"Parle","rules":[{"t":"set","p":"closeConversation","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"payload","pt":"msg","to":"<speak> Voici <say-as interpret-as=\"characters\">SSML</say-as> quelques échantillons. Je peux faire une pause <break time=\"3s\"/>. Je peux jouer un son <audio src=\"https://www.sample-videos.com/audio/mp3/crowd-cheering.mp3\">fichier audio introuvable</audio>. Je peux parler en absolu. votre numero est <say-as interpret-as=\"cardinal\">10</say-as>. Ou en relatif. vous êtes le <say-as interpret-as=\"ordinal\">10</say-as> en ligne. Et je peux même parler en chiffre. Les chiffres pour 10 sont <say-as interpret-as=\"characters\">10</say-as>. Je peux aussi substituer une phrase, comme <sub alias=\"World Wide Web Consortium\">W3C</sub>. Enfin, je peux dire un paragraphe avec plusieurs phrases. <p><s>Première phrase.</s><s>Secondes phrase.</s></p> </speak>","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":200,"wires":[["bdad57c2.668d48","40b280a9.9dff2"]]},{"id":"6d12ef67.bda6d","type":"change","z":"9c5021a0.223d8","name":"Image","rules":[{"t":"set","p":"closeConversation","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"payload","pt":"msg","to":"{\t \"expectUserResponse\": true,\t \"expectedInputs\": [\t {\t \"possibleIntents\": [\t {\t \"intent\": \"actions.intent.TEXT\"\t }\t ],\t \"inputPrompt\": {\t \"richInitialPrompt\": {\t \"items\": [\t {\t \"simpleResponse\": {\t \"textToSpeech\": \"This is a basic card example.\"\t }\t },\t {\t \"basicCard\": {\t \"title\": \"Title: this is a title\",\t \"subtitle\": \"This is a subtitle\",\t \"formattedText\": \"This is a basic card. Text in a basic card can include \\\"quotes\\\" and\\n most other unicode characters including emoji 📱. Basic cards also support\\n some markdown formatting like *emphasis* or _italics_, **strong** or\\n __bold__, and ***bold itallic*** or ___strong emphasis___ as well as other\\n things like line \\nbreaks\",\t \"image\": {\t \"url\": \"https://example.com/image.png\",\t \"accessibilityText\": \"Image alternate text\"\t },\t \"buttons\": [\t {\t \"title\": \"This is a button\",\t \"openUrlAction\": {\t \"url\": \"https://assistant.google.com/\"\t }\t }\t ],\t \"imageDisplayOptions\": \"CROPPED\"\t }\t }\t ]\t }\t }\t }\t ]\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":300,"wires":[["bdad57c2.668d48","40b280a9.9dff2"]]},{"id":"ace137e6.79b678","type":"inject","z":"9c5021a0.223d8","name":"","topic":"","payload":"true","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":730,"y":460,"wires":[["e930039a.7a645"]]},{"id":"ac2473a1.6d463","type":"function","z":"9c5021a0.223d8","name":"Memorize values","func":"global.set('conversationId',msg.conversationId)\nglobal.set('intent',msg.intent)\nglobal.set('dialogState',msg.dialogState)\nglobal.set('closeConversation',msg.closeConversation)\nglobal.set('userID',msg.userId)\nglobal.set('locale',msg.locale)\nglobal.set('_msgid',msg._msgid)\nreturn msg;","outputs":1,"noerr":0,"x":970,"y":360,"wires":[[]]},{"id":"e930039a.7a645","type":"function","z":"9c5021a0.223d8","name":"Restore values","func":"var conversationId = global.get('conversationId');\nmsg.conversationId = conversationId;\n\nvar intent = global.get('intent');\nmsg.intent = intent;\n\nvar dialogState = global.get('dialogState');\nmsg.dialogState = dialogState;\n\nvar closeConversation = global.get('closeConversation');\nmsg.closeConversation = closeConversation;\n\nvar userID = global.get('userID');\nmsg.userID = userID;\n\nvar locale = global.get('locale');\nmsg.locale = locale;\n\nvar _msgid = global.get('_msgid');\nmsg._msgid = _msgid;\n\n\nreturn msg;","outputs":1,"noerr":0,"x":980,"y":500,"wires":[["40b280a9.9dff2","bdad57c2.668d48"]]},{"id":"dc947928.97cc48","type":"inject","z":"9c5021a0.223d8","name":"","topic":"","payload":"false","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":730,"y":520,"wires":[["e930039a.7a645"]]}]

0 Likes

#4

Hi guys?
No suggestion?

0 Likes