Hipchat integration not working

Fails with this error:
Exception calling “GetResponse” with “0” argument(s): "The remote server returned an error: (401) Unauthorized."
19:03:09Error
At C:\Octopus\Work\20160610000305-12\Script.ps1:39 char:1
19:03:09Error

  • [System.Net.WebResponse] $resp = $webRequest.GetResponse()
    19:03:09Error

19:03:09Error
+ CategoryInfo : NotSpecified: (:slight_smile: [], ParentContainsErrorRecordException
19:03:09Error
+ FullyQualifiedErrorId : WebException
19:03:09Error
19:03:09Fatal
The step failed: The remote script failed with exit code 1

This is posting to an internal hipchat server, running from the Octopus server (not a target machine).

Hi Owen,

I’m sorry to hear you’re having issues integrating with HipChat.

I assume you’re using the HipChat - Notify step template from our community library.

Looking at that script, it seems it passes HipChat an API token from the Octopus variable AuthToken:
$apitoken = $OctopusParameters['AuthToken']

From your error message, it would seem HipChat doesn’t like the token you are supplying. Could you confirm the value of that variable, and that it is configured in HipChat?

Regards,
Michael

Yes, it’s the same token we use for all of our other Hipchat notifications.

That step template is contributed by the community. Unfortunately we don’t have experience with it in-house.

The best I can suggest is to take the script (provided on the library page) and test it outside of Octopus. Also, the comments thread on that page mentions a few known issues and resolutions.

I wish I could offer you a better answer. If you can’t resolve the issue, perhaps try contacting the contributor?

OK, so I figured this out. It WAS the token. Apparently you need to use specific room tokens (the global ones don’t work). Once I used a token specific to the room I posted to… it worked.

Thanks Michael!