Skip to content

Commit

Permalink
feat: add possibility to send msg to thread (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
kseniyashaydurova authored Sep 24, 2021
1 parent fa6c155 commit b03cf7c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ __NOTE__: The module supports up to 8 Fields in an [attachment](https://api.slac
| fallback | SLACK_FALLBACK | A plain-text summary of the attachment. This text will be used in clients that don't show formatted text |
| color | SLACK_COLOR | An optional value that can either be one of `good`, `warning`, `danger`, or a color code (_e.g._ `#439FE0`) |
| channel | SLACK_CHANNEL | Slack channel to send to |
| thread | SLACK_THREAD | Slack channel thread to send to |
| pretext | SLACK_PRETEXT | Optional text that appears above the message attachment block |
| author_name | SLACK_AUTHOR_NAME | Small text to display the attachment author's name |
| author_link | SLACK_AUTHOR_LINK | URL that will hyperlink the author's name. Will only work if `author_name` is present |
Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var (
fallback = flag.String("fallback", os.Getenv("SLACK_FALLBACK"), "A plain-text summary of the attachment. This text will be used in clients that don't show formatted text")
color = flag.String("color", os.Getenv("SLACK_COLOR"), "An optional value that can either be one of good, warning, danger, or any hex color code (e.g. #439FE0)")
channel = flag.String("channel", os.Getenv("SLACK_CHANNEL"), "Slack channel to send to")
thread = flag.String("thread", os.Getenv("SLACK_THREAD"), "Slack channel thread to send to")
pretext = flag.String("pretext", os.Getenv("SLACK_PRETEXT"), "Optional text that appears above the message attachment block")
authorName = flag.String("author_name", os.Getenv("SLACK_AUTHOR_NAME"), "Small text to display the attachment author's name")
authorLink = flag.String("author_link", os.Getenv("SLACK_AUTHOR_LINK"), "URL that will hyperlink the author's name. Will only work if author_name is present")
Expand Down Expand Up @@ -135,6 +136,7 @@ func main() {
Username: *userName,
IconEmoji: *iconEmoji,
Channel: *channel,
Thread: *thread,
}

notifier := NewSlackNotifier(*webhookURL)
Expand Down
1 change: 1 addition & 0 deletions slack_notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Payload struct {
IconEmoji string `json:"icon_emoji"`
Username string `json:"username"`
Channel string `json:"channel"`
Thread string `json:"thread_ts,omitempty"`
}

// Attachment for a Slack message
Expand Down

0 comments on commit b03cf7c

Please sign in to comment.