Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hipchat Adapter working with onpremise hipchat server? #213

Open
devoncustard opened this issue Oct 22, 2015 · 2 comments
Open

Hipchat Adapter working with onpremise hipchat server? #213

devoncustard opened this issue Oct 22, 2015 · 2 comments

Comments

@devoncustard
Copy link

Setup a very simply hipchat server using their OVF appliance. Installed hipchat on my local desktop and then mmbot . Got caught up in the "this doesn't work on Windows 10 drama". Built a Win 2012 R2 virtual, guessed it needed .Net 2/3.5 after a few failures to install.

So finally I fixed the .csx failures but.....
ERROR: Could not run the adapter 'HipChatAdapter': The remote server returned an
error: (401) Unauthorized.
System.Net.WebException: The remote server returned an error: (401) Unauthorized
.
at System.Net.HttpWebRequest.GetResponse()
at ServiceStack.Net40PclExport.GetResponse(WebRequest webRequest)
at ServiceStack.HttpUtils.SendStringToUrl(String url, String method, String r
equestBody, String contentType, String accept, Action1 requestFilter, Action1
responseFilter)
at ServiceStack.HttpUtils.GetJsonFromUrl(String url, Action1 requestFilter, Action1 responseFilter)
at MMBot.HipChat.HipChatAPI.ViewUser(String userId)
at MMBot.HipChat.HipChatAdapter.SetupHipChatClient()
at MMBot.HipChat.HipChatAdapter.Run()
at MMBot.Robot.d__39.MoveNext() in z:\Builds\work\77d74f064ca6bd72\MMBot
.Core\Robot.cs:line 453
INFO : No logging rooms are enabled

This is my config. Browsed through the code to determine the additional options, but I assume the adapter assumes the cloud service rather than a local host. I removed my default gateway to force the issue and lo and behold..... Its trying to talk to api.hitchat.com

[HIPCHAT]
EMAIL = hubot@cha.rbxd.ds
PASSWORD = Welcome1
HOST = hipchat.cha.rbxd.ds
CONFHOST = hipchat.cha.rbxd.ds
AUTHTOKEN = QiaosTWeQWc5KDVhezRnJ6Xhf016I0mKPNobxCqE

ERROR: Could not run the adapter 'HipChatAdapter': The remote name could not be
resolved: 'api.hipchat.com'
System.Net.WebException: The remote name could not be resolved: 'api.hipchat.com
'
at System.Net.HttpWebRequest.GetResponse()
at ServiceStack.Net40PclExport.GetResponse(WebRequest webRequest)
at ServiceStack.HttpUtils.SendStringToUrl(String url, String method, String r
equestBody, String contentType, String accept, Action1 requestFilter, Action1
responseFilter)
at ServiceStack.HttpUtils.GetJsonFromUrl(String url, Action1 requestFilter, Action1 responseFilter)
at MMBot.HipChat.HipChatAPI.ViewUser(String userId)
at MMBot.HipChat.HipChatAdapter.SetupHipChatClient()
at MMBot.HipChat.HipChatAdapter.Run()
at MMBot.Robot.d__39.MoveNext() in z:\Builds\work\77d74f064ca6bd72\MMBot
.Core\Robot.cs:line 453
INFO : No logging rooms are enabled

Ill try getting this to compile under Win10 VS 2015, ive seen a couple posts about updating Nuget packages.

@devoncustard
Copy link
Author

The problem is this

namespace MMBot.HipChat
{
class HipChatAPI
{
private const string GetAllRoomsEndpoint = "https://api.hipchat.com/v2/room";
private const string GetRoomEndpoint = "https://api.hipchat.com/v2/room/{0}";
private const string ViewUserEndpoint = "https://api.hipchat.com/v2/user/{0}";
private const string SendRoomNotificationEndpoint = "https://api.hipchat.com/v2/room/{0}/notification";
private const string PrivateMessageUserEndpoint = "https://api.hipchat.com/v2/user/0}/message";

The constants only work for the cloud version of hipchat. Updating them to use my local server allows me to connect.

class HipChatAPI
{
private const string GetAllRoomsEndpoint = "https://hipchat.cha.rbxd.ds/v2/room";
private const string GetRoomEndpoint = "https://hipchat.cha.rbxd.ds/v2/room/{0}";
private const string ViewUserEndpoint = "https://hipchat.cha.rbxd.ds/v2/user/{0}";
private const string SendRoomNotificationEndpoint = "https://hipchat.cha.rbxd.ds/v2/room/{0}/notification";
private const string PrivateMessageUserEndpoint = "https://hipchat.cha.rbxd.ds/v2/user/{0}/message";

@PeteGoo
Copy link
Member

PeteGoo commented Oct 24, 2015

Cool. These could probably become optional configuration parameters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants