Writes a message back if there is someone with very negative or very positive comments
- How to listen to events in a Watson Work Space, specifically it knows how to process message annotation added events and thus requires that apps registered are enabled with those events.
- How to authenticate using the appID + secret to obtain an access token
- How to call graphQL api to obtain name and email of the user who wrote the message being analyzed
- How to interpret the analysis based on sentiment using a score of 80% on either happyness or sadness
- How to write a message back into the conversation announcing the sentiment of the person who wrote the message that was analyzed
- Clone project into a directory on your computer
- Edit the manifest.yml file and replace watsonwork-sentiment with any app name of your choosing that is available in your Bluemix environment
- Similarly, edit the package.json to replace the name watsonwork-sentiment with your app name
- If desired, edit the public/index.html. This is an informational screen only as there is no web functionality required
- Make sure you are enabled with the latest CLI program from Bluemix
- Issue cf push to create a new app in Bluemix with the above characteristics and get it started
- Register a new app in http://developer.watsonwork.ibm.com/
- Enter name and description and add a webhook
- Leave webhook disabled and pick any name as it will only be used for your reference
- Select intent to listen to the
message-annotation-added
events - Utilize the callback url of <your_bluemix_app_host>/webhook_callback unless you modified the code
- Save the app which will present with a window with 3 key pieces of information you will need to save: 1. APP_ID 2. APP_SECRET 3. WEBHOOK_SECRET
- Go to Bluemix and create runtime environment variables with the above names holding the corresponding values
- Restart your app in Bluemix by clicking the restart button so it consumes the new environment
- Go back to the http://developer.watsonwork.ibm.com/apps registration and edit your app and enable the webhook.
- At this point you should see a window indicating the webhook has been enabled. The log file for the app in Bluemix environment should also display confirmation that it processed the verification event as explained in http://developer.watsonwork.ibm.com/ section "Preparing your App to run"
- Create a space and add this app to it. You can test it by typing something like "great - thanks!" and pressing Enter.