| 1 | package mainscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack/examples/webhooks`/ |
| 2 | |
| 3 | import ( |
| 4 | "encoding/jsonscip-go gomod github.com/golang/go/src go1.16 `encoding/json`/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.16 fmt/" |
| 6 | "strconvscip-go gomod github.com/golang/go/src go1.16 strconv/" |
| 7 | "timescip-go gomod github.com/golang/go/src go1.16 time/" |
| 8 | |
| 9 | "github.com/slack-go/slackscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/" |
| 10 | ) |
| 11 | |
| 12 | func mainscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack/examples/webhooks`/main().() { |
| 13 | attachment := slackscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/.Attachmentscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Attachment#{ |
| 14 | Colorscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Attachment#Color.: "good", |
| 15 | Fallbackscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Attachment#Fallback.: "You successfully posted by Incoming Webhook URL!", |
| 16 | AuthorNamescip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Attachment#AuthorName.: "slack-go/slack", |
| 17 | AuthorSubnamescip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Attachment#AuthorSubname.: "github.com", |
| 18 | AuthorLinkscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Attachment#AuthorLink.: "https://github.com/slack-go/slack", |
| 19 | AuthorIconscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Attachment#AuthorIcon.: "https://avatars2.githubusercontent.com/u/652790", |
| 20 | Textscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Attachment#Text.: "<!channel> All text in Slack uses the same system of escaping: chat messages, direct messages, file comments, etc. :smile:\nSee <https://api.slack.com/docs/message-formatting#linking_to_channels_and_users>", |
| 21 | Footerscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Attachment#Footer.: "slack api", |
| 22 | FooterIconscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Attachment#FooterIcon.: "https://platform.slack-edge.com/img/default_application_icon.png", |
| 23 | Tsscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Attachment#Ts.: jsonscip-go gomod github.com/golang/go/src go1.16 `encoding/json`/.Numberscip-go gomod github.com/golang/go/src go1.16 `encoding/json`/Number#(strconvscip-go gomod github.com/golang/go/src go1.16 strconv/.FormatIntscip-go gomod github.com/golang/go/src go1.16 strconv/FormatInt().(timescip-go gomod github.com/golang/go/src go1.16 time/.Nowscip-go gomod github.com/golang/go/src go1.16 time/Now().().Unixscip-go gomod github.com/golang/go/src go1.16 time/Time#Unix().(), 10)), |
| 24 | } |
| 25 | msg := slackscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/.WebhookMessagescip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WebhookMessage#{ |
| 26 | Attachmentsscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/WebhookMessage#Attachments.: []slackscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/.Attachmentscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/Attachment#{attachment}, |
| 27 | } |
| 28 | |
| 29 | err := slackscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/.PostWebhookscip-go gomod github.com/slack-go/slack . `github.com/slack-go/slack`/PostWebhook().("YOUR_WEBHOOK_URL_HERE", &msg) |
| 30 | if err != nil { |
| 31 | fmtscip-go gomod github.com/golang/go/src go1.16 fmt/.Printlnscip-go gomod github.com/golang/go/src go1.16 fmt/Println().(err) |
| 32 | } |
| 33 | } |