Skip to content

Commit b03cf7c

Browse files
feat: add possibility to send msg to thread (#10)
1 parent fa6c155 commit b03cf7c

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ __NOTE__: The module supports up to 8 Fields in an [attachment](https://api.slac
2727
| fallback | SLACK_FALLBACK | A plain-text summary of the attachment. This text will be used in clients that don't show formatted text |
2828
| color | SLACK_COLOR | An optional value that can either be one of `good`, `warning`, `danger`, or a color code (_e.g._ `#439FE0`) |
2929
| channel | SLACK_CHANNEL | Slack channel to send to |
30+
| thread | SLACK_THREAD | Slack channel thread to send to |
3031
| pretext | SLACK_PRETEXT | Optional text that appears above the message attachment block |
3132
| author_name | SLACK_AUTHOR_NAME | Small text to display the attachment author's name |
3233
| author_link | SLACK_AUTHOR_LINK | URL that will hyperlink the author's name. Will only work if `author_name` is present |

main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var (
1515
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")
1616
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)")
1717
channel = flag.String("channel", os.Getenv("SLACK_CHANNEL"), "Slack channel to send to")
18+
thread = flag.String("thread", os.Getenv("SLACK_THREAD"), "Slack channel thread to send to")
1819
pretext = flag.String("pretext", os.Getenv("SLACK_PRETEXT"), "Optional text that appears above the message attachment block")
1920
authorName = flag.String("author_name", os.Getenv("SLACK_AUTHOR_NAME"), "Small text to display the attachment author's name")
2021
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")
@@ -135,6 +136,7 @@ func main() {
135136
Username: *userName,
136137
IconEmoji: *iconEmoji,
137138
Channel: *channel,
139+
Thread: *thread,
138140
}
139141

140142
notifier := NewSlackNotifier(*webhookURL)

slack_notifier.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type Payload struct {
2222
IconEmoji string `json:"icon_emoji"`
2323
Username string `json:"username"`
2424
Channel string `json:"channel"`
25+
Thread string `json:"thread_ts,omitempty"`
2526
}
2627

2728
// Attachment for a Slack message

0 commit comments

Comments
 (0)