tag:blogger.com,1999:blog-4158624627543246167.post-50527498843538605062016-11-03T03:00:00.000-04:002016-11-03T08:27:26.800-04:00IBM Watson Workspace -- Code Talks So Here's The First SamplesTime for the next post on <a href="http://workspace.ibm.com/">IBM Watson Workspace</a>. In this post I wanted to share some code samples that could help you get going in your development of apps for IBM Watson Workspace using the <a href="http://developer.watsonwork.ibm.com/">IBM Watson Work Services and APIs</a>.<br />
<br />
I know many developers, including myself, learn a lot from code samples (probably more than using actual API documentation). So to build <a href="http://www.lbenitez.com/2016/11/building-apps-with-ibm-watson-work.html">on my post</a> from earlier this week, we have published the first 5 code samples into the <a href="http://github.com/watsonwork">Watson Work org in Github</a> and there should be more posted this week and next. My samples are the <a href="http://github.com/watsonwork/watsonwork-twitter">Twitter</a> and <a href="http://github.com/watsonwork/watsonwork-weather">Weather</a> apps. I built these as fully functioning apps that you can deploy to a server and get up and going in a few minutes. And once they are running, feel free to hack away!<br />
<br />
To make things simpler, I've also included a <b>one-click button to deploy the app to Bluemix </b>(which I thought was freaking cool how they make this possible). This, however, is not a required step. If you want to use with another cloud provider, by all means. Back to Bluemix, when you click the button, Bluemix pulls down the code from Github and magically gets it up and running.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAiYhmGCEPP4tPbI3JCoim0-j4ysAYSJrA0QE9H4zbKZ-GhCMaI8wrn4xmuNrVkOUxdRcXOapulBnUV3vQuQQJdLX-FmhbNmDOpZP2Bzb9G1lpgyGTqdpb-g3WAGLISFS5Va8KZHecnAA/s1600/One_click_deploy_to_Bluemix.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="331" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAiYhmGCEPP4tPbI3JCoim0-j4ysAYSJrA0QE9H4zbKZ-GhCMaI8wrn4xmuNrVkOUxdRcXOapulBnUV3vQuQQJdLX-FmhbNmDOpZP2Bzb9G1lpgyGTqdpb-g3WAGLISFS5Va8KZHecnAA/s400/One_click_deploy_to_Bluemix.png" width="400" /></a></div>
<br />
One cool thing is that even before the samples were available, I already picked up a few blogs of developers using the APIs:<br />
<ul>
<li><a href="https://redbooth.com/blog/ibm-watson-workspace-integration">https://redbooth.com/blog/ibm-watson-workspace-integration</a></li>
<li><a href="https://guedebyte.wordpress.com/2016/10/28/watson-workspace-work-services-needs-code-code-code-community-code-code-and-even-more-code-and-community/">https://guedebyte.wordpress.com/2016/10/28/watson-workspace-work-services-needs-code-code-code-community-code-code-and-even-more-code-and-community/</a></li>
<li><a href="https://blog.rocketsoftware.com/2016/10/live-ibm-world-watson-putting-business-social/">https://blog.rocketsoftware.com/2016/10/live-ibm-world-watson-putting-business-social/</a></li>
<li><a href="https://kbild.ch/2016/10/watson-workspace-send-nagios-monitoring-alerts-to-a-ww-space/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+kbild+%28kbild+-+Mehr+als+die+gelbe+Welt%29">https://kbild.ch/2016/10/watson-workspace-send-nagios-monitoring-alerts-to-a-ww-space/</a></li>
<li><a href="http://opentopic.com/ibm-workspaces/">http://opentopic.com/ibm-workspaces/</a></li>
<li><a href="http://blog.sapho.com/sapho-ibm-watson-workspace-collaboration-and-productivity-made-easy">http://blog.sapho.com/sapho-ibm-watson-workspace-collaboration-and-productivity-made-easy</a></li>
</ul>
even one creating an Eclipse plug-in that was able to get something going in < 1 hour ( I love hearing those stories):<br />
<br />
<div>
<br /></div>
<div>
<blockquote class="twitter-tweet" data-lang="en">
<div dir="ltr" lang="en">
Welcome <a href="https://twitter.com/hashtag/watsonworkspace?src=hash">#watsonworkspace</a>! Nice that you join my sidebar in my Eclipse / IBM Notes Client. Next Step: Post a message! <a href="https://t.co/7C4hyz6MDt">pic.twitter.com/7C4hyz6MDt</a></div>
— Christian Güdemann (@guedeWebGate) <a href="https://twitter.com/guedeWebGate/status/793197474055917568">October 31, 2016</a></blockquote>
<script async="" charset="utf-8" src="//platform.twitter.com/widgets.js"></script></div>
<div>
<br /></div>
<div>
So quick tour of the Weather app. It uses the <a href="https://www.wunderground.com/weather/api/">Weather Underground APIs</a> to get current conditions based on a US zipcode. I use the node module to convert the <a href="https://github.com/watsonwork/watsonwork-weather/blob/master/app.js#L182">zip code to city and state</a>:<br />
<blockquote class="tr_bq">
<span style="background-color: #f8eec7; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;"> </span><span class="pl-k" style="background-color: #f8eec7; box-sizing: border-box; color: #a71d5d; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">const</span><span style="background-color: #f8eec7; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;"> </span><span class="pl-c1" style="background-color: #f8eec7; box-sizing: border-box; color: #0086b3; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">cityState</span><span style="background-color: #f8eec7; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;"> </span><span class="pl-k" style="background-color: #f8eec7; box-sizing: border-box; color: #a71d5d; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">=</span><span style="background-color: #f8eec7; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;"> </span><span class="pl-smi" style="background-color: #f8eec7; box-sizing: border-box; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">zipcode</span><span style="background-color: #f8eec7; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">.</span><span class="pl-en" style="background-color: #f8eec7; box-sizing: border-box; color: #795da3; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">lookup</span><span style="background-color: #f8eec7; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">(zc);</span></blockquote>
<br />
With that info, I now <a href="https://github.com/watsonwork/watsonwork-weather/blob/master/app.js#L197">call the Weather Underground APIs to get the current conditions</a>:<br />
<br />
<blockquote class="tr_bq">
<span class="pl-smi" style="background-color: #f8eec7; box-sizing: border-box; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">client</span><span style="background-color: #f8eec7; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">.</span><span class="pl-en" style="background-color: #f8eec7; box-sizing: border-box; color: #795da3; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">conditions</span><span style="background-color: #f8eec7; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">(opts, </span><span class="pl-k" style="background-color: #f8eec7; box-sizing: border-box; color: #a71d5d; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">function</span><span style="background-color: #f8eec7; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">(</span><span class="pl-smi" style="background-color: #f8eec7; box-sizing: border-box; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">err</span><span style="background-color: #f8eec7; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">, </span><span class="pl-smi" style="background-color: #f8eec7; box-sizing: border-box; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">data</span><span style="background-color: #f8eec7; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">) {</span></blockquote>
<br />
Now with the data that I get back, I <a href="https://github.com/watsonwork/watsonwork-weather/blob/master/app.js#L33">build a message</a> to post back to IBM Watson Workspace and put it in the appropriate JSON construct:<br />
<br />
<blockquote class="tr_bq">
<table class="highlight tab-size js-file-line-container" data-tab-size="8" style="border-collapse: collapse; border-spacing: 0px; box-sizing: border-box; color: #333333; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px; tab-size: 8;"><tbody style="box-sizing: border-box;">
<tr style="box-sizing: border-box;"><td class="blob-code blob-code-inner js-file-line" id="LC118" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;"><span class="pl-k" style="box-sizing: border-box; color: #a71d5d;">const</span> <span class="pl-c1" style="box-sizing: border-box; color: #0086b3;">messageData</span> <span class="pl-k" style="box-sizing: border-box; color: #a71d5d;">=</span> {</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="119" id="L119" style="-webkit-user-select: none; border-color: rgb(238, 238, 238); border-style: solid; border-width: 0px 1px 0px 0px; box-sizing: border-box; color: rgba(0, 0, 0, 0.298039); cursor: pointer; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="LC119" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;">type<span class="pl-k" style="box-sizing: border-box; color: #a71d5d;">:</span> <span class="pl-s" style="box-sizing: border-box; color: #183691;"><span class="pl-pds" style="box-sizing: border-box;">"</span>appMessage<span class="pl-pds" style="box-sizing: border-box;">"</span></span>,</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="120" id="L120" style="-webkit-user-select: none; border-color: rgb(238, 238, 238); border-style: solid; border-width: 0px 1px 0px 0px; box-sizing: border-box; color: rgba(0, 0, 0, 0.298039); cursor: pointer; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="LC120" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;">version<span class="pl-k" style="box-sizing: border-box; color: #a71d5d;">:</span> <span class="pl-c1" style="box-sizing: border-box; color: #0086b3;">1.0</span>,</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="121" id="L121" style="-webkit-user-select: none; border-color: rgb(238, 238, 238); border-style: solid; border-width: 0px 1px 0px 0px; box-sizing: border-box; color: rgba(0, 0, 0, 0.298039); cursor: pointer; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="LC121" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;">annotations<span class="pl-k" style="box-sizing: border-box; color: #a71d5d;">:</span> [</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="122" id="L122" style="-webkit-user-select: none; border-color: rgb(238, 238, 238); border-style: solid; border-width: 0px 1px 0px 0px; box-sizing: border-box; color: rgba(0, 0, 0, 0.298039); cursor: pointer; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="LC122" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;">{</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="123" id="L123" style="-webkit-user-select: none; border-color: rgb(238, 238, 238); border-style: solid; border-width: 0px 1px 0px 0px; box-sizing: border-box; color: rgba(0, 0, 0, 0.298039); cursor: pointer; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="LC123" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;">type<span class="pl-k" style="box-sizing: border-box; color: #a71d5d;">:</span> <span class="pl-s" style="box-sizing: border-box; color: #183691;"><span class="pl-pds" style="box-sizing: border-box;">"</span>generic<span class="pl-pds" style="box-sizing: border-box;">"</span></span>,</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="124" id="L124" style="-webkit-user-select: none; border-color: rgb(238, 238, 238); border-style: solid; border-width: 0px 1px 0px 0px; box-sizing: border-box; color: rgba(0, 0, 0, 0.298039); cursor: pointer; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="LC124" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;">version<span class="pl-k" style="box-sizing: border-box; color: #a71d5d;">:</span> <span class="pl-c1" style="box-sizing: border-box; color: #0086b3;">1.0</span>,</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="125" id="L125" style="-webkit-user-select: none; border-color: rgb(238, 238, 238); border-style: solid; border-width: 0px 1px 0px 0px; box-sizing: border-box; color: rgba(0, 0, 0, 0.298039); cursor: pointer; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="LC125" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;">color<span class="pl-k" style="box-sizing: border-box; color: #a71d5d;">:</span> <span class="pl-s" style="box-sizing: border-box; color: #183691;"><span class="pl-pds" style="box-sizing: border-box;">"</span>#D5212B<span class="pl-pds" style="box-sizing: border-box;">"</span></span>,</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="126" id="L126" style="-webkit-user-select: none; border-color: rgb(238, 238, 238); border-style: solid; border-width: 0px 1px 0px 0px; box-sizing: border-box; color: rgba(0, 0, 0, 0.298039); cursor: pointer; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="LC126" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;">title<span class="pl-k" style="box-sizing: border-box; color: #a71d5d;">:</span> <span class="pl-s" style="box-sizing: border-box; color: #183691;"><span class="pl-pds" style="box-sizing: border-box;">"</span>Current weather conditions<span class="pl-pds" style="box-sizing: border-box;">"</span></span>,</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="127" id="L127" style="-webkit-user-select: none; border-color: rgb(238, 238, 238); border-style: solid; border-width: 0px 1px 0px 0px; box-sizing: border-box; color: rgba(0, 0, 0, 0.298039); cursor: pointer; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="LC127" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;">text<span class="pl-k" style="box-sizing: border-box; color: #a71d5d;">:</span> message</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="128" id="L128" style="-webkit-user-select: none; border-color: rgb(238, 238, 238); border-style: solid; border-width: 0px 1px 0px 0px; box-sizing: border-box; color: rgba(0, 0, 0, 0.298039); cursor: pointer; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="LC128" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;">}</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="129" id="L129" style="-webkit-user-select: none; border-color: rgb(238, 238, 238); border-style: solid; border-width: 0px 1px 0px 0px; box-sizing: border-box; color: rgba(0, 0, 0, 0.298039); cursor: pointer; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="LC129" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;">]</td></tr>
<tr style="box-sizing: border-box;"><td class="blob-num js-line-number" data-line-number="130" id="L130" style="-webkit-user-select: none; border-color: rgb(238, 238, 238); border-style: solid; border-width: 0px 1px 0px 0px; box-sizing: border-box; color: rgba(0, 0, 0, 0.298039); cursor: pointer; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; min-width: 50px; padding: 0px 10px; text-align: right; vertical-align: top; white-space: nowrap; width: 50px;"></td><td class="blob-code blob-code-inner js-file-line" id="LC130" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; overflow: visible; padding: 0px 10px; position: relative; vertical-align: top; white-space: pre; word-wrap: normal;">};</td></tr>
</tbody></table>
</blockquote>
<br />
and then<a href="https://github.com/watsonwork/watsonwork-weather/blob/master/app.js#L144"> call the API to post it back</a>:<br />
<br />
<blockquote class="tr_bq">
<span style="background-color: #f8eec7; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;"> </span><span class="pl-en" style="background-color: #f8eec7; box-sizing: border-box; color: #795da3; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">request</span><span style="background-color: #f8eec7; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">(sendMessageOptions, (</span><span class="pl-smi" style="background-color: #f8eec7; box-sizing: border-box; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">err</span><span style="background-color: #f8eec7; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">, </span><span class="pl-smi" style="background-color: #f8eec7; box-sizing: border-box; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">response</span><span style="background-color: #f8eec7; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">, </span><span class="pl-smi" style="background-color: #f8eec7; box-sizing: border-box; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">body</span><span style="background-color: #f8eec7; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">) </span><span class="pl-k" style="background-color: #f8eec7; box-sizing: border-box; color: #a71d5d; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">=></span><span style="background-color: #f8eec7; color: #333333; font-family: "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;"> {</span></blockquote>
<br />
So that should give you an idea on how to listen to a conversation, act on it, and then respond back. I followed a similar flow to build the <a href="https://github.com/watsonwork/watsonwork-twitter">Twitter</a> app and my hope is you can take it and hack it to build your own. And if you are in the mood to help improve these samples, pull requests are welcome!<br />
<br />
Now definitely check out what <a href="https://redbooth.com/blog/ibm-watson-workspace-integration">Redbooth</a>, <a href="https://blog.rocketsoftware.com/2016/10/live-ibm-world-watson-putting-business-social/">Rocket</a>, <a href="http://opentopic.com/ibm-workspaces/">OpenTopic</a>, <a href="http://blog.sapho.com/sapho-ibm-watson-workspace-collaboration-and-productivity-made-easy">Sapho</a> and others have done... VERY COOL! (and just to make it more enticing.. Sapho for example has Marketo and Google Adword integration... )<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://blog.sapho.com/hs-fs/hubfs/Pasted%20image%20at%202016_10_25%2010_38%20PM.png?t=1478023110491&width=1280&name=Pasted%20image%20at%202016_10_25%2010_38%20PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://blog.sapho.com/hs-fs/hubfs/Pasted%20image%20at%202016_10_25%2010_38%20PM.png?t=1478023110491&width=1280&name=Pasted%20image%20at%202016_10_25%2010_38%20PM.png" width="560" /></a></div>
<br /></div>
Luis Benitezhttps://www.blogger.com/profile/17548529757291454921noreply@blogger.com