Skip to content

Latest commit

 

History

History
72 lines (41 loc) · 2.74 KB

File metadata and controls

72 lines (41 loc) · 2.74 KB

Dialog Template Creation

Overview

The dialog service enables automation of a conversation between your application and a user. The node is available as a Watson Developer Cloud contribution to Node-RED and needs to be installed.

Installation of the Dialog Node

Follow the instructions at watson contribution nodes to install the dialog node into your Bluemix instance of Node-RED. Notice : in the Watson Node-RED Boilerplate this installation have been already done.

On Bluemix

If you are using Node-RED on Bluemix, go to your Node-RED app and click 'add a service or API' This will open a new window where you can select the Watson Dialog service. Then you click on 'Use' a screen will show which asks for a restage, click on 'yes' and wait a minute. When the application is started click on the Url to go to your Node-RED application.

Create Dialog Template

Copy an inject node.

Start trigger for dialog template create

Feed the output from the inject node to a HTTP request node.

HTTP fetch of dialog template file

Configure the mode for the http request node to fetch a dialog file.

HTTP file fetch

Feed the file into a function node.

Prepare params for dialog creation

Code up the function node to pass in the file, and to give the dialog template a name.

msg.dialog_params = {};
msg.dialog_params["file"] = msg.payload;
msg.dialog_params["dialog_name"] = "Pizza Ordering";
return msg;

Dialog Service Param settings

Feed the output into a dialog service node.

Dialog Service Node

Set the mode for the node to Create Dialog.

Dialog Service Create Mode

Use a debug node to see the output from the service,

Dialog service response debug

which will be available on msg.dialog

Dialog service response message

If the dialog is create you should see the following response.

Dialog created dialog id

If you run the flow again, then you the create should be rejected as a duplicate.

Dialog duplicate name

The completed flow is available at Dialog Template Creation Flow.

Notice : you can also use Dropbox instead of using the HTTP Request node : How to setup your Node-RED with Dropbox nodes