node-red-contrib-googlehome-actions-v2-piyanggoon
Version:
Google Home Actions V2 (fork by piyanggoon)
74 lines (71 loc) • 2.84 kB
HTML
<script type="text/javascript">
RED.nodes.registerType('googlehome-ask',{
category: 'Google Assistant',
defaults: {
name: {value: ""},
message: {value: ""}
},
paletteLabel: "Ask",
icon: 'googlehome-ask.png',
outputs: 1,
inputs: 1,
label: function() {
return (this.name !== "" ? "Ask (" + this.name + ")" : "Google Home Ask");
}
});
</script>
<script type="text/x-red" data-template-name="googlehome-ask">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-message"><i class="fa fa-tag"></i> Message</label>
<input type="text" id="node-input-message" placeholder="Message">
</div>
</script>
<script type="text/x-red" data-help-name="googlehome-ask">
<p>This node represents an answer to an intent.</p>
<p>The <code>message</code> property in the node editor is the default answer. It can be changed later, after processing the request.</p>
<h3>Input</h3>
<p>It must be connected to an Intent Node created before.</p>
<h3>Outputs</h3>
<ol class="node-ports">
<li>Request Message/Default Answer
<dl class="message-properties">
<dt>msg.req.params <span class="property-type">array</span></dt>
<dd>The intent parameters.</dd>
</dl>
<dl class="message-properties">
<dt>msg.gh_messages <span class="property-type">array</span></dt>
<dd>An array of messages objects that will be sent to google assistant as an answer.
Initialy it has the default response, but it can be changed after processing the request</dd>
</dl>
</li>
</ol>
<h3>Details</h3>
<p>An intent node can have one or more Ask Nodes.</p>
<p>An Ask Node initialize the response object that will be used later by the Send Node to complete the dialog.</p>
<p>To change the response that will be sent, change the <code>msg.gh_messages</code></p>
<p><code>msg.gh_messages</code> array items formats:</p>
<p></p>
<p>Simple Response</p>
<p><code>
{
"type": "SimpleResponse",
"message": "Your Message here"
}
</code></p>
<p>LinkOutSuggestion</p>
<p><code>
{
"type": "link",
"message": {
"url": "https://example.com"
}
}
</code></p>
<p></p>
<p>Another responses are supported, you can look at source code or wait me to document them.</p>
<p>Carousel, Image, Table, LinkOutSuggestion</p>
</script>