Installation Requirements
- NodeJS https://nodejs.org
- Bluemix CLI https://clis.ng.bluemix.net/ui/home.html
- ngrok https://ngrok.com/
- Fork it
- Clone the project
git clone https://github.com/YOUR_GITHUB_USERNAME/watsonwork-annotation-viewer.git
- Goto ngrok download dir
- Run the command : ./ngrok http 3000
- Copy the https path specified on screen for use later. e.g. https://452da8f0.ngrok.io/webhook
Navigate to https://developer.watsonwork.ibm.com/apps
App ID and Secret
- Click 'Create new app'
- Give your application a name, such as Workspace App
- Copy the App ID and the App secret. Copy these and keep them safe! You have now created your Watson Workspace app and the associated metadata
Webhook
- Goto your app and click 'listen for events'.
- Click 'add an outbound webhook'
- Give it a webhook name i.e. Webhook
- Specify the Webhook URL from ngrok above i.e. https://452da8f0.ngrok.io/webhook
- Select the following options Allow self signed certificate message-created space-members-added message-annotation-added
- Click Save
- On the following page, copy the webhook secret. This will be used in the webhook.js file below.
Modify the routes\webhook.js with your app information
- Locate the extracted reference application and the routes\webhook.js files
- Look for the code starting with 'const APP_ID ..'
- Copy your App ID to the const APP_ID = "" line inside the quotes
- Copy your App secret to the const APP_SECRET = "" inside the quotes
- Copy your webhook secret key to const WEBHOOK_SECRET = "" inside the quotes
Start npm*
- Open a terminal in your source folder.
- Run 'npm update'. This will create a node_modules directory in your source folder which is all the node libraries required by the app.
- Run 'npm start' to start the app which will run on localhost on port 3000.
Enable your webhook
- In your Watson Workspace app, enable your webhook.
- Create a Space
- Add your app to the Space
- Type a sentence into the Space e.g. I love to code Workspace Apps
- Type '@getannotations'
- The annotations will display, which is the analysis Watson has performed on your sentence.
Reference
- You can view your ngrok web interface url in the ngrok terminal shell. e.g. http://127.0.0.1:4040