MCPcopy
hub / github.com/sourcegraph/checkup / Send

Method Send

notifier/slack/slack.go:49–63  ·  view source on GitHub ↗

Send request via Slack API to create incident

(result types.Result)

Source from the content-addressed store, hash-verified

47
48// Send request via Slack API to create incident
49func (s Notifier) Send(result types.Result) error {
50 color := "danger"
51 attach := slack.Attachment{}
52 attach.AddField(slack.Field{Title: result.Title, Value: result.Endpoint})
53 attach.AddField(slack.Field{Title: "Status", Value: strings.ToUpper(fmt.Sprint(result.Status()))})
54 attach.Color = &color
55 payload := slack.Payload{
56 Text: result.Title,
57 Username: s.Username,
58 Channel: s.Channel,
59 Attachments: []slack.Attachment{attach},
60 }
61
62 return types.Errors(slack.Send(s.Webhook, "", payload))
63}

Callers 1

NotifyMethod · 0.95

Implementers 3

fakecheckup_test.go
Notifiernotifier/slack/slack.go
Notifiernotifier/mail/mail.go

Calls 2

ErrorsTypeAlias · 0.92
StatusMethod · 0.80

Tested by

no test coverage detected