Skip to content

Commit

Permalink
Merge pull request #23 from aktsk/adopt-new-slack-api
Browse files Browse the repository at this point in the history
Adopt new Slack API
  • Loading branch information
mizzy authored Jun 30, 2020
2 parents 0d81975 + fb8c023 commit 784d9e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
3 changes: 0 additions & 3 deletions example/cloud-functions/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
13 changes: 3 additions & 10 deletions lib/notify/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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{
Expand Down

0 comments on commit 784d9e6

Please sign in to comment.