From 7c27628976167968203e850da252433ae6fba7ea Mon Sep 17 00:00:00 2001 From: Mark Steve Samson Date: Thu, 23 Oct 2014 14:00:29 +0800 Subject: [PATCH] Update Slack plugin config (Closes #612) --- plugin/notify/slack.go | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/plugin/notify/slack.go b/plugin/notify/slack.go index 356948ce4..395a4df63 100644 --- a/plugin/notify/slack.go +++ b/plugin/notify/slack.go @@ -8,7 +8,6 @@ import ( ) const ( - slackEndpoint = "https://%s.slack.com/services/hooks/incoming-webhook?token=%s" slackStartedMessage = "*Building* <%s|%s> (%s) by %s" slackStartedFallbackMessage = "Building %s (%s) by %s" slackSuccessMessage = "*Success* <%s|%s> (%s) by %s" @@ -18,13 +17,12 @@ const ( ) type Slack struct { - Team string `yaml:"team,omitempty"` - Channel string `yaml:"channel,omitempty"` - Username string `yaml:"username,omitempty"` - Token string `yaml:"token,omitempty"` - Started bool `yaml:"on_started,omitempty"` - Success bool `yaml:"on_success,omitempty"` - Failure bool `yaml:"on_failure,omitempty"` + WebhookUrl string `yaml:"webhook_url,omitempty"` + Channel string `yaml:"channel,omitempty"` + Username string `yaml:"username,omitempty"` + Started bool `yaml:"on_started,omitempty"` + Success bool `yaml:"on_success,omitempty"` + Failure bool `yaml:"on_failure,omitempty"` } func (s *Slack) Send(context *model.Request) error { @@ -100,10 +98,7 @@ func (s *Slack) send(msg string, fallback string, color string) error { return err } - // send payload - url := fmt.Sprintf(slackEndpoint, s.Team, s.Token) - - go sendJson(url, payload, nil) + go sendJson(s.WebhookUrl, payload, nil) return nil }