Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1.  
  2. var ConversationV1 = require('watson-developer-cloud/conversation/v1');
  3.  
  4. // Set up Conversation service wrapper.
  5. var conversation = new ConversationV1({
  6. username: '4d1076d1-1c64-4ac8-8f4d-a12d8d4df9e6', // replace with username from service key
  7. password: 'eKCHLmglT3Mz', // replace with password from service key
  8. path: { workspace_id: 'b4bb901d-63fa-4149-b5d8-82acd9ca94ba' }, // replace with workspace ID
  9. version_date: '2016-07-11'
  10. });
  11.  
  12. var resp = "";
  13. // Process the conversation response.
  14. function processResponse(err, response) {
  15. if (err) {
  16. console.error(err); // something went wrong
  17. return;
  18. }
  19.  
  20. // Display the output from dialog, if any.
  21. if (response.output.text.length != 0) {
  22. //maybe set response.output.text as output or returned?
  23. console.log(response.output.text[0]);
  24. resp = response.output.text[0];
  25. }
  26. }
  27.  
  28. //change user input here
  29. var userInput = "help create";
  30.  
  31. conversation.message({input:{ text: userInput }}, processResponse);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement