{"action":"created","comment":{"url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/pulls/comments/69590764","id":69590764,"diff_hunk":"@@ -91,23 +104,70 @@ public void trigger(AlertCondition condition, AlertCondition.CheckResult alert)\n         }\n     }\n \n-    private RoomNotification buildRoomNotification(AlertCondition condition, AlertCondition.CheckResult alert) {\n-        // See https://www.hipchat.com/docs/apiv2/method/send_room_notification for valid parameters\n-        final String message = String.format(\"Stream <%s> alert: %s\",\n-                condition.getStream().getTitle(),\n-                alert.getResultDescription()\n-        );\n+    //TODO: Copied from StaticEmailAlertSender, could be moved to a utility class?\n+    public static String buildStreamDetailsURL(URI baseUri, AlertCondition.CheckResult checkResult, Stream stream) {\n+        if (baseUri != null && !Strings.isNullOrEmpty(baseUri.getHost())) {\n+            int time = 5;\n+            if (checkResult.getTriggeredCondition().getParameters().get(\"time\") != null) {\n+                time = ((Integer) checkResult.getTriggeredCondition().getParameters().get(\"time\")).intValue();\n+            }\n+            DateTime dateAlertEnd = checkResult.getTriggeredAt();\n+            DateTime dateAlertStart = dateAlertEnd.minusMinutes(time);\n+            String alertStart = Tools.getISO8601String(dateAlertStart);\n+            String alertEnd = Tools.getISO8601String(dateAlertEnd);\n+            return baseUri + \"/streams/\" + stream.getId() + \"/messages?rangetype=absolute&from=\" + alertStart + \"&to=\" + alertEnd + \"&q=*\";\n+        } else {\n+            return \"Please configure \\'transport_email_web_interface_url\\' in your Graylog configuration file.\";","path":"src/main/java/org/graylog2/alarmcallbacks/hipchat/HipChatTrigger.java","position":85,"original_position":91,"commit_id":"b93e431d9cff2bfb5a9587a64f45435d61a06b04","original_commit_id":"f2ff49ffc36b9810e0d922f6d735adabbc53bea9","user":{"login":"roland-ewald","id":392143,"avatar_url":"https://avatars.githubusercontent.com/u/392143?v=3","gravatar_id":"","url":"https://api.github.com/users/roland-ewald","html_url":"https://github.com/roland-ewald","followers_url":"https://api.github.com/users/roland-ewald/followers","following_url":"https://api.github.com/users/roland-ewald/following{/other_user}","gists_url":"https://api.github.com/users/roland-ewald/gists{/gist_id}","starred_url":"https://api.github.com/users/roland-ewald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roland-ewald/subscriptions","organizations_url":"https://api.github.com/users/roland-ewald/orgs","repos_url":"https://api.github.com/users/roland-ewald/repos","events_url":"https://api.github.com/users/roland-ewald/events{/privacy}","received_events_url":"https://api.github.com/users/roland-ewald/received_events","type":"User","site_admin":false},"body":"@joschi ah, I see. Yes, you are right.","created_at":"2016-07-05T16:05:03Z","updated_at":"2016-07-05T16:05:03Z","html_url":"https://github.com/Graylog2/graylog-plugin-hipchat/pull/10#discussion_r69590764","pull_request_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/pulls/comments/69590764"},"html":{"href":"https://github.com/Graylog2/graylog-plugin-hipchat/pull/10#discussion_r69590764"},"pull_request":{"href":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/pulls/10","id":74799170,"html_url":"https://github.com/Graylog2/graylog-plugin-hipchat/pull/10","diff_url":"https://github.com/Graylog2/graylog-plugin-hipchat/pull/10.diff","patch_url":"https://github.com/Graylog2/graylog-plugin-hipchat/pull/10.patch","issue_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/issues/10","number":10,"state":"open","locked":false,"title":"Fixes #4: support for custom JMTE templates","user":{"login":"roland-ewald","id":392143,"avatar_url":"https://avatars.githubusercontent.com/u/392143?v=3","gravatar_id":"","url":"https://api.github.com/users/roland-ewald","html_url":"https://github.com/roland-ewald","followers_url":"https://api.github.com/users/roland-ewald/followers","following_url":"https://api.github.com/users/roland-ewald/following{/other_user}","gists_url":"https://api.github.com/users/roland-ewald/gists{/gist_id}","starred_url":"https://api.github.com/users/roland-ewald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roland-ewald/subscriptions","organizations_url":"https://api.github.com/users/roland-ewald/orgs","repos_url":"https://api.github.com/users/roland-ewald/repos","events_url":"https://api.github.com/users/roland-ewald/events{/privacy}","received_events_url":"https://api.github.com/users/roland-ewald/received_events","type":"User","site_admin":false},"body":"Added two optional parameters that allow to specify:\r\n- a custom base URL from which the Graylog server can be reached\r\nwhen used on the HipChat server\r\n- a custom template that defaults to the email body\r\n\r\nInstead of the 'text' message format, the HipChat API is now called\r\nwith message format 'html'.\r\n\r\nUpdated `HipChatAlarmCallbackTest` and `README` accordingly.\r\n\r\nAdded `TODO` tags in `HipChatTrigger` where I had to copy&paste code from `FormattedEmailAlertSender` and `StaticEmailAlertSender`. \r\nI guess this part of the code could be made much nicer (e.g. there is probably a better way to get the base URL of the Graylog server?), but it seems that this would require additional changes to the email processing.","created_at":"2016-06-22T14:56:39Z","updated_at":"2016-07-05T16:05:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"53932a3a16b56a6c0e1f30ce60abb3675c8c553d","assignee":{"login":"joschi","id":43951,"avatar_url":"https://avatars.githubusercontent.com/u/43951?v=3","gravatar_id":"","url":"https://api.github.com/users/joschi","html_url":"https://github.com/joschi","followers_url":"https://api.github.com/users/joschi/followers","following_url":"https://api.github.com/users/joschi/following{/other_user}","gists_url":"https://api.github.com/users/joschi/gists{/gist_id}","starred_url":"https://api.github.com/users/joschi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joschi/subscriptions","organizations_url":"https://api.github.com/users/joschi/orgs","repos_url":"https://api.github.com/users/joschi/repos","events_url":"https://api.github.com/users/joschi/events{/privacy}","received_events_url":"https://api.github.com/users/joschi/received_events","type":"User","site_admin":false},"assignees":[{"login":"joschi","id":43951,"avatar_url":"https://avatars.githubusercontent.com/u/43951?v=3","gravatar_id":"","url":"https://api.github.com/users/joschi","html_url":"https://github.com/joschi","followers_url":"https://api.github.com/users/joschi/followers","following_url":"https://api.github.com/users/joschi/following{/other_user}","gists_url":"https://api.github.com/users/joschi/gists{/gist_id}","starred_url":"https://api.github.com/users/joschi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joschi/subscriptions","organizations_url":"https://api.github.com/users/joschi/orgs","repos_url":"https://api.github.com/users/joschi/repos","events_url":"https://api.github.com/users/joschi/events{/privacy}","received_events_url":"https://api.github.com/users/joschi/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/pulls/10/commits","review_comments_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/pulls/10/comments","review_comment_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/issues/10/comments","statuses_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/statuses/b93e431d9cff2bfb5a9587a64f45435d61a06b04","head":{"label":"limbus-medtec:master","ref":"master","sha":"b93e431d9cff2bfb5a9587a64f45435d61a06b04","user":{"login":"limbus-medtec","id":11234125,"avatar_url":"https://avatars.githubusercontent.com/u/11234125?v=3","gravatar_id":"","url":"https://api.github.com/users/limbus-medtec","html_url":"https://github.com/limbus-medtec","followers_url":"https://api.github.com/users/limbus-medtec/followers","following_url":"https://api.github.com/users/limbus-medtec/following{/other_user}","gists_url":"https://api.github.com/users/limbus-medtec/gists{/gist_id}","starred_url":"https://api.github.com/users/limbus-medtec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/limbus-medtec/subscriptions","organizations_url":"https://api.github.com/users/limbus-medtec/orgs","repos_url":"https://api.github.com/users/limbus-medtec/repos","events_url":"https://api.github.com/users/limbus-medtec/events{/privacy}","received_events_url":"https://api.github.com/users/limbus-medtec/received_events","type":"Organization","site_admin":false},"repo":{"id":61668870,"name":"graylog-plugin-hipchat","full_name":"limbus-medtec/graylog-plugin-hipchat","owner":{"login":"limbus-medtec","id":11234125,"avatar_url":"https://avatars.githubusercontent.com/u/11234125?v=3","gravatar_id":"","url":"https://api.github.com/users/limbus-medtec","html_url":"https://github.com/limbus-medtec","followers_url":"https://api.github.com/users/limbus-medtec/followers","following_url":"https://api.github.com/users/limbus-medtec/following{/other_user}","gists_url":"https://api.github.com/users/limbus-medtec/gists{/gist_id}","starred_url":"https://api.github.com/users/limbus-medtec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/limbus-medtec/subscriptions","organizations_url":"https://api.github.com/users/limbus-medtec/orgs","repos_url":"https://api.github.com/users/limbus-medtec/repos","events_url":"https://api.github.com/users/limbus-medtec/events{/privacy}","received_events_url":"https://api.github.com/users/limbus-medtec/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/limbus-medtec/graylog-plugin-hipchat","description":"Alarm callback that is writing to HipChat chatrooms","fork":true,"url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat","forks_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/forks","keys_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/teams","hooks_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/hooks","issue_events_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/issues/events{/number}","events_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/events","assignees_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/assignees{/user}","branches_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/branches{/branch}","tags_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/tags","blobs_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/git/refs{/sha}","trees_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/statuses/{sha}","languages_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/languages","stargazers_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/stargazers","contributors_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/contributors","subscribers_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/subscribers","subscription_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/subscription","commits_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/commits{/sha}","git_commits_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/git/commits{/sha}","comments_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/comments{/number}","issue_comment_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/issues/comments{/number}","contents_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/contents/{+path}","compare_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/merges","archive_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/downloads","issues_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/issues{/number}","pulls_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/pulls{/number}","milestones_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/milestones{/number}","notifications_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/labels{/name}","releases_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/releases{/id}","deployments_url":"https://api.github.com/repos/limbus-medtec/graylog-plugin-hipchat/deployments","created_at":"2016-06-21T21:37:48Z","updated_at":"2016-06-21T21:37:49Z","pushed_at":"2016-07-01T15:34:10Z","git_url":"git://github.com/limbus-medtec/graylog-plugin-hipchat.git","ssh_url":"git@github.com:limbus-medtec/graylog-plugin-hipchat.git","clone_url":"https://github.com/limbus-medtec/graylog-plugin-hipchat.git","svn_url":"https://github.com/limbus-medtec/graylog-plugin-hipchat","homepage":"https://marketplace.graylog.org/addons/e316cbfc-663f-4718-aa54-8aff97749449","size":67,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Graylog2:master","ref":"master","sha":"d1a5df99edc721527bb90f2e5e5af53fd983a57d","user":{"login":"Graylog2","id":474892,"avatar_url":"https://avatars.githubusercontent.com/u/474892?v=3","gravatar_id":"","url":"https://api.github.com/users/Graylog2","html_url":"https://github.com/Graylog2","followers_url":"https://api.github.com/users/Graylog2/followers","following_url":"https://api.github.com/users/Graylog2/following{/other_user}","gists_url":"https://api.github.com/users/Graylog2/gists{/gist_id}","starred_url":"https://api.github.com/users/Graylog2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Graylog2/subscriptions","organizations_url":"https://api.github.com/users/Graylog2/orgs","repos_url":"https://api.github.com/users/Graylog2/repos","events_url":"https://api.github.com/users/Graylog2/events{/privacy}","received_events_url":"https://api.github.com/users/Graylog2/received_events","type":"Organization","site_admin":false},"repo":{"id":7431839,"name":"graylog-plugin-hipchat","full_name":"Graylog2/graylog-plugin-hipchat","owner":{"login":"Graylog2","id":474892,"avatar_url":"https://avatars.githubusercontent.com/u/474892?v=3","gravatar_id":"","url":"https://api.github.com/users/Graylog2","html_url":"https://github.com/Graylog2","followers_url":"https://api.github.com/users/Graylog2/followers","following_url":"https://api.github.com/users/Graylog2/following{/other_user}","gists_url":"https://api.github.com/users/Graylog2/gists{/gist_id}","starred_url":"https://api.github.com/users/Graylog2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Graylog2/subscriptions","organizations_url":"https://api.github.com/users/Graylog2/orgs","repos_url":"https://api.github.com/users/Graylog2/repos","events_url":"https://api.github.com/users/Graylog2/events{/privacy}","received_events_url":"https://api.github.com/users/Graylog2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Graylog2/graylog-plugin-hipchat","description":"Alarm callback that is writing to HipChat chatrooms","fork":false,"url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat","forks_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/forks","keys_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/teams","hooks_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/hooks","issue_events_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/issues/events{/number}","events_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/events","assignees_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/assignees{/user}","branches_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/branches{/branch}","tags_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/tags","blobs_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/git/refs{/sha}","trees_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/statuses/{sha}","languages_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/languages","stargazers_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/stargazers","contributors_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/contributors","subscribers_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/subscribers","subscription_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/subscription","commits_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/commits{/sha}","git_commits_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/git/commits{/sha}","comments_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/comments{/number}","issue_comment_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/issues/comments{/number}","contents_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/contents/{+path}","compare_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/merges","archive_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/downloads","issues_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/issues{/number}","pulls_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/pulls{/number}","milestones_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/milestones{/number}","notifications_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/labels{/name}","releases_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/releases{/id}","deployments_url":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/deployments","created_at":"2013-01-03T23:00:31Z","updated_at":"2016-06-21T21:36:18Z","pushed_at":"2016-07-01T15:34:10Z","git_url":"git://github.com/Graylog2/graylog-plugin-hipchat.git","ssh_url":"git@github.com:Graylog2/graylog-plugin-hipchat.git","clone_url":"https://github.com/Graylog2/graylog-plugin-hipchat.git","svn_url":"https://github.com/Graylog2/graylog-plugin-hipchat","homepage":"https://marketplace.graylog.org/addons/e316cbfc-663f-4718-aa54-8aff97749449","size":76,"stargazers_count":7,"watchers_count":7,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":5,"forks":11,"open_issues":5,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/pulls/10"},"html":{"href":"https://github.com/Graylog2/graylog-plugin-hipchat/pull/10"},"issue":{"href":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/issues/10"},"comments":{"href":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/Graylog2/graylog-plugin-hipchat/statuses/b93e431d9cff2bfb5a9587a64f45435d61a06b04"}}}}
{"actor":{"display_login":"roland-ewald"}}