{"action":"created","comment":{"url":"https://api.github.com/repos/jenkinsci/slack-plugin/pulls/comments/49147336","id":49147336,"diff_hunk":"@@ -0,0 +1,245 @@\n+package jenkins.plugins.slack.webhook;\n+\n+\n+import jenkins.model.Jenkins;\n+import jenkins.model.GlobalConfiguration;\n+\n+import hudson.Extension;\n+\n+import hudson.model.Build;\n+import hudson.model.Result;\n+import hudson.model.Project;\n+import hudson.model.AbstractBuild;\n+import hudson.model.AbstractProject;\n+import hudson.model.UnprotectedRootAction;\n+\n+import hudson.security.ACL;\n+\n+import javax.servlet.ServletException;\n+\n+import java.io.IOException;\n+\n+import java.util.List;\n+import java.util.ArrayList;\n+\n+import java.util.logging.Logger;\n+\n+import org.kohsuke.stapler.HttpResponse;\n+import org.kohsuke.stapler.StaplerRequest;\n+import org.kohsuke.stapler.StaplerResponse;\n+\n+import org.kohsuke.stapler.interceptor.RequirePOST;\n+\n+import jenkins.plugins.slack.webhook.model.JsonResponse;\n+import jenkins.plugins.slack.webhook.model.SlackPostData;\n+import jenkins.plugins.slack.webhook.model.SlackTextMessage;\n+import jenkins.plugins.slack.webhook.model.SlackWebhookCause;\n+\n+import jenkins.plugins.slack.webhook.exception.CommandRouterException;\n+import jenkins.plugins.slack.webhook.exception.RouteNotFoundException;\n+\n+\n+\n+\n+@Extension\n+public class WebhookEndpoint implements UnprotectedRootAction {\n+\n+    private String slackUser;\n+\n+    private GlobalConfig globalConfig;\n+\n+    private static final Logger LOGGER =\n+        Logger.getLogger(WebhookEndpoint.class.getName());\n+\n+    public WebhookEndpoint() {\n+        globalConfig = GlobalConfiguration.all().get(GlobalConfig.class);\n+    }\n+\n+    @Override\n+    public String getUrlName() {\n+        return \"webhook\";","path":"src/main/java/jenkins/plugins/slack/webhook/WebhookEndpoint.java","position":60,"original_position":60,"commit_id":"5cf2087b7620fbb5d521c0ca84b1ed237d534c32","original_commit_id":"5cf2087b7620fbb5d521c0ca84b1ed237d534c32","user":{"login":"OwensCode","id":7966269,"avatar_url":"https://avatars.githubusercontent.com/u/7966269?v=3","gravatar_id":"","url":"https://api.github.com/users/OwensCode","html_url":"https://github.com/OwensCode","followers_url":"https://api.github.com/users/OwensCode/followers","following_url":"https://api.github.com/users/OwensCode/following{/other_user}","gists_url":"https://api.github.com/users/OwensCode/gists{/gist_id}","starred_url":"https://api.github.com/users/OwensCode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OwensCode/subscriptions","organizations_url":"https://api.github.com/users/OwensCode/orgs","repos_url":"https://api.github.com/users/OwensCode/repos","events_url":"https://api.github.com/users/OwensCode/events{/privacy}","received_events_url":"https://api.github.com/users/OwensCode/received_events","type":"User","site_admin":false},"body":"I don't know how easy it would be to do this, but it would be nice if the URL could be configurable. What if you want to install multiple plugins that are accessible on a URL?","created_at":"2016-01-08T00:50:51Z","updated_at":"2016-01-08T00:50:51Z","html_url":"https://github.com/jenkinsci/slack-plugin/pull/160#discussion_r49147336","pull_request_url":"https://api.github.com/repos/jenkinsci/slack-plugin/pulls/160","_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/slack-plugin/pulls/comments/49147336"},"html":{"href":"https://github.com/jenkinsci/slack-plugin/pull/160#discussion_r49147336"},"pull_request":{"href":"https://api.github.com/repos/jenkinsci/slack-plugin/pulls/160"}}},"pull_request":{"url":"https://api.github.com/repos/jenkinsci/slack-plugin/pulls/160","id":51553655,"html_url":"https://github.com/jenkinsci/slack-plugin/pull/160","diff_url":"https://github.com/jenkinsci/slack-plugin/pull/160.diff","patch_url":"https://github.com/jenkinsci/slack-plugin/pull/160.patch","issue_url":"https://api.github.com/repos/jenkinsci/slack-plugin/issues/160","number":160,"state":"open","locked":false,"title":"Adding webhook/ endpoint for exposing jenkins commands with a Slack outgoing-webhook","user":{"login":"dpires","id":697312,"avatar_url":"https://avatars.githubusercontent.com/u/697312?v=3","gravatar_id":"","url":"https://api.github.com/users/dpires","html_url":"https://github.com/dpires","followers_url":"https://api.github.com/users/dpires/followers","following_url":"https://api.github.com/users/dpires/following{/other_user}","gists_url":"https://api.github.com/users/dpires/gists{/gist_id}","starred_url":"https://api.github.com/users/dpires/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpires/subscriptions","organizations_url":"https://api.github.com/users/dpires/orgs","repos_url":"https://api.github.com/users/dpires/repos","events_url":"https://api.github.com/users/dpires/events{/privacy}","received_events_url":"https://api.github.com/users/dpires/received_events","type":"User","site_admin":false},"body":"I've added an endpoint extension (/webhook/) to allow Slack outgoing-webhook functionality.\r\n\r\nThere is a new Slack Webhook Settings configuration option to add an outgoing-webhook token. \r\n\r\nI have placed everything in a new jenkins.plugins.slack.webhook package.","created_at":"2015-11-23T17:27:27Z","updated_at":"2016-01-08T00:50:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"910bd8308d0629ec09f0ae54e70fa6f9cc415928","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jenkinsci/slack-plugin/pulls/160/commits","review_comments_url":"https://api.github.com/repos/jenkinsci/slack-plugin/pulls/160/comments","review_comment_url":"https://api.github.com/repos/jenkinsci/slack-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jenkinsci/slack-plugin/issues/160/comments","statuses_url":"https://api.github.com/repos/jenkinsci/slack-plugin/statuses/5cf2087b7620fbb5d521c0ca84b1ed237d534c32","head":{"label":"dpires:master","ref":"master","sha":"5cf2087b7620fbb5d521c0ca84b1ed237d534c32","user":{"login":"dpires","id":697312,"avatar_url":"https://avatars.githubusercontent.com/u/697312?v=3","gravatar_id":"","url":"https://api.github.com/users/dpires","html_url":"https://github.com/dpires","followers_url":"https://api.github.com/users/dpires/followers","following_url":"https://api.github.com/users/dpires/following{/other_user}","gists_url":"https://api.github.com/users/dpires/gists{/gist_id}","starred_url":"https://api.github.com/users/dpires/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpires/subscriptions","organizations_url":"https://api.github.com/users/dpires/orgs","repos_url":"https://api.github.com/users/dpires/repos","events_url":"https://api.github.com/users/dpires/events{/privacy}","received_events_url":"https://api.github.com/users/dpires/received_events","type":"User","site_admin":false},"repo":{"id":46729967,"name":"slack-plugin","full_name":"dpires/slack-plugin","owner":{"login":"dpires","id":697312,"avatar_url":"https://avatars.githubusercontent.com/u/697312?v=3","gravatar_id":"","url":"https://api.github.com/users/dpires","html_url":"https://github.com/dpires","followers_url":"https://api.github.com/users/dpires/followers","following_url":"https://api.github.com/users/dpires/following{/other_user}","gists_url":"https://api.github.com/users/dpires/gists{/gist_id}","starred_url":"https://api.github.com/users/dpires/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpires/subscriptions","organizations_url":"https://api.github.com/users/dpires/orgs","repos_url":"https://api.github.com/users/dpires/repos","events_url":"https://api.github.com/users/dpires/events{/privacy}","received_events_url":"https://api.github.com/users/dpires/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dpires/slack-plugin","description":"A Jenkins CI plugin for posting notifications to a Slack channel","fork":true,"url":"https://api.github.com/repos/dpires/slack-plugin","forks_url":"https://api.github.com/repos/dpires/slack-plugin/forks","keys_url":"https://api.github.com/repos/dpires/slack-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dpires/slack-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dpires/slack-plugin/teams","hooks_url":"https://api.github.com/repos/dpires/slack-plugin/hooks","issue_events_url":"https://api.github.com/repos/dpires/slack-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/dpires/slack-plugin/events","assignees_url":"https://api.github.com/repos/dpires/slack-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/dpires/slack-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/dpires/slack-plugin/tags","blobs_url":"https://api.github.com/repos/dpires/slack-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dpires/slack-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dpires/slack-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/dpires/slack-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dpires/slack-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/dpires/slack-plugin/languages","stargazers_url":"https://api.github.com/repos/dpires/slack-plugin/stargazers","contributors_url":"https://api.github.com/repos/dpires/slack-plugin/contributors","subscribers_url":"https://api.github.com/repos/dpires/slack-plugin/subscribers","subscription_url":"https://api.github.com/repos/dpires/slack-plugin/subscription","commits_url":"https://api.github.com/repos/dpires/slack-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/dpires/slack-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/dpires/slack-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/dpires/slack-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/dpires/slack-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/dpires/slack-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dpires/slack-plugin/merges","archive_url":"https://api.github.com/repos/dpires/slack-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dpires/slack-plugin/downloads","issues_url":"https://api.github.com/repos/dpires/slack-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/dpires/slack-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/dpires/slack-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/dpires/slack-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dpires/slack-plugin/labels{/name}","releases_url":"https://api.github.com/repos/dpires/slack-plugin/releases{/id}","created_at":"2015-11-23T15:39:22Z","updated_at":"2015-11-23T15:39:22Z","pushed_at":"2016-01-06T19:34:55Z","git_url":"git://github.com/dpires/slack-plugin.git","ssh_url":"git@github.com:dpires/slack-plugin.git","clone_url":"https://github.com/dpires/slack-plugin.git","svn_url":"https://github.com/dpires/slack-plugin","homepage":null,"size":198,"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":"jenkinsci:master","ref":"master","sha":"61f2cf72b36eecceb5d932a7392ce47382261c01","user":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"repo":{"id":14600358,"name":"slack-plugin","full_name":"jenkinsci/slack-plugin","owner":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jenkinsci/slack-plugin","description":"A Jenkins CI plugin for posting notifications to a Slack channel","fork":true,"url":"https://api.github.com/repos/jenkinsci/slack-plugin","forks_url":"https://api.github.com/repos/jenkinsci/slack-plugin/forks","keys_url":"https://api.github.com/repos/jenkinsci/slack-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenkinsci/slack-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenkinsci/slack-plugin/teams","hooks_url":"https://api.github.com/repos/jenkinsci/slack-plugin/hooks","issue_events_url":"https://api.github.com/repos/jenkinsci/slack-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/jenkinsci/slack-plugin/events","assignees_url":"https://api.github.com/repos/jenkinsci/slack-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/jenkinsci/slack-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/jenkinsci/slack-plugin/tags","blobs_url":"https://api.github.com/repos/jenkinsci/slack-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenkinsci/slack-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenkinsci/slack-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenkinsci/slack-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenkinsci/slack-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/jenkinsci/slack-plugin/languages","stargazers_url":"https://api.github.com/repos/jenkinsci/slack-plugin/stargazers","contributors_url":"https://api.github.com/repos/jenkinsci/slack-plugin/contributors","subscribers_url":"https://api.github.com/repos/jenkinsci/slack-plugin/subscribers","subscription_url":"https://api.github.com/repos/jenkinsci/slack-plugin/subscription","commits_url":"https://api.github.com/repos/jenkinsci/slack-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenkinsci/slack-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenkinsci/slack-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenkinsci/slack-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenkinsci/slack-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/jenkinsci/slack-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenkinsci/slack-plugin/merges","archive_url":"https://api.github.com/repos/jenkinsci/slack-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenkinsci/slack-plugin/downloads","issues_url":"https://api.github.com/repos/jenkinsci/slack-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/jenkinsci/slack-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/jenkinsci/slack-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/jenkinsci/slack-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenkinsci/slack-plugin/labels{/name}","releases_url":"https://api.github.com/repos/jenkinsci/slack-plugin/releases{/id}","created_at":"2013-11-21T21:20:04Z","updated_at":"2016-01-07T00:21:03Z","pushed_at":"2016-01-06T19:34:56Z","git_url":"git://github.com/jenkinsci/slack-plugin.git","ssh_url":"git@github.com:jenkinsci/slack-plugin.git","clone_url":"https://github.com/jenkinsci/slack-plugin.git","svn_url":"https://github.com/jenkinsci/slack-plugin","homepage":null,"size":297,"stargazers_count":137,"watchers_count":137,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":131,"mirror_url":null,"open_issues_count":53,"forks":131,"open_issues":53,"watchers":137,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/slack-plugin/pulls/160"},"html":{"href":"https://github.com/jenkinsci/slack-plugin/pull/160"},"issue":{"href":"https://api.github.com/repos/jenkinsci/slack-plugin/issues/160"},"comments":{"href":"https://api.github.com/repos/jenkinsci/slack-plugin/issues/160/comments"},"review_comments":{"href":"https://api.github.com/repos/jenkinsci/slack-plugin/pulls/160/comments"},"review_comment":{"href":"https://api.github.com/repos/jenkinsci/slack-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jenkinsci/slack-plugin/pulls/160/commits"},"statuses":{"href":"https://api.github.com/repos/jenkinsci/slack-plugin/statuses/5cf2087b7620fbb5d521c0ca84b1ed237d534c32"}}}}