From eebaad7acce6ec6faff20aa0c032f2cbc2b393b5 Mon Sep 17 00:00:00 2001 From: Gosuke Miyashita Date: Tue, 30 Jun 2020 16:50:21 +0900 Subject: [PATCH 1/2] Remove Channel, IconURL and UserName Because recent Slack app incoming webhook does not need these settings. --- lib/notify/slack.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/notify/slack.go b/lib/notify/slack.go index dcb771f..27cdb28 100644 --- a/lib/notify/slack.go +++ b/lib/notify/slack.go @@ -9,12 +9,9 @@ import ( // Slack has configurations for notifying to Slack type Slack struct { - Channel string `json:"channel"` - URL string `json:"-"` - IconURL string `json:"icon_url"` - UserName string `json:"username"` - Title string `json:"title"` - Color string `json:"color"` + URL string `json:"-"` + Title string `json:"title"` + Color string `json:"color"` } type payload struct { @@ -29,10 +26,6 @@ type attachment struct { // Notify notifies BigQuery query results to Slack func (s Slack) Notify(message string) error { - if s.Channel[0] != '#' { - s.Channel = "#" + s.Channel - } - color := s.Color a := attachment{ From fb8c023b68b7ec5f0d9891245edb32218b5323b7 Mon Sep 17 00:00:00 2001 From: Gosuke Miyashita Date: Tue, 30 Jun 2020 16:52:00 +0900 Subject: [PATCH 2/2] Remove channel, username and iconurl from sample config.yaml --- example/cloud-functions/config.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/example/cloud-functions/config.yaml b/example/cloud-functions/config.yaml index 2eb5eab..458bc29 100644 --- a/example/cloud-functions/config.yaml +++ b/example/cloud-functions/config.yaml @@ -25,9 +25,6 @@ queries: # url: $SLACK_WEBHOOK_URL (Define SLACK_WEBHOOK_URL by the environment valiable) # Or you can also define global slack settings slack: - channel: test title: クエリの結果です color: good # good or danger or warning - username: bqnotifybot - iconurl: https://avatars0.githubusercontent.com/u/7151005 # url: $SLACK_WEBHOOK_URL (Define SLACK_WEBHOOK_URL by the environment valiable)