cancel
Showing results for 
Search instead for 
Did you mean: 

Simple HipChat push notifications

Highlighted
Moderator

Simple HipChat push notifications

Collaborator to HipChat Push Notificaion Example

 

collab-hipchat-headline.PNG

 

These scripts demonstrate a simple push notification system from Collaborator to HipChat. They can easily be modified to send the same event data to any other disparate system. We'll use Node.js as the executable, and pass data to the scripts on the command line.

 

collab-hipchat-trigger-config-screen.png

 

STEP 1: INSTALL NODE.JS
Node.js is a free, and lightweight javascript processor that uses Google's V8 JavaScript engine.

Installing Node.js is easy, just get the correct version for your operating system from here: https://nodejs.org/download/

Take note of the installation path of Node.js, we'll pass the location of node.exe to Collaborator later. On Windows, the default installation path of Node.js is either:

 

"C:\Program Files (x86)\nodejs\node.exe"

- or -

"C:\Program Files\nodejs\node.exe"


On Linux, the default installation path is: /usr/bin/node

 

After you install Node.js, you'll also need to install the HipChat Node.js library. Node.js includes the node package manager executable, npm. You'll need to run the following command against npm to install the required HipChat modules: npm install node-hipchat

 

collab-hipchat-npm-success.PNG

 

STEP 2: DOWNLOAD AND EXTRACT THE SCRIPTS
You'll need to download the zip file attached to this post, or click here: collab-hipchat-zip-icon.PNG collab-hipchat-push-notifications-v1.zip

Extract this to the file system on the Collaborator server. We'll use this folder: c:\checkout

 

collab-hipchat-extracted-scripts.png

 

STEP 3: CONFIGURE SERVER INFORMATION IN EACH SCRIPT FILE

Open each of the .js files in a text editor, and you'll see this header:

 

var room = 1333288;
var token = '92c2f106cd1b51fcc38172635261ef';
var collabServer = "http://collab.aus.smartbear.com"

 

You'll need to set the room number that you'd like the notifications to go to, along with your HipChat Admin Notification Token. Finally, set the URL for your Collaborator server, and save each file. 

 

STEP 4: CONFIGURE COLLABOROATOR TRIGGERS
First, log in to the Collaborator web portal as an administrator, and click the Admin link at the top of the page. Next, click on the Triggers tab, located on the left hand side of the page. Each trigger handles a specific event, and each event is handled by it's respective script file. Copy and paste each of the triggers below into the trigger configuration:

 

collab-hipchat-trigger-phase-change.PNG

 


Windows Configuration Examples:
- Review Phase Changed:

collab-hipchat-phase-inspection.PNG

collab-hipchat-phase-complete.PNG
Executable: C:\Program Files\nodejs\node.exe
Parameters: "c:\checkout\collab-hipchat-phasechange.js" ${review.id} "${review.title}" ${review.phase} ${review.phase.previous} 

 

- Added Files:

collab-hipchat-files-added.PNG
Executable: C:\Program Files\nodejs\node.exe
Parameters: "collab-hipchat-filesadded.js ${review.id}" "${review.title}" ${review.phase} "${changelist.author}" 

 

- Defect Activity:

collab-hipchat-defect-opened.PNG

collab-hipchat-defect-closed.PNG
Executable: C:\Program Files\nodejs\node.exe
Parameters: "collab-hipchat-defectchange.js" ${review.id} "${review.title}" ${review.phase} "${defect.id}" "${actor.name}" "${defect.text}" ${defect.isfixed} "${defect.file}" ${defect.line} "${review.participants.rolename}"

- Role Changed:

collab-hipchat-rolechanged.PNG
Executable: C:\Program Files\nodejs\node.exe
Parameters: "collab-hipchat-rolechange.js" ${review.id} "${review.title}" ${review.phase} "${user.name}" "${role.title}" "${actor.name}" "${review.participants.rolename}"

 

 

Substitute the executable path with the correct path to node.exe. Substitute the path to the .js files in the paramaters field with the location of the script files that were extracted from the zip file.

 

The same configuration steps work for Linux or Unix: Just provide the correct path to the node executable, and the script files.

 

At the time of this post, the current version of Node.js was v0.12.2. If you have trouble, try using that version.

New Here?
Join us and watch the welcome video:
Building with the Collaborator API

Help Documenation
The Collaborator API is a JSON-RPC API that lets you integrate with Collaborator 9.0 and above. For more information about how the API works, check out the API description here:


Sample Plugins
For an example of an add-in that uses the API, take a look at the Microsoft Word Add-in for Collaborator:


We list all the great plugins our network has already built on this page on the SmartBear website.