Note: If you don’t already have your own HipChat instance, you can get one for free at http://hipchat.com/.

      1. Add a “Build your own integration” to your HipChat instance
        1. To do this go to https://yourteam.hipchat.com/addons/?from_location_id=2&source_id=1 (replace ‘yourteam’ with your HipChat instance)
        2. Click “Build your own integration”
        3. Select a room (we will be working with ‘General’ for our example)
        4. Name your integration (we will use ‘ISPW’)
        5. Click “Create”
        6. For now, scroll all the way to the bottom and select “Save Settings”
        7. Scroll to “Send messages to this room by posting to this URL”, copy the URL and store this for later in your favorite text editor
      2. Decide on a format for your HipChat message
        1. For our example, we have three components to our HipChat API call: message, color, and notify
          1. ‘message’ is the content of the message that will be posted in HipChat. In our example, this is “Deployment of Tasks in Release TEST35813 at level PRD has Completed!”
          2. ‘color’ is the background color for the message. In our example, we will use “gray”
          3. ‘notify’ is a Boolean that decides whether or not this message will notify users.  In our example, we will use true
        2. Build the HipChat JSON Body
          1. HipChat takes message input in the form of JSON, which follows a name:value pairing format
          2. For our example, our JSON looks like this:
            message-code
          3. This block of JSON tells HipChat to post the message “Deployment of Tasks in Release TEST35813 at level PRD Completed!” in gray from a bot named “ISPW” and to notify HipChat users in that room
          4. Feel free to tweak any of this message and then save the JSON for later. We will use it in our API call into CES (Click here for more info on HipChat APIs)
      3. Build the API call
        1. We assume at this point you have defined an ISPW release with one or more tasks in it to test with, but if not, go get one ready now
        2. Deploying a release is done by POSTing to http://YOURCES:YOURPORT/ispw/{srid}/releases/{releaseId}/tasks/deploy?level={level}
            1. Tweak this URL to fill in the host and port where Compuware Enterprise Services is hosted. These replace ‘YOURCES’ and ‘YOURPORT’ (to continue our example, we will use “localhost:48226”)
            2. Replace {srid} with the instance of ISPW you are using (to continue our example, we will use “w3t”)
            3. Replace {releaseId} with the release you wish to promote (we will continue with “TEST35813”)
            4. Replace {level} with the level of tasks you want to promote from (we will be promoting all tasks at prd)
              Note: if you have a different releaseId or level then we are using, you will want to update your HipChat message to reflect this
            5. Save this URL as we will use it in our curl
        3. CES requires an Authentication Token to be passed in the header of the request. For information on how to create a Token see the CES Web Help topic “Personal Access Tokens Settings”
          1. These tokens are created at http://CES:PORT/compuware/jsp/settings/tokens.jsp. If you don’t have one already, create one now
          2. This token is used in the header like so, “Authorization: TOKEN”, or for our example, “Authorization: 8cd92475-6383-4b42-a792-619a16cb8867”
          3. Save this Header as we will use it in our curl
        4. CES requires a Content-Type header to be passed in as well
          1. This will be “Content-Type: application/json”
          2. Save this Header as we will use it in our curl
        5. CES requires a JSON Body to outline what notifications should cause HipChat to post a message
          1. This JSON Body, at a minimum, will have an “events” array (you also need a “runtimeConfiguration”. If you don’t know what this is, see your ISPW Administrator)
          2. For our example, our JSON Body will look like this:
            json-body-code
          3. HipChat requires an HTTP Header to be used on all post requests. We will specify this in our API call accordingly
                1. To do this we add the following JSON to our API Call

            httpheaders

          4. For a HipChat integration, our “events” array will contain one or more events which each consist of a “name”, a “url”, and a “body”
          5. For our example, we use the event name “Completed”. This event is triggered when the deploy completes successfully
          6. Replace the https://webapitesting.hipchat.com URL with the HipChat WebHook URL we saved in 1-g
          7. “body” is the JSON Body CES will send to HipChat when this event occurs. This was created earlier, in 2-b
            1. Update the “body”:” ” with your HipChat JSON
        6. Save this JSON Body as we will use it in our curl
    1. Put it all together
        1. Now that we have our API URL, API Headers, and our API Body, we are ready to make our API call
        2. For our example, we will show curl and Advanced REST client, which is a chrome extension that lets you visually build your API call and send it
        3. First we will show a commented version of the call and then we will show our actual call used

      Curl with Comments
      curl-with-comments-code
      Actual URL
      curl-h-code

      Advanced REST client example usage:

      hipchat_img1

End Result:

An ISPW “bot” in your channel that will notify you when your code deploy completes or fails.  It will look something like this:

hipchat_img2